Skip to content

Commit

Permalink
Merge pull request #1 from seregazhuk/scrutinizer-patch-1
Browse files Browse the repository at this point in the history
Scrutinizer Auto-Fixes
  • Loading branch information
seregazhuk committed Aug 19, 2016
2 parents eb9bf04 + fce4679 commit 27d42ed
Showing 1 changed file with 79 additions and 79 deletions.
158 changes: 79 additions & 79 deletions src/Api/Endpoints/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,93 +6,93 @@

class Endpoint
{
/**
* @var array
*/
protected $allowedMethods = [
'getById',
'getAll',
'create',
'update',
'delete',
];
/**
* @var array
*/
protected $allowedMethods = [
'getById',
'getAll',
'create',
'update',
'delete',
];

/**
* @var string
*/
protected $endpoint;
/**
* @var string
*/
protected $endpoint;

/**
* @var array
*/
protected $headers = [];
/**
* @var array
*/
protected $headers = [];

/**
* @var HttpInterface
*/
protected $http;
/**
* @var HttpInterface
*/
protected $http;

/**
* @param HttpInterface $http
*/
public function __construct(HttpInterface $http)
{
$this->http = $http;
}
/**
* @param HttpInterface $http
*/
public function __construct(HttpInterface $http)
{
$this->http = $http;
}

/**
* @param string $verb
* @return string
*/
public function makeRequestUrl($verb = '')
{
return "https://favro.com/api/v1/{$this->endpoint}/$verb";
}
/**
* @param string $verb
* @return string
*/
public function makeRequestUrl($verb = '')
{
return "https://favro.com/api/v1/{$this->endpoint}/$verb";
}

/**
* @param string $method
* @return bool
*/
public function isMethodAllowed($method)
{
return in_array($method, $this->allowedMethods);
}
/**
* @param string $method
* @return bool
*/
public function isMethodAllowed($method)
{
return in_array($method, $this->allowedMethods);
}

/**
* @return HttpInterface
*/
public function getHttp()
{
return $this->http;
}
/**
* @return HttpInterface
*/
public function getHttp()
{
return $this->http;
}

/**
* @param array $params
* @return array
*/
public function getAll(array $params = [])
{
return $this->getHttp()->get(
$this->makeRequestUrl(), $params, $this->getHeaders()
);
}
/**
* @param array $params
* @return array
*/
public function getAll(array $params = [])
{
return $this->getHttp()->get(
$this->makeRequestUrl(), $params, $this->getHeaders()
);
}

/**
* @param string $id
* @return array
*/
public function getById($id)
{
return $this->getHttp()->get(
$this->makeRequestUrl($id), [], $this->getHeaders()
);
}
/**
* @param string $id
* @return array
*/
public function getById($id)
{
return $this->getHttp()->get(
$this->makeRequestUrl($id), [], $this->getHeaders()
);
}

/**
* @return array
*/
protected function getHeaders()
{
return $this->headers;
}
/**
* @return array
*/
protected function getHeaders()
{
return $this->headers;
}
}

0 comments on commit 27d42ed

Please sign in to comment.