Skip to content
This repository has been archived by the owner on May 28, 2021. It is now read-only.

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault committed Apr 8, 2017
1 parent 2cf6ccb commit e8469de
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Exceptions/RequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

class RequestException extends Exception
{
//
//
}
7 changes: 4 additions & 3 deletions src/RestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ public function request($method, $url, array $data = [])
if ($this->curl->error) {
throw new TaigaException(static::getErrorMessage($this->curl));
}

return $this->curl->response;
}

protected static function getErrorMessage(Curl $curl)
{
return sprintf('Error %s - %s: %s',
$curl->errorCode,
$curl->effectiveUrl,
return sprintf('Error %s - %s: %s',
$curl->errorCode,
$curl->effectiveUrl,
$curl->errorMessage
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public function __construct(RestClient $taiga, $prefix)
$this->prefix = $prefix;
}

public function __call($method, $arguments)
public function __call($method, $arguments)
{
$method = strtoupper($method);

if(!in_array($method, static::$ALLOWED_HTTP_METHODS)) {
throw new RequestException(sprintf("The HTTP method '%s' is not allowed. The only allowed methods are %s.",
if (!in_array($method, static::$ALLOWED_HTTP_METHODS)) {
throw new RequestException(sprintf("The HTTP method '%s' is not allowed. The only allowed methods are %s.",
$name,
implode(', ', static::$ALLOWED_HTTP_METHODS)
));
Expand All @@ -40,7 +40,7 @@ public function __call($method, $arguments)
$data = isset($arguments[2]) ? $arguments[2] : [];

return $this->taiga->request(
$method,
$method,
sprintf('%s%s?%s', $this->prefix, $url, http_build_query($params), $data)
);
}
Expand Down
1 change: 0 additions & 1 deletion src/Services/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class Projects extends Service
{

public function __construct(RestClient $taiga)
{
parent::__construct($taiga, 'projects');
Expand Down
1 change: 0 additions & 1 deletion src/Services/Severities.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class Severities extends Service
{

public function __construct(RestClient $taiga)
{
parent::__construct($taiga, 'severities');
Expand Down
4 changes: 2 additions & 2 deletions src/Taiga.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Curl\Curl;
use TZK\Taiga\Exceptions\TaigaException;
use TZK\Taiga\Service;

class Taiga extends RestClient
{
Expand All @@ -22,7 +21,7 @@ public function __construct($baseUrl, $token, $language = 'en')

if (class_exists($class)) {
$instance = new $class($this);
if($instance instanceof Service) {
if ($instance instanceof Service) {
$this->services[lcfirst($basename)] = $instance;
}
}
Expand All @@ -46,6 +45,7 @@ public static function getAuthToken($baseUrl, array $credentials)
if ($curl->error) {
throw new TaigaException(static::getErrorMessage($curl));
}

return $curl->response->auth_token;
}

Expand Down

0 comments on commit e8469de

Please sign in to comment.