From f1b2cd9906bf05951d0bac370f9bdf5df5e4e77d Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 01:34:23 +0100 Subject: [PATCH 01/18] Guzzle 7 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 538ccb9..bfb8ee2 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": ">=5.3", - "guzzlehttp/guzzle": "~3.7" + "guzzlehttp/guzzle": "~7" }, "require-dev": { "phpunit/phpunit": "^4.8" From 7ea092e5133a97529f207792ec477e0bf835519e Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 01:49:48 +0100 Subject: [PATCH 02/18] Guzzle 7 --- composer.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index bfb8ee2..ef9b235 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,18 @@ { - "name": "cdaguerre/php-trello-api", + "name": "matteocacciola/php-trello-api", "type": "library", "description": "Trello API v1 client", - "homepage": "https://github.com/cdaguerre/php-trello-api", + "homepage": "https://github.com/matteocacciola/php-trello-api", "keywords": ["trello"], "license": "MIT", "authors": [ { "name": "Christian Daguerre", "email": "christian@daguer.re" + }, + { + "name": "Matteo Cacciola", + "email": "matteo.cacciola@gmail.com" } ], "require": { From ac07e5849b7b3566f18c9380655351988c05b3cc Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 02:11:33 +0100 Subject: [PATCH 03/18] Revert "Guzzle 7" This reverts commit 7ea092e5 --- composer.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index ef9b235..bfb8ee2 100644 --- a/composer.json +++ b/composer.json @@ -1,18 +1,14 @@ { - "name": "matteocacciola/php-trello-api", + "name": "cdaguerre/php-trello-api", "type": "library", "description": "Trello API v1 client", - "homepage": "https://github.com/matteocacciola/php-trello-api", + "homepage": "https://github.com/cdaguerre/php-trello-api", "keywords": ["trello"], "license": "MIT", "authors": [ { "name": "Christian Daguerre", "email": "christian@daguer.re" - }, - { - "name": "Matteo Cacciola", - "email": "matteo.cacciola@gmail.com" } ], "require": { From 2c79b42e9d61e39127bf57b4dea3bd0bd100df58 Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 02:11:36 +0100 Subject: [PATCH 04/18] Revert "Guzzle 7" This reverts commit f1b2cd99 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bfb8ee2..538ccb9 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": ">=5.3", - "guzzlehttp/guzzle": "~7" + "guzzlehttp/guzzle": "~3.7" }, "require-dev": { "phpunit/phpunit": "^4.8" From 79c68ff56ca3468e7356c9a20ec33e648c67d232 Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 02:15:17 +0100 Subject: [PATCH 05/18] Revert "Revert "Guzzle 7"" This reverts commit 2c79b42e --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 538ccb9..bfb8ee2 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": ">=5.3", - "guzzlehttp/guzzle": "~3.7" + "guzzlehttp/guzzle": "~7" }, "require-dev": { "phpunit/phpunit": "^4.8" From ba54a435a525fdb3a33745cdf53d2c562f9f698d Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 02:15:19 +0100 Subject: [PATCH 06/18] Revert "Revert "Guzzle 7"" This reverts commit ac07e584 --- composer.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index bfb8ee2..ef9b235 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,18 @@ { - "name": "cdaguerre/php-trello-api", + "name": "matteocacciola/php-trello-api", "type": "library", "description": "Trello API v1 client", - "homepage": "https://github.com/cdaguerre/php-trello-api", + "homepage": "https://github.com/matteocacciola/php-trello-api", "keywords": ["trello"], "license": "MIT", "authors": [ { "name": "Christian Daguerre", "email": "christian@daguer.re" + }, + { + "name": "Matteo Cacciola", + "email": "matteo.cacciola@gmail.com" } ], "require": { From 1ad104a520708f672ddc0a73de87f5984a8c22ff Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 02:35:33 +0100 Subject: [PATCH 07/18] Guzzle 5.3 --- .gitignore | 1 + composer.json | 2 +- lib/Trello/Api/AbstractApi.php | 6 +++--- lib/Trello/HttpClient/HttpClient.php | 8 ++++---- lib/Trello/HttpClient/HttpClientInterface.php | 2 +- lib/Trello/HttpClient/Listener/AuthListener.php | 2 +- lib/Trello/HttpClient/Listener/ErrorListener.php | 3 +-- lib/Trello/HttpClient/Message/ResponseMediator.php | 4 ++-- test/Trello/Tests/Unit/Api/AbstractApiTest.php | 2 +- test/Trello/Tests/Unit/Api/TestCase.php | 2 +- test/Trello/Tests/Unit/HttpClient/HttpClientTest.php | 12 ++++++------ .../Unit/HttpClient/Listener/AuthListenerTest.php | 12 ++++++------ .../Unit/HttpClient/Listener/ErrorListenerTest.php | 8 ++++---- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 37aa8b8..0e869e7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ composer.lock composer.phar build/* vendor/* +*.idea/ diff --git a/composer.json b/composer.json index ef9b235..6a139ea 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.3", - "guzzlehttp/guzzle": "~7" + "guzzlehttp/guzzle": "~5.3" }, "require-dev": { "phpunit/phpunit": "^4.8" diff --git a/lib/Trello/Api/AbstractApi.php b/lib/Trello/Api/AbstractApi.php index 31e9f64..1f2a6d7 100644 --- a/lib/Trello/Api/AbstractApi.php +++ b/lib/Trello/Api/AbstractApi.php @@ -110,7 +110,7 @@ public function getField($id, $field) * @param array $parameters GET parameters. * @param array $requestHeaders Request Headers. * - * @return \Guzzle\Http\EntityBodyInterface|mixed|string + * @return mixed */ protected function get($path, array $parameters = array(), $requestHeaders = array()) { @@ -126,7 +126,7 @@ protected function get($path, array $parameters = array(), $requestHeaders = arr * @param array $parameters HEAD parameters. * @param array $requestHeaders Request headers. * - * @return \Guzzle\Http\Message\Response + * @return \GuzzleHttp\Message\Response */ protected function head($path, array $parameters = array(), $requestHeaders = array()) { @@ -162,7 +162,7 @@ protected function post($path, array $parameters = array(), $requestHeaders = ar * @param mixed $body Request body. * @param array $requestHeaders Request headers. * - * @return \Guzzle\Http\EntityBodyInterface|mixed|string + * @return mixed */ protected function postRaw($path, $body, $requestHeaders = array()) { diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index fda62e8..b02ecd6 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -2,10 +2,10 @@ namespace Trello\HttpClient; -use Guzzle\Http\Client as GuzzleClient; -use Guzzle\Http\ClientInterface; -use Guzzle\Http\Message\Request; -use Guzzle\Http\Message\Response; +use GuzzleHttp\Client as GuzzleClient; +use GuzzleHttp\ClientInterface; +use GuzzleHttp\Message\Request; +use GuzzleHttp\Message\Response; use Trello\Exception\ErrorException; use Trello\Exception\RuntimeException; use Trello\HttpClient\Listener\AuthListener; diff --git a/lib/Trello/HttpClient/HttpClientInterface.php b/lib/Trello/HttpClient/HttpClientInterface.php index 08a4338..5a6e1ab 100644 --- a/lib/Trello/HttpClient/HttpClientInterface.php +++ b/lib/Trello/HttpClient/HttpClientInterface.php @@ -3,7 +3,7 @@ namespace Trello\HttpClient; use Trello\Exception\InvalidArgumentException; -use Guzzle\Http\Message\Response; +use GuzzleHttp\Message\Response; interface HttpClientInterface { diff --git a/lib/Trello/HttpClient/Listener/AuthListener.php b/lib/Trello/HttpClient/Listener/AuthListener.php index 53b9c58..cab17e9 100644 --- a/lib/Trello/HttpClient/Listener/AuthListener.php +++ b/lib/Trello/HttpClient/Listener/AuthListener.php @@ -2,7 +2,7 @@ namespace Trello\HttpClient\Listener; -use Guzzle\Common\Event; +use GuzzleHttp\Event\AbstractRequestEvent as Event; use Trello\Client; use Trello\Exception\RuntimeException; diff --git a/lib/Trello/HttpClient/Listener/ErrorListener.php b/lib/Trello/HttpClient/Listener/ErrorListener.php index e3e14c9..cb9e165 100644 --- a/lib/Trello/HttpClient/Listener/ErrorListener.php +++ b/lib/Trello/HttpClient/Listener/ErrorListener.php @@ -3,7 +3,7 @@ namespace Trello\HttpClient\Listener; use Trello\HttpClient\Message\ResponseMediator; -use Guzzle\Common\Event; +use GuzzleHttp\Event\AbstractRequestEvent as Event; use Trello\Exception\ErrorException; use Trello\Exception\RuntimeException; use Trello\Exception\PermissionDeniedException; @@ -20,7 +20,6 @@ class ErrorListener */ public function onRequestError(Event $event) { - /** @var $request \Guzzle\Http\Message\Request */ $request = $event['request']; $response = $request->getResponse(); diff --git a/lib/Trello/HttpClient/Message/ResponseMediator.php b/lib/Trello/HttpClient/Message/ResponseMediator.php index b14b129..1f45dc0 100644 --- a/lib/Trello/HttpClient/Message/ResponseMediator.php +++ b/lib/Trello/HttpClient/Message/ResponseMediator.php @@ -2,13 +2,13 @@ namespace Trello\HttpClient\Message; -use Guzzle\Http\Message\Response; +use GuzzleHttp\Message\Response; class ResponseMediator { public static function getContent(Response $response) { - $body = $response->getBody(true); + $body = $response->getBody(); $content = json_decode($body, true); diff --git a/test/Trello/Tests/Unit/Api/AbstractApiTest.php b/test/Trello/Tests/Unit/Api/AbstractApiTest.php index e934f97..5351bd2 100644 --- a/test/Trello/Tests/Unit/Api/AbstractApiTest.php +++ b/test/Trello/Tests/Unit/Api/AbstractApiTest.php @@ -139,7 +139,7 @@ protected function getHttpMock() protected function getHttpClientMock() { - $mock = $this->getMockBuilder('Guzzle\Http\Client') + $mock = $this->getMockBuilder('GuzzleHttp\Client') ->setMethods(array('send')) ->getMock(); $mock->expects($this->any()) diff --git a/test/Trello/Tests/Unit/Api/TestCase.php b/test/Trello/Tests/Unit/Api/TestCase.php index 8fb4ec6..a8d4f58 100644 --- a/test/Trello/Tests/Unit/Api/TestCase.php +++ b/test/Trello/Tests/Unit/Api/TestCase.php @@ -21,7 +21,7 @@ protected function getPath() protected function getApiMock() { - $httpClient = $this->getMockBuilder('Guzzle\Http\Client') + $httpClient = $this->getMockBuilder('GuzzleHttp\Client') ->setMethods(array('send')) ->getMock(); $httpClient->expects($this->any()) diff --git a/test/Trello/Tests/Unit/HttpClient/HttpClientTest.php b/test/Trello/Tests/Unit/HttpClient/HttpClientTest.php index a65090c..13c650c 100644 --- a/test/Trello/Tests/Unit/HttpClient/HttpClientTest.php +++ b/test/Trello/Tests/Unit/HttpClient/HttpClientTest.php @@ -4,8 +4,8 @@ use Trello\Client; use Trello\HttpClient\HttpClient; -use Guzzle\Http\Message\Response; -use Guzzle\Http\Client as GuzzleClient; +use GuzzleHttp\Message\Response; +use GuzzleHttp\Client as GuzzleClient; class HttpClientTest extends \PHPUnit_Framework_TestCase { @@ -180,7 +180,7 @@ public function shouldAllowToReturnRawContent() $parameters = array('a = b'); $headers = array('c' => 'd'); - $message = $this->getMockBuilder('Guzzle\Http\Message\Response') + $message = $this->getMockBuilder('GuzzleHttp\Message\Response') ->setConstructorArgs(array(200)) ->setMethods(array('getBody')) ->getMock(); @@ -197,17 +197,17 @@ public function shouldAllowToReturnRawContent() $response = $httpClient->get($path, $parameters, $headers); $this->assertEquals("Just raw context", $response->getBody()); - $this->assertInstanceOf('Guzzle\Http\Message\MessageInterface', $response); + $this->assertInstanceOf('GuzzleHttp\Message\MessageInterface', $response); } protected function getBrowserMock(array $methods = array()) { $mockMethods = array('send', 'createRequest') + $methods; - $mock = $this->getMockBuilder( 'Guzzle\Http\Client') + $mock = $this->getMockBuilder( 'GuzzleHttp\Client') ->setMethods($mockMethods) ->getMock(); - $requestMock = $this->getMockBuilder('Guzzle\Http\Message\Request') + $requestMock = $this->getMockBuilder('GuzzleHttp\Message\Request') ->setConstructorArgs(array('GET', 'some')) ->getMock(); diff --git a/test/Trello/Tests/Unit/HttpClient/Listener/AuthListenerTest.php b/test/Trello/Tests/Unit/HttpClient/Listener/AuthListenerTest.php index 6592118..2aeafac 100644 --- a/test/Trello/Tests/Unit/HttpClient/Listener/AuthListenerTest.php +++ b/test/Trello/Tests/Unit/HttpClient/Listener/AuthListenerTest.php @@ -1,7 +1,7 @@ getMockBuilder('Guzzle\Http\Message\RequestInterface') + $request = $this->getMockBuilder('GuzzleHttp\Message\RequestInterface') ->getMock(); $request->expects($this->never()) ->method('addHeader'); @@ -40,7 +40,7 @@ public function shouldDoNothingForHaveNullMethod() */ public function shouldDoNothingForPostSend() { - $request = $this->getMockBuilder('Guzzle\Http\Message\RequestInterface') + $request = $this->getMockBuilder('GuzzleHttp\Message\RequestInterface') ->getMock(); $request->expects($this->never()) ->method('addHeader'); @@ -56,7 +56,7 @@ public function shouldDoNothingForPostSend() public function shouldSetAuthBasicHeaderForAuthPassMethod() { $expected = 'Basic '.base64_encode('login2:pass42323'); - $request = $this->getMockBuilder('Guzzle\Http\Message\RequestInterface') + $request = $this->getMockBuilder('GuzzleHttp\Message\RequestInterface') ->getMock(); $request->expects($this->once()) ->method('setHeader') @@ -76,7 +76,7 @@ public function shouldSetAuthBasicHeaderForAuthPassMethod() public function shouldSetAuthTokenHeaderForAuthPassMethod() { $expected = 'token test'; - $request = $this->getMockBuilder('Guzzle\Http\Message\RequestInterface') + $request = $this->getMockBuilder('GuzzleHttp\Message\RequestInterface') ->getMock(); $request->expects($this->once()) ->method('setHeader') @@ -114,7 +114,7 @@ public function shouldSetClientDetailsInUrlForAuthUrlMethod() private function getEventMock($request = null) { - $mock = $this->getMockBuilder('Guzzle\Common\Event')->getMock(); + $mock = $this->getMockBuilder('GuzzleCommon\Event')->getMock(); if ($request) { $mock->expects($this->any()) ->method('offsetGet') diff --git a/test/Trello/Tests/Unit/HttpClient/Listener/ErrorListenerTest.php b/test/Trello/Tests/Unit/HttpClient/Listener/ErrorListenerTest.php index 71472b4..bb5210c 100644 --- a/test/Trello/Tests/Unit/HttpClient/Listener/ErrorListenerTest.php +++ b/test/Trello/Tests/Unit/HttpClient/Listener/ErrorListenerTest.php @@ -13,7 +13,7 @@ class ErrorListenerTest extends \PHPUnit_Framework_TestCase */ public function shouldPassIfResponseNotHaveErrorStatus() { - $response = $this->getMockBuilder('Guzzle\Http\Message\Response') + $response = $this->getMockBuilder('GuzzleHttp\Message\Response') ->disableOriginalConstructor() ->getMock(); $response->expects($this->once()) @@ -126,9 +126,9 @@ public function getErrorCodesProvider() private function getEventMock($response) { - $mock = $this->getMockBuilder('Guzzle\Common\Event') + $mock = $this->getMockBuilder('GuzzleHttp\Event\AbstractRequestEvent') ->getMock(); - $request = $this->getMockBuilder('Guzzle\Http\Message\Request') + $request = $this->getMockBuilder('GuzzleHttp\Message\Request') ->disableOriginalConstructor() ->getMock(); $request->expects($this->any()) @@ -145,7 +145,7 @@ private function createResponseMock( $httpStatusCode, $responseBody = '' ) { - $mock = $this->getMockBuilder('Guzzle\Http\Message\Response') + $mock = $this->getMockBuilder('GuzzleHttp\Message\Response') ->disableOriginalConstructor() ->getMock(); $mock->expects($this->once()) From a8d1b4a69fa05265b00c45f441aba5bab8d79e50 Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 02:43:33 +0100 Subject: [PATCH 08/18] Solving some problems --- lib/Trello/Api/AbstractApi.php | 60 +++++----- lib/Trello/Api/Action.php | 90 +++++++-------- lib/Trello/Api/Board.php | 62 +++++----- lib/Trello/Api/Board/Actions.php | 4 +- lib/Trello/Api/Board/Cardlists.php | 8 +- lib/Trello/Api/Board/Cards.php | 12 +- lib/Trello/Api/Board/Checklists.php | 8 +- lib/Trello/Api/Board/Labels.php | 12 +- lib/Trello/Api/Board/Members.php | 42 +++---- lib/Trello/Api/Card.php | 74 ++++++------ lib/Trello/Api/Card/Actions.php | 12 +- lib/Trello/Api/Card/Attachments.php | 20 ++-- lib/Trello/Api/Card/Checklists.php | 40 +++---- lib/Trello/Api/Card/Labels.php | 8 +- lib/Trello/Api/Card/Members.php | 24 ++-- lib/Trello/Api/Card/Stickers.php | 27 ++--- lib/Trello/Api/Cardlist.php | 48 ++++---- lib/Trello/Api/Cardlist/Actions.php | 4 +- lib/Trello/Api/Cardlist/Cards.php | 20 ++-- lib/Trello/Api/Checklist.php | 38 +++--- lib/Trello/Api/Checklist/Cards.php | 10 +- lib/Trello/Api/Checklist/Items.php | 20 ++-- lib/Trello/Api/Member.php | 42 +++---- lib/Trello/Api/Member/Actions.php | 4 +- lib/Trello/Api/Member/Boards.php | 27 +++-- lib/Trello/Api/Member/Cards.php | 10 +- lib/Trello/Api/Member/Notifications.php | 10 +- lib/Trello/Api/Member/Organizations.php | 19 ++- lib/Trello/Api/Notification.php | 98 ++++++++-------- lib/Trello/Api/Organization.php | 6 +- lib/Trello/Api/Token.php | 20 ++-- lib/Trello/Api/Token/Webhooks.php | 20 ++-- lib/Trello/Api/Webhook.php | 32 +++--- lib/Trello/Client.php | 29 +++-- lib/Trello/Events.php | 108 +++++++++--------- lib/Trello/HttpClient/HttpClient.php | 21 ++-- lib/Trello/HttpClient/HttpClientInterface.php | 55 ++++----- .../HttpClient/Listener/AuthListener.php | 4 +- .../HttpClient/Listener/ErrorListener.php | 32 +++--- .../HttpClient/Message/ResponseMediator.php | 2 +- lib/Trello/Model/AbstractObject.php | 6 +- lib/Trello/Model/Board.php | 12 +- lib/Trello/Model/Card.php | 18 +-- lib/Trello/Model/Cardlist.php | 2 +- lib/Trello/Model/Checklist.php | 4 +- lib/Trello/Model/ChecklistInterface.php | 4 +- lib/Trello/Service.php | 14 +-- 47 files changed, 622 insertions(+), 620 deletions(-) diff --git a/lib/Trello/Api/AbstractApi.php b/lib/Trello/Api/AbstractApi.php index 1f2a6d7..fd680af 100644 --- a/lib/Trello/Api/AbstractApi.php +++ b/lib/Trello/Api/AbstractApi.php @@ -48,8 +48,8 @@ public function __construct(Client $client) * Catches any undefined "get{$field}" calls, and passes them * to the getField() if the $field is in the $this->fields property * - * @param string $method called method - * @param array $arguments array of arguments passed to called method + * @param string $method called method + * @param array $arguments array of arguments passed to called method * * @return array * @@ -85,7 +85,7 @@ public function getFields() /** * Get a field value by field name * - * @param string $id the board's id + * @param string $id the board's id * @param string $field the field * * @return mixed field value @@ -98,7 +98,7 @@ public function getField($id, $field) throw new InvalidArgumentException(sprintf('There is no field named %s.', $field)); } - $response = $this->get($this->path.'/'.rawurlencode($id).'/'.rawurlencode($field)); + $response = $this->get($this->path . '/' . rawurlencode($id) . '/' . rawurlencode($field)); return isset($response['_value']) ? $response['_value'] : $response; } @@ -106,9 +106,9 @@ public function getField($id, $field) /** * Send a GET request with query parameters. * - * @param string $path Request path. - * @param array $parameters GET parameters. - * @param array $requestHeaders Request Headers. + * @param string $path Request path. + * @param array $parameters GET parameters. + * @param array $requestHeaders Request Headers. * * @return mixed */ @@ -122,9 +122,9 @@ protected function get($path, array $parameters = array(), $requestHeaders = arr /** * Send a HEAD request with query parameters * - * @param string $path Request path. - * @param array $parameters HEAD parameters. - * @param array $requestHeaders Request headers. + * @param string $path Request path. + * @param array $parameters HEAD parameters. + * @param array $requestHeaders Request headers. * * @return \GuzzleHttp\Message\Response */ @@ -140,9 +140,9 @@ protected function head($path, array $parameters = array(), $requestHeaders = ar /** * Send a POST request with JSON-encoded parameters. * - * @param string $path Request path. - * @param array $parameters POST parameters to be JSON encoded. - * @param array $requestHeaders Request headers. + * @param string $path Request path. + * @param array $parameters POST parameters to be JSON encoded. + * @param array $requestHeaders Request headers. * * @return mixed */ @@ -158,9 +158,9 @@ protected function post($path, array $parameters = array(), $requestHeaders = ar /** * Send a POST request with raw data. * - * @param string $path Request path. - * @param mixed $body Request body. - * @param array $requestHeaders Request headers. + * @param string $path Request path. + * @param mixed $body Request body. + * @param array $requestHeaders Request headers. * * @return mixed */ @@ -178,9 +178,9 @@ protected function postRaw($path, $body, $requestHeaders = array()) /** * Send a PATCH request with JSON-encoded parameters. * - * @param string $path Request path. - * @param array $parameters POST parameters to be JSON encoded. - * @param array $requestHeaders Request headers. + * @param string $path Request path. + * @param array $parameters POST parameters to be JSON encoded. + * @param array $requestHeaders Request headers. * * @return mixed */ @@ -198,9 +198,9 @@ protected function patch($path, array $parameters = array(), $requestHeaders = a /** * Send a PUT request with JSON-encoded parameters. * - * @param string $path Request path. - * @param array $parameters POST parameters to be JSON encoded. - * @param array $requestHeaders Request headers. + * @param string $path Request path. + * @param array $parameters POST parameters to be JSON encoded. + * @param array $requestHeaders Request headers. * * @return mixed */ @@ -224,9 +224,9 @@ protected function put($path, array $parameters = array(), $requestHeaders = arr /** * Send a DELETE request with JSON-encoded parameters. * - * @param string $path Request path. - * @param array $parameters POST parameters to be JSON encoded. - * @param array $requestHeaders Request headers. + * @param string $path Request path. + * @param array $parameters POST parameters to be JSON encoded. + * @param array $requestHeaders Request headers. * * @return mixed */ @@ -258,7 +258,7 @@ protected function createParametersBody(array $parameters) if (is_bool($subParameter)) { $subParameter = $subParameter ? 'true' : 'false'; } - $parameters[$name.'/'.$subName] = $subParameter; + $parameters[$name . '/' . $subName] = $subParameter; } unset($parameters[$name]); } elseif ($parameter instanceof DateTime) { @@ -282,7 +282,7 @@ protected function getPath($id = null) * Validate parameters array * * @param string[] $required required properties (array keys) - * @param array $params array to check for existence of the required keys + * @param array $params array to check for existence of the required keys * * @throws MissingArgumentException if a required parameter is missing */ @@ -299,8 +299,8 @@ protected function validateRequiredParameters(array $required, array $params) * Validate allowed parameters array * Checks whether the passed parameters are allowed * - * @param string[] $allowed allowed properties - * @param array|string $params array to check + * @param string[] $allowed allowed properties + * @param array|string $params array to check * @param string $paramName * * @return array array of validated parameters @@ -332,7 +332,7 @@ protected function validateAllowedParameters(array $allowed, $params, $paramName * the keys in a given array * * @param string[] $atLeastOneOf allowed properties - * @param array $params array to check + * @param array $params array to check * * @return boolean * diff --git a/lib/Trello/Api/Action.php b/lib/Trello/Api/Action.php index 66852f2..54124fa 100644 --- a/lib/Trello/Api/Action.php +++ b/lib/Trello/Api/Action.php @@ -34,28 +34,28 @@ class Action extends AbstractApi * Find an action by id * @link https://trello.com/docs/api/action/#get-1-actions-idaction * - * @param string $id the action's id - * @param array $params optional attributes + * @param string $id the action's id + * @param array $params optional attributes * * @return array */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } /** * Update a checklist * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist * - * @param string $id the list's id - * @param array $params list attributes to update + * @param string $id the list's id + * @param array $params list attributes to update * * @return array list info */ public function update($id, array $params = array()) { - return $this->put($this->getPath().'/'.rawurlencode($id), $params); + return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } /** @@ -68,29 +68,29 @@ public function update($id, array $params = array()) */ public function remove($id) { - return $this->delete($this->getPath().'/'.rawurlencode($id)); + return $this->delete($this->getPath() . '/' . rawurlencode($id)); } /** * Get an action's board * @link https://trello.com/docs/api/action/#get-1-actions-idaction-board * - * @param string $id the action's id - * @param array $params optional parameters + * @param string $id the action's id + * @param array $params optional parameters * * @return array */ public function getBoard($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } /** * Get the field of a board of a given card * @link https://trello.com/docs/api/action/#get-1-actions-idaction-board * - * @param string $id the action's id - * @param array $field the name of the field + * @param string $id the action's id + * @param array $field the name of the field * * @return array * @@ -100,29 +100,29 @@ public function getBoardField($id, $field) { $this->validateAllowedParameters(Board::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board/' . rawurlencode($field)); } /** * Get an action's list * @link https://trello.com/docs/api/action/#get-1-actions-idaction-list * - * @param string $id the action's id - * @param array $params optional parameters + * @param string $id the action's id + * @param array $params optional parameters * * @return array */ public function getList($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/list', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/list', $params); } /** * Get the field of a list of a given action * @link https://trello.com/docs/api/action/index.html#get-1-actions-idaction-list-field * - * @param string $id the action's id - * @param array $field the name of the field + * @param string $id the action's id + * @param array $field the name of the field * * @return array * @@ -132,29 +132,29 @@ public function getListField($id, $field) { $this->validateAllowedParameters(Cardlist::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/list/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/list/' . rawurlencode($field)); } /** * Get an action's card * @link https://trello.com/docs/api/action/#get-1-actions-idaction-card * - * @param string $id the action's id - * @param array $params optional parameters + * @param string $id the action's id + * @param array $params optional parameters * * @return array */ public function getCard($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/card', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/card', $params); } /** * Get the field of a card of a given action * @link https://trello.com/docs/api/action/index.html#get-1-actions-idaction-card-field * - * @param string $id the action's id - * @param array $field the name of the field + * @param string $id the action's id + * @param array $field the name of the field * * @return array * @@ -164,29 +164,29 @@ public function getCardField($id, $field) { $this->validateAllowedParameters(Card::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/card/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/card/' . rawurlencode($field)); } /** * Get an action's member * @link https://trello.com/docs/api/action/#get-1-actions-idaction-member * - * @param string $id the action's id - * @param array $params optional parameters + * @param string $id the action's id + * @param array $params optional parameters * * @return array */ public function getMember($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/member', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/member', $params); } /** * Get the field of a member of a given action * @link https://trello.com/docs/api/action/#get-1-actions-idaction-member-field * - * @param string $id the action's id - * @param array $field the name of the field + * @param string $id the action's id + * @param array $field the name of the field * * @return array * @@ -196,29 +196,29 @@ public function getMemberField($id, $field) { $this->validateAllowedParameters(Member::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/member/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/member/' . rawurlencode($field)); } /** * Get an action's creator * @link https://trello.com/docs/api/action/#get-1-actions-idaction-creator * - * @param string $id the action's id - * @param array $params optional parameters + * @param string $id the action's id + * @param array $params optional parameters * * @return array */ public function getCreator($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/memberCreator', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/memberCreator', $params); } /** * Get the field of a creator of a given action * @link https://trello.com/docs/api/action/#get-1-actions-idaction-creator-field * - * @param string $id the action's id - * @param array $field the name of the field + * @param string $id the action's id + * @param array $field the name of the field * * @return array * @@ -228,29 +228,29 @@ public function getCreatorField($id, $field) { $this->validateAllowedParameters(Member::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/memberCreator/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/memberCreator/' . rawurlencode($field)); } /** * Get an action's organization * @link https://trello.com/docs/api/action/#get-1-actions-idaction-organization * - * @param string $id the action's id - * @param array $params optional parameters + * @param string $id the action's id + * @param array $params optional parameters * * @return array */ public function getOrganization($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/organization', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/organization', $params); } /** * Get the field of an organization of a given action * @link https://trello.com/docs/api/action/#get-1-actions-idaction-organization-field * - * @param string $id the action's id - * @param array $field the name of the field + * @param string $id the action's id + * @param array $field the name of the field * * @return array * @@ -260,20 +260,20 @@ public function getOrganizationField($id, $field) { $this->validateAllowedParameters(Organization::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/organization/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/organization/' . rawurlencode($field)); } /** * Set a given action's text * @link https://trello.com/docs/api/action/#put-1-actions-idaction-text * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $text the text * * @return array card info */ public function setText($id, $text) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/text', array('value' => $text)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/text', array('value' => $text)); } } diff --git a/lib/Trello/Api/Board.php b/lib/Trello/Api/Board.php index a033270..e96ed93 100644 --- a/lib/Trello/Api/Board.php +++ b/lib/Trello/Api/Board.php @@ -2,8 +2,6 @@ namespace Trello\Api; -use Trello\Exception\InvalidArgumentException; - /** * Trello Board API * @package PHP Trello API @@ -57,14 +55,14 @@ class Board extends AbstractApi * Find a board by id * @link https://trello.com/docs/api/board/#get-1-boards-board-id * - * @param string $id the board's id - * @param array $params optional attributes + * @param string $id the board's id + * @param array $params optional attributes * * @return array board info */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } /** @@ -86,105 +84,105 @@ public function create(array $params = array()) * Update a board * @link https://trello.com/docs/api/board/#put-1-boards * - * @param string $id the board's id - * @param array $params board attributes to update + * @param string $id the board's id + * @param array $params board attributes to update * * @return array */ public function update($id, array $params = array()) { - return $this->put($this->getPath().'/'.rawurlencode($id), $params); + return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } /** * Set a given board's name * @link https://trello.com/docs/api/board/#put-1-boards-board-id-name * - * @param string $id the board's id + * @param string $id the board's id * @param string $name the name * * @return array */ public function setName($id, $name) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/name', array('value' => $name)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', array('value' => $name)); } /** * Set a given board's description * @link https://trello.com/docs/api/board/#put-1-boards-board-id-desc * - * @param string $id the board's id + * @param string $id the board's id * @param string $description the description * * @return array */ public function setDescription($id, $description) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/desc', array('value' => $description)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/desc', array('value' => $description)); } /** * Set a given board's state * @link https://trello.com/docs/api/board/#put-1-boards-board-id-closed * - * @param string $id the board's id - * @param bool $closed whether the board should be closed or not + * @param string $id the board's id + * @param bool $closed whether the board should be closed or not * * @return array */ public function setClosed($id, $closed = true) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/closed', array('value' => $closed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/closed', array('value' => $closed)); } /** * Set a given board's subscription state * @link https://trello.com/docs/api/board/#put-1-boards-board-id-subscribed * - * @param string $id the board's id - * @param bool $subscribed whether to subscribe to the board or not + * @param string $id the board's id + * @param bool $subscribed whether to subscribe to the board or not * * @return array */ public function setSubscribed($id, $subscribed = true) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/subscribed', array('value' => $subscribed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/subscribed', array('value' => $subscribed)); } /** * Set a given board's organization * @link https://trello.com/docs/api/board/#put-1-boards-board-id-organization * - * @param string $id the board's id + * @param string $id the board's id * @param string $organizationId the organization's id * * @return array */ public function setOrganization($id, $organizationId) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/idOrganization/'.rawurlencode($organizationId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idOrganization/' . rawurlencode($organizationId)); } /** * Get a given board's organization * @link https://trello.com/docs/api/board/#get-1-boards-board-id-organization * - * @param string $id the board's id - * @param array $params optional parameters + * @param string $id the board's id + * @param array $params optional parameters * * @return array */ public function getOrganization($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/organization', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/organization', $params); } /** * Get the field of the organization of a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-organization-field * - * @param string $id the board's id + * @param string $id the board's id * @param string $field the organization's field name * * @return array @@ -193,35 +191,35 @@ public function getOrganizationField($id, $field) { $this->validateAllowedParameters(Organization::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/organization/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/organization/' . rawurlencode($field)); } /** * Get a given board's stars * @link https://trello.com/docs/api/board/#get-1-boards-board-id-boardstars * - * @param string $id the board's id - * @param array $params optional parameters + * @param string $id the board's id + * @param array $params optional parameters * * @return array */ public function getStars($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/boardStars', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/boardStars', $params); } /** * Get a given board's deltas * @link https://trello.com/docs/api/board/index.html#get-1-boards-board-id-deltas * - * @param string $id the board's id - * @param array $params optional parameters + * @param string $id the board's id + * @param array $params optional parameters * * @return array */ public function getDeltas($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/deltas', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/deltas', $params); } /** @@ -234,7 +232,7 @@ public function getDeltas($id, array $params = array()) */ public function setViewed($id) { - return $this->post($this->getPath().'/'.rawurlencode($id).'/markAsViewed'); + return $this->post($this->getPath() . '/' . rawurlencode($id) . '/markAsViewed'); } /** diff --git a/lib/Trello/Api/Board/Actions.php b/lib/Trello/Api/Board/Actions.php index d457ea8..d7bb401 100644 --- a/lib/Trello/Api/Board/Actions.php +++ b/lib/Trello/Api/Board/Actions.php @@ -22,8 +22,8 @@ class Actions extends AbstractApi * Get actions related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-actions * - * @param string $id the board's id - * @param array $params optional parameters + * @param string $id the board's id + * @param array $params optional parameters * * @return array */ diff --git a/lib/Trello/Api/Board/Cardlists.php b/lib/Trello/Api/Board/Cardlists.php index d05eb06..0f43c9c 100644 --- a/lib/Trello/Api/Board/Cardlists.php +++ b/lib/Trello/Api/Board/Cardlists.php @@ -22,8 +22,8 @@ class Cardlists extends AbstractApi * Get a given board's lists * @link https://trello.com/docs/api/board/#get-1-boards-board-id-lists * - * @param string $id the board's id - * @param array $params optional parameters + * @param string $id the board's id + * @param array $params optional parameters * * @return array */ @@ -36,7 +36,7 @@ public function all($id, array $params = array()) * Filter card lists related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-lists-filter * - * @param string $id the board's id + * @param string $id the board's id * @param string|array $filter array of / one of 'all', 'none', 'open', 'closed' * * @return array @@ -46,7 +46,7 @@ public function filter($id, $filter = 'all') $allowed = array('all', 'none', 'open', 'closed'); $filter = $this->validateAllowedParameters($allowed, $filter, 'filter'); - return $this->get($this->getPath($id).'/'.implode(',', $filter)); + return $this->get($this->getPath($id) . '/' . implode(',', $filter)); } /** diff --git a/lib/Trello/Api/Board/Cards.php b/lib/Trello/Api/Board/Cards.php index d942b38..60340ec 100644 --- a/lib/Trello/Api/Board/Cards.php +++ b/lib/Trello/Api/Board/Cards.php @@ -22,8 +22,8 @@ class Cards extends AbstractApi * Get cards related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-cards * - * @param string $id the board's - * @param array $params optional parameters + * @param string $id the board's + * @param array $params optional parameters * * @return array */ @@ -36,7 +36,7 @@ public function all($id, array $params = array()) * Filter cards related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-cards-filter * - * @param string $id the board's id + * @param string $id the board's id * @param string|array $filter array of / one of 'all', 'visible', 'none', 'open', 'closed' * * @return array @@ -46,20 +46,20 @@ public function filter($id, $filter = 'all') $allowed = array('all', 'visible', 'none', 'open', 'closed'); $filter = $this->validateAllowedParameters($allowed, $filter, 'filter'); - return $this->get($this->getPath($id).'/'.implode(',', $filter)); + return $this->get($this->getPath($id) . '/' . implode(',', $filter)); } /** * Get a card related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-cards-idcard * - * @param string $id the board's id + * @param string $id the board's id * @param string $cardId the card's id * * @return array */ public function show($id, $cardId) { - return $this->get($this->getPath($id).'/'.rawurlencode($cardId)); + return $this->get($this->getPath($id) . '/' . rawurlencode($cardId)); } } diff --git a/lib/Trello/Api/Board/Checklists.php b/lib/Trello/Api/Board/Checklists.php index 910c45d..03403e7 100644 --- a/lib/Trello/Api/Board/Checklists.php +++ b/lib/Trello/Api/Board/Checklists.php @@ -22,8 +22,8 @@ class Checklists extends AbstractApi * Get cards related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-cards * - * @param string $id the board's - * @param array $params optional parameters + * @param string $id the board's + * @param array $params optional parameters * * @return array */ @@ -36,8 +36,8 @@ public function all($id, array $params = array()) * Add an checklist to a given board * @link https://trello.com/docs/api/board/#post-1-boards-board-id-checklists * - * @param string $id the board's id - * @param array $params optional parameters + * @param string $id the board's id + * @param array $params optional parameters * * @return array */ diff --git a/lib/Trello/Api/Board/Labels.php b/lib/Trello/Api/Board/Labels.php index f924f76..320ce88 100644 --- a/lib/Trello/Api/Board/Labels.php +++ b/lib/Trello/Api/Board/Labels.php @@ -23,8 +23,8 @@ class Labels extends AbstractApi * Get labels related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-labels * - * @param string $id the board's - * @param array $params optional parameters + * @param string $id the board's + * @param array $params optional parameters * * @return array */ @@ -37,7 +37,7 @@ public function all($id, array $params = array()) * Get a label related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-labels-idlabel * - * @param string $id the board's id + * @param string $id the board's id * @param string $color the label's color * * @return array @@ -53,7 +53,7 @@ public function show($id, $color) )); } - return $this->get($this->getPath($id).'/'.rawurlencode($color)); + return $this->get($this->getPath($id) . '/' . rawurlencode($color)); } /** @@ -65,7 +65,7 @@ public function show($id, $color) * @link https://trello.com/docs/api/board/#put-1-boards-board-id-labelnames-red * @link https://trello.com/docs/api/board/#put-1-boards-board-id-labelnames-yellow * - * @param string $id the board's id + * @param string $id the board's id * @param string $color the label color to set the name of * @param string $name * @@ -82,6 +82,6 @@ public function setName($id, $color, $name) )); } - return $this->put('boards/'.rawurlencode($id).'/labelNames/'.rawurlencode($color), array('value' => $name)); + return $this->put('boards/' . rawurlencode($id) . '/labelNames/' . rawurlencode($color), array('value' => $name)); } } diff --git a/lib/Trello/Api/Board/Members.php b/lib/Trello/Api/Board/Members.php index f1cc6c2..d98d354 100644 --- a/lib/Trello/Api/Board/Members.php +++ b/lib/Trello/Api/Board/Members.php @@ -24,8 +24,8 @@ class Members extends AbstractApi * Get a given board's members * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members * - * @param string $id the board's id - * @param array $params optional parameters + * @param string $id the board's id + * @param array $params optional parameters * * @return array */ @@ -38,21 +38,21 @@ public function all($id, array $params = array()) * Remove a given member from a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members * - * @param string $id the board's id + * @param string $id the board's id * @param string $memberId the member's id * * @return array */ public function remove($id, $memberId) { - return $this->delete($this->getPath($id).'/'.$memberId); + return $this->delete($this->getPath($id) . '/' . $memberId); } /** * Filter members related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members-filter * - * @param string $id the board's id + * @param string $id the board's id * @param string|array $filter array of / one of 'none', 'normal', 'admins', 'owners', 'all' * * @return array @@ -62,32 +62,32 @@ public function filter($id, $filter = 'all') $allowed = array('none', 'normal', 'admins', 'owners', 'all'); $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); - return $this->get($this->getPath($id).'/'.implode(',', $filters)); + return $this->get($this->getPath($id) . '/' . implode(',', $filters)); } /** * Get a member's cards related to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members-filter * - * @param string $id the board's id + * @param string $id the board's id * @param string $memberId the member's id - * @param array $params optional parameters + * @param array $params optional parameters * * @return array */ public function cards($id, $memberId, array $params = array()) { - return $this->get($this->getPath($id).'/'.rawurlencode($memberId).'/cards', $params); + return $this->get($this->getPath($id) . '/' . rawurlencode($memberId) . '/cards', $params); } /** * Add member to a given board * @link https://trello.com/docs/api/board/#put-1-boards-board-id-members * - * @param string $id the board's id - * @param string $email the member's email address + * @param string $id the board's id + * @param string $email the member's email address * @param string $fullName the member's full name - * @param string $role one of 'normal', 'observer' or 'admin' + * @param string $role one of 'normal', 'observer' or 'admin' * * @return array */ @@ -103,9 +103,9 @@ public function invite($id, $email, $fullName, $role = 'normal') } $params = array( - 'email' => $email, + 'email' => $email, 'fullName' => $fullName, - 'type' => $role, + 'type' => $role, ); return $this->put($this->getPath($id), $params); @@ -115,21 +115,21 @@ public function invite($id, $email, $fullName, $role = 'normal') * Get members invited to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-membersinvited * - * @param string $id the board's id - * @param array $params optional parameters + * @param string $id the board's id + * @param array $params optional parameters * * @return array */ public function getInvitedMembers($id, array $params = array()) { - return $this->get($this->getPath($id).'Invited', $params); + return $this->get($this->getPath($id) . 'Invited', $params); } /** * Get a field related to a member invited to a given board * @link https://trello.com/docs/api/board/#get-1-boards-board-id-membersinvited-field * - * @param string $id the board's id + * @param string $id the board's id * @param string $field the member's field name * * @return array @@ -138,14 +138,14 @@ public function getInvitedMembersField($id, $field) { $this->validateAllowedParameters(Member::$fields, $field, 'field'); - return $this->get($this->getPath($id).'Invited/'.rawurlencode($field)); + return $this->get($this->getPath($id) . 'Invited/' . rawurlencode($field)); } /** * Set the role of a user or an organization on a given board * @link https://trello.com/docs/api/board/index.html#put-1-boards-board-id-members-idmember * - * @param string $id the board's id + * @param string $id the board's id * @param string $memberOrOrganization the member's id, user name or an organization name * * @return array @@ -166,6 +166,6 @@ public function setRole($id, $memberOrOrganization, $role) 'type' => $role, ); - return $this->post($this->getPath($id).'/'.rawurlencode($memberOrOrganization), $params); + return $this->post($this->getPath($id) . '/' . rawurlencode($memberOrOrganization), $params); } } diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 5c45e16..809e5ad 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -60,21 +60,21 @@ class Card extends AbstractApi * Find a card by id * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink * - * @param string $id the card's id or short link - * @param array $params optional attributes + * @param string $id the card's id or short link + * @param array $params optional attributes * * @return array card info */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } /** * Create a card * @link https://trello.com/docs/api/card/#post-1-cards * - * @param array $params optional attributes + * @param array $params optional attributes * * @return array card info */ @@ -96,50 +96,50 @@ public function create(array $params = array()) * Update a card * @link https://trello.com/docs/api/card/#put-1-cards * - * @param string $id the card's id or short link - * @param array $params card attributes to update + * @param string $id the card's id or short link + * @param array $params card attributes to update * * @return array card info */ public function update($id, array $params = array()) { - return $this->put($this->getPath().'/'.rawurlencode($id), $params); + return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } /** * Set a given card's board * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idboard * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $boardId the board's id * * @return array board info */ public function setBoard($id, $boardId) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/idBoard', array('value' => $boardId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idBoard', array('value' => $boardId)); } /** * Get a given card's board * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idboard * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array board info */ public function getBoard($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } /** * Get the field of a board of a given card * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-board-field * - * @param string $id the card's id - * @param array $field the name of the field + * @param string $id the card's id + * @param array $field the name of the field * * @return array board info * @@ -149,43 +149,43 @@ public function getBoardField($id, $field) { $this->validateAllowedParameters(Board::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board/' . rawurlencode($field)); } /** * Set a given card's list * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idlist * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $listId the list's id * * @return array list info */ public function setList($id, $listId) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/idList', array('value' => $listId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idList', array('value' => $listId)); } /** * Get a given card's list * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-list * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array list info */ public function getList($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/list', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/list', $params); } /** * Get the field of a list of a given card * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-list-field * - * @param string $id the card's id - * @param array $field the name of the field + * @param string $id the card's id + * @param array $field the name of the field * * @return array board info * @@ -195,70 +195,70 @@ public function getListField($id, $field) { $this->validateAllowedParameters(Cardlist::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/list/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/list/' . rawurlencode($field)); } /** * Set a given card's name * @link https://trello.com/docs/api/card/#put-1-cards-card-id-name * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $name the name * * @return array card info */ public function setName($id, $name) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/name', array('value' => $name)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', array('value' => $name)); } /** * Set a given card's description * @link https://trello.com/docs/api/card/#put-1-cards-card-id-desc * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $description the description * * @return array card info */ public function setDescription($id, $description) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/desc', array('value' => $description)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/desc', array('value' => $description)); } /** * Set a given card's state * @link https://trello.com/docs/api/card/#put-1-cards-card-id-closed * - * @param string $id the card's id or short link - * @param bool $closed whether the card should be closed or not + * @param string $id the card's id or short link + * @param bool $closed whether the card should be closed or not * * @return array card info */ public function setClosed($id, $closed = true) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/closed', array('value' => $closed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/closed', array('value' => $closed)); } /** * Set a given card's due date * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-due * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param \DateTime $date the due date * * @return array card info */ public function setDueDate($id, \DateTime $date = null) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/due', array('value' => $date)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/due', array('value' => $date)); } /** * Set a given card's position * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-pos * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string|integer $position the position, eg. 'top', 'bottom' * or a positive number * @@ -266,21 +266,21 @@ public function setDueDate($id, \DateTime $date = null) */ public function setPosition($id, $position) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/pos', array('value' => $position)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/pos', array('value' => $position)); } /** * Set a given card's subscription state * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-subscribed * - * @param string $id the list's id - * @param bool $subscribed subscription state + * @param string $id the list's id + * @param bool $subscribed subscription state * * @return array list info */ public function setSubscribed($id, $subscribed) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/subscribed', array('value' => $subscribed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/subscribed', array('value' => $subscribed)); } /** diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index a87032b..2081fdd 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -18,8 +18,8 @@ class Actions extends AbstractApi * Get actions related to a given card * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-actions * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array */ @@ -32,27 +32,27 @@ public function all($id, array $params = array()) * Add comment to a given card * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-actions-comments * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $text comment message * * @return array */ public function addComment($id, $text) { - return $this->post($this->getPath($id).'/comments', array('text' => $text)); + return $this->post($this->getPath($id) . '/comments', array('text' => $text)); } /** * Remove comment to a given card * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-actions-idaction-comments * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $commentId the comment's id * * @return array */ public function removeComment($id, $commentId) { - return $this->delete($this->getPath($id).'/comments/'.rawurlencode($commentId)); + return $this->delete($this->getPath($id) . '/comments/' . rawurlencode($commentId)); } } diff --git a/lib/Trello/Api/Card/Attachments.php b/lib/Trello/Api/Card/Attachments.php index ab5e46e..33d9fd9 100644 --- a/lib/Trello/Api/Card/Attachments.php +++ b/lib/Trello/Api/Card/Attachments.php @@ -18,8 +18,8 @@ class Attachments extends AbstractApi * Get attachments related to a given card * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-attachments * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array */ @@ -32,8 +32,8 @@ public function all($id, array $params = array()) * Add an attachment to a given card * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-attachments * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array */ @@ -49,41 +49,41 @@ public function create($id, array $params) * Get a given attachment on a given card * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-attachments-idattachment * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $attachmentId the attachment's id * * @return array */ public function show($id, $attachmentId) { - return $this->get($this->getPath($id).'/'.rawurlencode($attachmentId)); + return $this->get($this->getPath($id) . '/' . rawurlencode($attachmentId)); } /** * Remove a given attachment from a given card * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-attachments-idattachment * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $attachmentId the attachment's id * * @return array */ public function remove($id, $attachmentId) { - return $this->delete($this->getPath($id).'/'.rawurlencode($attachmentId)); + return $this->delete($this->getPath($id) . '/' . rawurlencode($attachmentId)); } /** * Set a given attachment as cover of a given card * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idattachmentcover * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $attachmentId the attachment's id * * @return array */ public function setAsCover($id, $attachmentId) { - return $this->put('cards/'.rawurlencode($id).'/idAttachmentCover', array('value' => $attachmentId)); + return $this->put('cards/' . rawurlencode($id) . '/idAttachmentCover', array('value' => $attachmentId)); } } diff --git a/lib/Trello/Api/Card/Checklists.php b/lib/Trello/Api/Card/Checklists.php index faeade5..ffb7c24 100644 --- a/lib/Trello/Api/Card/Checklists.php +++ b/lib/Trello/Api/Card/Checklists.php @@ -19,22 +19,22 @@ class Checklists extends AbstractApi * Get checklists related to a given card * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-checklists * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array */ public function all($id, array $params = array()) { - return $this->get('cards/'.rawurlencode($id).'/checklists', $params); + return $this->get('cards/' . rawurlencode($id) . '/checklists', $params); } /** * Add a checklist to a given card * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklists * - * @param string $id the card's id or short link - * @param array $params All parameters are optional, but at least one has to be provided: + * @param string $id the card's id or short link + * @param array $params All parameters are optional, but at least one has to be provided: * - value : id of the checklist to add, or null to create a new one. * - name : the checklist's name * - idChecklistSource : id of the source checklist to copy @@ -56,44 +56,44 @@ public function create($id, array $params) * Remove a given checklist from a given card * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-checklists-idchecklist * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $checklistId the checklist's id * * @return array */ public function remove($id, $checklistId) { - return $this->delete($this->getPath($id).'/'.rawurlencode($checklistId)); + return $this->delete($this->getPath($id) . '/' . rawurlencode($checklistId)); } /** * Get a given card's checklist item states * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-checkitemstates * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * * @return array */ public function itemStates($id, array $params = array()) { - return $this->get('cards/'.rawurlencode($id).'/checkItemStates', $params); + return $this->get('cards/' . rawurlencode($id) . '/checkItemStates', $params); } /** * Update a given check item * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklistcurrent-checkitem-idcheckitem * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $checklistId the checklist's id * @param string $checkItemId the check item's id - * @param array $data check item data + * @param array $data check item data * * @return array */ public function updateItem($id, $checklistId, $checkItemId, array $data) { return $this->put( - $this->getPath($id).'/'.rawurlencode($checklistId).'/checkItem/'.rawurlencode($checkItemId), + $this->getPath($id) . '/' . rawurlencode($checklistId) . '/checkItem/' . rawurlencode($checkItemId), $data ); } @@ -102,10 +102,10 @@ public function updateItem($id, $checklistId, $checkItemId, array $data) * Create a check item * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $checklistId the checklist's id - * @param string $name check item name - * @param array $data check item data + * @param string $name check item name + * @param array $data check item data * * @return array */ @@ -114,14 +114,14 @@ public function createItem($id, $checklistId, $name, array $data = array()) $data['idChecklist'] = $checklistId; $data['name'] = $name; - return $this->post($this->getPath($id).'/'.rawurlencode($checklistId).'/checkItem', $data); + return $this->post($this->getPath($id) . '/' . rawurlencode($checklistId) . '/checkItem', $data); } /** * Convert a check item to card * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $checklistId the checklist's id * @param string $checkItemId the check item's id * @@ -130,7 +130,7 @@ public function createItem($id, $checklistId, $name, array $data = array()) public function convertItemToCard($id, $checklistId, $checkItemId) { return $this->post( - $this->getPath($id).'/'.rawurlencode($checklistId).'/checkItem/'.rawurlencode($checkItemId).'/convertToCard' + $this->getPath($id) . '/' . rawurlencode($checklistId) . '/checkItem/' . rawurlencode($checkItemId) . '/convertToCard' ); } @@ -138,7 +138,7 @@ public function convertItemToCard($id, $checklistId, $checkItemId) * Remove a check item from card * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $checklistId the checklist's id * @param string $checkItemId the check item's id * @@ -147,7 +147,7 @@ public function convertItemToCard($id, $checklistId, $checkItemId) public function removeItem($id, $checklistId, $checkItemId) { return $this->delete( - $this->getPath($id).'/'.rawurlencode($checklistId).'/checkItem/'.rawurlencode($checkItemId) + $this->getPath($id) . '/' . rawurlencode($checklistId) . '/checkItem/' . rawurlencode($checkItemId) ); } } diff --git a/lib/Trello/Api/Card/Labels.php b/lib/Trello/Api/Card/Labels.php index a8cfbfd..55cd226 100644 --- a/lib/Trello/Api/Card/Labels.php +++ b/lib/Trello/Api/Card/Labels.php @@ -19,8 +19,8 @@ class Labels extends AbstractApi * Set a given card's labels * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-labels * - * @param string $id the card's id or short link - * @param array $labels the labels + * @param string $id the card's id or short link + * @param array $labels the labels * * @return array card info * @@ -43,7 +43,7 @@ public function set($id, array $labels) * Remove a given label from a given card * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-labels-color * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $label the label to remove * * @return array card info @@ -56,6 +56,6 @@ public function remove($id, $label) throw new InvalidArgumentException(sprintf('Label "%s" does not exist.', $label)); } - return $this->delete($this->getPath($id).'/'.rawurlencode($label)); + return $this->delete($this->getPath($id) . '/' . rawurlencode($label)); } } diff --git a/lib/Trello/Api/Card/Members.php b/lib/Trello/Api/Card/Members.php index 7a0061d..2877eba 100644 --- a/lib/Trello/Api/Card/Members.php +++ b/lib/Trello/Api/Card/Members.php @@ -19,8 +19,8 @@ class Members extends AbstractApi * Get members related to a given card * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-members * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array */ @@ -33,8 +33,8 @@ public function all($id, array $params = array()) * Set members of a given card * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idmembers * - * @param string $id the card's id or short link - * @param array $members An array of member ids + * @param string $id the card's id or short link + * @param array $members An array of member ids * * @return array */ @@ -53,8 +53,8 @@ public function set($id, array $members) * Add a member to a given card * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-idmembers * - * @param string $id the card's id or short link - * @param array $memberId the member's id + * @param string $id the card's id or short link + * @param array $memberId the member's id * * @return array */ @@ -67,41 +67,41 @@ public function add($id, $memberId) * Remove a given member from a given card * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-idmembers-idmember * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $memberId the members's id * * @return array */ public function remove($id, $memberId) { - return $this->delete($this->getPath($id).'/'.rawurlencode($memberId)); + return $this->delete($this->getPath($id) . '/' . rawurlencode($memberId)); } /** * Add a given member's vote to a given card * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-membersvoted * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $memberId the members's id * * @return array */ public function addVote($id, $memberId) { - return $this->post($this->getPath($id).'/membersVoted', array('value' => $memberId)); + return $this->post($this->getPath($id) . '/membersVoted', array('value' => $memberId)); } /** * Remove a given member's vote from a given card * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-membersvoted-idmember * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $memberId the members's id * * @return array */ public function removeVote($id, $memberId) { - return $this->delete($this->getPath($id).'/membersVoted/'.rawurlencode($memberId)); + return $this->delete($this->getPath($id) . '/membersVoted/' . rawurlencode($memberId)); } } diff --git a/lib/Trello/Api/Card/Stickers.php b/lib/Trello/Api/Card/Stickers.php index ea0ac55..a2d2ce2 100644 --- a/lib/Trello/Api/Card/Stickers.php +++ b/lib/Trello/Api/Card/Stickers.php @@ -18,8 +18,8 @@ class Stickers extends AbstractApi * Get stickers related to a given card * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-stickers * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array */ @@ -32,9 +32,9 @@ public function all($id, array $params = array()) * Get a given sticker on a given card * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-stickers-idsticker * - * @param string $id the card's id or short link - * @param string $stickerId the sticker's id - * @param string|array $fields 'all' or a array of: + * @param string $id the card's id or short link + * @param string $stickerId the sticker's id + * @param string|array $fields 'all' or a array of: * - image * - imageScaled * - imageUrl @@ -51,16 +51,16 @@ public function show($id, $stickerId, $fields = 'all') $allowed = array('all', 'image', 'imageScaled', 'imageUrl', 'left', 'rotate', 'top', 'zIndex'); $fields = $this->validateAllowedParameters($allowed, $fields, 'field'); - return $this->get($this->getPath($id).'/'.rawurlencode($stickerId), $fields); + return $this->get($this->getPath($id) . '/' . rawurlencode($stickerId), $fields); } /** * Update a given sticker on a given card * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-stickers-idsticker * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $stickerId the sticker's id - * @param array $params Parameters to update (all optional but at least one of them is required): + * @param array $params Parameters to update (all optional but at least one of them is required): * - left * - rotate * - top @@ -73,20 +73,21 @@ public function update($id, $stickerId, array $params) $oneOf = array('left', 'rotate', 'top', 'zIndex'); $this->validateAtLeastOneOf($oneOf, $params); - return $this->put($this->getPath($id).'/'.rawurlencode($stickerId), $params); + return $this->put($this->getPath($id) . '/' . rawurlencode($stickerId), $params); } /** * Create a given sticker on a given card * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-stickers-idsticker * - * @param string $id the card's id or short link - * @param array $params Properties of the sticker + * @param string $id the card's id or short link + * @param array $params Properties of the sticker * - image (string) * - top * - left * - zIndex * - rotate (optional, default 0) + * * @return array */ public function create($id, array $params) @@ -101,13 +102,13 @@ public function create($id, array $params) * Remove a given sticker from a given card * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-stickers-idsticker * - * @param string $id the card's id or short link + * @param string $id the card's id or short link * @param string $stickerId the sticker's id * * @return array */ public function remove($id, $stickerId) { - return $this->delete($this->getPath($id).'/'.rawurlencode($stickerId)); + return $this->delete($this->getPath($id) . '/' . rawurlencode($stickerId)); } } diff --git a/lib/Trello/Api/Cardlist.php b/lib/Trello/Api/Cardlist.php index 39bfd5c..dff2c78 100644 --- a/lib/Trello/Api/Cardlist.php +++ b/lib/Trello/Api/Cardlist.php @@ -35,14 +35,14 @@ class Cardlist extends AbstractApi * Find a list by id * @link https://trello.com/docs/api/list/#get-1-lists-idlist * - * @param string $id the list's id - * @param array $params optional attributes + * @param string $id the list's id + * @param array $params optional attributes * * @return array list info */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } /** @@ -65,50 +65,50 @@ public function create(array $params = array()) * Update a list * @link https://trello.com/docs/api/list/#put-1-lists-idlist * - * @param string $id the list's id - * @param array $params list attributes to update + * @param string $id the list's id + * @param array $params list attributes to update * * @return array list info */ public function update($id, array $params = array()) { - return $this->put($this->getPath().'/'.rawurlencode($id), $params); + return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } /** * Set a given list's board * @link https://trello.com/docs/api/list/#put-1-lists-idlist-idboard * - * @param string $id the list's id + * @param string $id the list's id * @param string $boardId the board's id * * @return array board info */ public function setBoard($id, $boardId) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/idBoard', array('value' => $boardId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idBoard', array('value' => $boardId)); } /** * Get a given list's board * @link https://trello.com/docs/api/list/#get-1-lists-idlist-board * - * @param string $id the list's id - * @param array $params optional parameters + * @param string $id the list's id + * @param array $params optional parameters * * @return array board info */ public function getBoard($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } /** * Get the field of a board of a given list * @link https://trello.com/docs/api/list/#get-1-lists-idlist-board-field * - * @param string $id the list's id - * @param array $field the name of the field + * @param string $id the list's id + * @param array $field the name of the field * * @return array * @@ -118,56 +118,56 @@ public function getBoardField($id, $field) { $this->validateAllowedParameters(Board::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board/' . rawurlencode($field)); } /** * Set a given list's name * @link https://trello.com/docs/api/list/#put-1-lists-idlist-name * - * @param string $id the list's id + * @param string $id the list's id * @param string $name the name * * @return array list info */ public function setName($id, $name) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/name', array('value' => $name)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', array('value' => $name)); } /** * Set a given list's description * @link https://trello.com/docs/api/list/#put-1-lists-list-id-desc * - * @param string $id the list's id - * @param bool $subscribed subscription state + * @param string $id the list's id + * @param bool $subscribed subscription state * * @return array list info */ public function setSubscribed($id, $subscribed) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/subscribed', array('value' => $subscribed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/subscribed', array('value' => $subscribed)); } /** * Set a given list's state * @link https://trello.com/docs/api/list/#put-1-lists-idlist-closed * - * @param string $id the list's id - * @param bool $closed whether the list should be closed or not + * @param string $id the list's id + * @param bool $closed whether the list should be closed or not * * @return array list info */ public function setClosed($id, $closed = true) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/closed', array('value' => $closed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/closed', array('value' => $closed)); } /** * Set a given list's position * @link https://trello.com/docs/api/list/#put-1-lists-idlist-pos * - * @param string $id the list's id + * @param string $id the list's id * @param string|integer $position the position, eg. 'top', 'bottom' * or a positive number * @@ -175,7 +175,7 @@ public function setClosed($id, $closed = true) */ public function setPosition($id, $position) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/pos', array('value' => $position)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/pos', array('value' => $position)); } /** diff --git a/lib/Trello/Api/Cardlist/Actions.php b/lib/Trello/Api/Cardlist/Actions.php index 569aa97..9434254 100644 --- a/lib/Trello/Api/Cardlist/Actions.php +++ b/lib/Trello/Api/Cardlist/Actions.php @@ -18,8 +18,8 @@ class Actions extends AbstractApi * Get actions related to a given list * @link https://trello.com/docs/api/list/#get-1-lists-idlist-actions * - * @param string $id the list's id - * @param array $params optional parameters + * @param string $id the list's id + * @param array $params optional parameters * * @return array */ diff --git a/lib/Trello/Api/Cardlist/Cards.php b/lib/Trello/Api/Cardlist/Cards.php index 0d6af4d..db0e6ec 100644 --- a/lib/Trello/Api/Cardlist/Cards.php +++ b/lib/Trello/Api/Cardlist/Cards.php @@ -18,8 +18,8 @@ class Cards extends AbstractApi * Get cards related to a given list * @link https://trello.com/docs/api/list/#get-1-lists-idlist-cards * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array */ @@ -32,8 +32,8 @@ public function all($id, array $params = array()) * Filter cards related to a given list * @link https://trello.com/docs/api/list/#get-1-lists-idlist-cards-filter * - * @param string $id the list's id - * @param array $filter one of 'none', 'open', 'closed', 'all' + * @param string $id the list's id + * @param array $filter one of 'none', 'open', 'closed', 'all' * * @return array */ @@ -42,14 +42,14 @@ public function filter($id, $filter = 'all') $allowed = array('none', 'open', 'closed', 'all'); $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); - return $this->get($this->getPath($id).'/'.implode(',', $filters)); + return $this->get($this->getPath($id) . '/' . implode(',', $filters)); } /** * Create a card * @link https://trello.com/docs/api/list/#post-1-lists-idlist-cards * - * @param array $params optional attributes + * @param array $params optional attributes * * @return array card info */ @@ -75,15 +75,15 @@ public function create($id, $name, array $params = array()) */ public function archiveAll($id) { - return $this->post('lists/'.rawurlencode($id).'/archiveAllCards'); + return $this->post('lists/' . rawurlencode($id) . '/archiveAllCards'); } /** * Move all cards of a given list to another list * @link https://trello.com/docs/api/list/#post-1-lists-idlist-moveallcards * - * @param string $id Id of the list to move - * @param string $boardId id of the board that the cards should be moved to + * @param string $id Id of the list to move + * @param string $boardId id of the board that the cards should be moved to * @param string $destListId id of the list that the cards should be moved to * * @return array @@ -95,6 +95,6 @@ public function moveAll($id, $boardId, $destListId) 'idList' => $destListId, ); - return $this->post('lists/'.rawurlencode($id).'/moveAllCards', $data); + return $this->post('lists/' . rawurlencode($id) . '/moveAllCards', $data); } } diff --git a/lib/Trello/Api/Checklist.php b/lib/Trello/Api/Checklist.php index be3e783..ff2577c 100644 --- a/lib/Trello/Api/Checklist.php +++ b/lib/Trello/Api/Checklist.php @@ -34,14 +34,14 @@ class Checklist extends AbstractApi * Find a list by id * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist * - * @param string $id the checklist's id - * @param array $params optional attributes + * @param string $id the checklist's id + * @param array $params optional attributes * * @return array list info */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } /** @@ -63,14 +63,14 @@ public function create(array $params = array()) * Update a checklist * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist * - * @param string $id the list's id - * @param array $params list attributes to update + * @param string $id the list's id + * @param array $params list attributes to update * * @return array list info */ public function update($id, array $params = array()) { - return $this->put($this->getPath().'/'.rawurlencode($id), $params); + return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } /** @@ -83,29 +83,29 @@ public function update($id, array $params = array()) */ public function remove($id) { - return $this->delete($this->getPath().'/'.rawurlencode($id)); + return $this->delete($this->getPath() . '/' . rawurlencode($id)); } /** * Get the board of a given checklist * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-board * - * @param string $id the checklist's id - * @param array $params optional parameters + * @param string $id the checklist's id + * @param array $params optional parameters * * @return array board info */ public function getBoard($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } /** * Get the field of a board of a given checklist * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-board-field * - * @param string $id the checklist's id - * @param array $field the name of the field + * @param string $id the checklist's id + * @param array $field the name of the field * * @return array board info * @@ -115,42 +115,42 @@ public function getBoardField($id, $field) { $this->validateAllowedParameters(Board::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board/' . rawurlencode($field)); } /** * Set a given checklist's card * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist-idcard * - * @param string $id the list's id + * @param string $id the list's id * @param string $cardId the card's id * * @return array */ public function setCard($id, $cardId) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/idCard', array('value' => $cardId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idCard', array('value' => $cardId)); } /** * Set a given checklist's name * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist-name * - * @param string $id the checklist's id + * @param string $id the checklist's id * @param string $name the name * * @return array */ public function setName($id, $name) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/name', array('value' => $name)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', array('value' => $name)); } /** * Set a given checklist's position * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist-pos * - * @param string $id the list's id + * @param string $id the list's id * @param string|integer $position the position, eg. 'top', 'bottom' * or a positive number * @@ -158,7 +158,7 @@ public function setName($id, $name) */ public function setPosition($id, $position) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/pos', array('value' => $position)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/pos', array('value' => $position)); } /** diff --git a/lib/Trello/Api/Checklist/Cards.php b/lib/Trello/Api/Checklist/Cards.php index 304fff2..09f595c 100644 --- a/lib/Trello/Api/Checklist/Cards.php +++ b/lib/Trello/Api/Checklist/Cards.php @@ -18,8 +18,8 @@ class Cards extends AbstractApi * Get cards related to a given checklist * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-cards * - * @param string $id the checklist's id - * @param array $params optional parameters + * @param string $id the checklist's id + * @param array $params optional parameters * * @return array */ @@ -32,8 +32,8 @@ public function all($id, array $params = array()) * Filter cards related to a given checklist * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-cards-filter * - * @param string $id the checklist's id - * @param array $filter one of 'none', 'open', 'closed', 'all' + * @param string $id the checklist's id + * @param array $filter one of 'none', 'open', 'closed', 'all' * * @return array */ @@ -42,6 +42,6 @@ public function filter($id, $filter = 'all') $allowed = array('none', 'open', 'closed', 'all'); $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); - return $this->get($this->getPath($id).'/'.implode(',', $filters)); + return $this->get($this->getPath($id) . '/' . implode(',', $filters)); } } diff --git a/lib/Trello/Api/Checklist/Items.php b/lib/Trello/Api/Checklist/Items.php index 12d6128..61666f7 100644 --- a/lib/Trello/Api/Checklist/Items.php +++ b/lib/Trello/Api/Checklist/Items.php @@ -26,8 +26,8 @@ class Items extends AbstractApi * Get items related to a given checklist * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-checkitems * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array */ @@ -40,10 +40,10 @@ public function all($id, array $params = array()) * Create an item in the given checklist * @link https://trello.com/docs/api/checklist/#post-1-checklists-idchecklist-checkitems * - * @param string $id Id of the checklist - * @param string $name Name of the item - * @param bool $checked Check status - * @param array $data optional attributes + * @param string $id Id of the checklist + * @param string $name Name of the item + * @param bool $checked Check status + * @param array $data optional attributes * * @return array */ @@ -63,9 +63,9 @@ public function create($id, $name, $checked = false, array $data = array()) * a dirty workaround which works by deleting the item * and recreating it. * - * @param string $id Id of the checklist + * @param string $id Id of the checklist * @param string $itemId the id of the item to update - * @param array $data check item data + * @param array $data check item data * * @return array */ @@ -82,13 +82,13 @@ public function update($id, $itemId, array $data) * Remove an item from checklist * @link https://trello.com/docs/api/checklist/#delete-1-checklists-idchecklist-checkitems-idcheckitem * - * @param string $id the id of the checklist the item should be removed from + * @param string $id the id of the checklist the item should be removed from * @param string $itemId the id of the item to delete * * @return array card info */ public function remove($id, $itemId) { - return $this->delete($this->getPath($id).'/'.rawurlencode($itemId)); + return $this->delete($this->getPath($id) . '/' . rawurlencode($itemId)); } } diff --git a/lib/Trello/Api/Member.php b/lib/Trello/Api/Member.php index 7e137d7..04ae359 100644 --- a/lib/Trello/Api/Member.php +++ b/lib/Trello/Api/Member.php @@ -65,126 +65,126 @@ class Member extends AbstractApi * Find a member by id or username * @link https://trello.com/docs/api/member/index.html#get-1-members-idmember-or-username * - * @param string $id the member's id or username - * @param array $params optional attributes + * @param string $id the member's id or username + * @param array $params optional attributes * * @return array list info */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } /** * Update a member * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username * - * @param string $id the member's id or username - * @param array $params attributes to update: 'fullName', 'initials', 'username', 'bio', + * @param string $id the member's id or username + * @param array $params attributes to update: 'fullName', 'initials', 'username', 'bio', * 'avatarSource', 'prefs/colorBlind', 'prefs/minutesBetweenSummaries' * * @return array list info */ public function update($id, array $params = array()) { - return $this->put($this->getPath().'/'.rawurlencode($id), $params); + return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } /** * Get a given member's deltas * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-deltas * - * @param string $id the member's id or username - * @param array $params optional parameters + * @param string $id the member's id or username + * @param array $params optional parameters * * @return array */ public function getDeltas($id, array $params = array()) { - return $this->get($this->path.'/'.rawurlencode($id).'/deltas', $params); + return $this->get($this->path . '/' . rawurlencode($id) . '/deltas', $params); } /** * Set a given member's avatarSource * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-avatarSource * - * @param string $id the member's id or username + * @param string $id the member's id or username * @param string $avatarSource the avatarSource, one of 'none', 'upload', 'gravatar' * * @return array */ public function setAvatarSource($id, $avatarSource) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/avatarSource', array('value' => $avatarSource)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/avatarSource', array('value' => $avatarSource)); } /** * Set a given member's bio * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-bio * - * @param string $id the member's id or username + * @param string $id the member's id or username * @param string $bio the bio * * @return array */ public function setBio($id, $bio) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/bio', array('value' => $bio)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/bio', array('value' => $bio)); } /** * Set a given member's full name * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-fullname * - * @param string $id the member's id or username + * @param string $id the member's id or username * @param string $fullName the full name * * @return array */ public function setFullName($id, $fullName) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/fullName', array('value' => $fullName)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/fullName', array('value' => $fullName)); } /** * Set a given member's initials * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-initials * - * @param string $id the member's id or username + * @param string $id the member's id or username * @param string $initials the initials * * @return array */ public function setInitials($id, $initials) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/initials', array('value' => $initials)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/initials', array('value' => $initials)); } /** * Set a given member's username * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-username * - * @param string $id the member's id or username + * @param string $id the member's id or username * @param string $username the username * * @return array */ public function setUsername($id, $username) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/username', array('value' => $username)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/username', array('value' => $username)); } /** * Set a given member's avatar * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-avatar-avatar * - * @param string $id the member's id or avatar + * @param string $id the member's id or avatar * * @return array */ public function setAvatar($id, $file) { - return $this->post($this->getPath().'/'.rawurlencode($id).'/avatar', array('file' => $file)); + return $this->post($this->getPath() . '/' . rawurlencode($id) . '/avatar', array('file' => $file)); } /** diff --git a/lib/Trello/Api/Member/Actions.php b/lib/Trello/Api/Member/Actions.php index f743ef0..3777b33 100644 --- a/lib/Trello/Api/Member/Actions.php +++ b/lib/Trello/Api/Member/Actions.php @@ -18,8 +18,8 @@ class Actions extends AbstractApi * Get actions related to a given member * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-actions * - * @param string $id the card's id or short link - * @param array $params optional parameters + * @param string $id the card's id or short link + * @param array $params optional parameters * * @return array */ diff --git a/lib/Trello/Api/Member/Boards.php b/lib/Trello/Api/Member/Boards.php index 1066fd4..4cf9fb3 100644 --- a/lib/Trello/Api/Member/Boards.php +++ b/lib/Trello/Api/Member/Boards.php @@ -6,7 +6,6 @@ use Trello\Api\Board; use Trello\Api\Member\Board\Backgrounds; use Trello\Api\Member\Board\Stars; -use Trello\Exception\InvalidArgumentException; /** * Trello Member Boards API @@ -22,8 +21,8 @@ class Boards extends AbstractApi * Get boads related to a given member * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-boards * - * @param string $id the member's id or username - * @param array $params optional parameters + * @param string $id the member's id or username + * @param array $params optional parameters * * @return array */ @@ -36,7 +35,7 @@ public function all($id = "me", array $params = array()) * Filter boards related to a given member * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-boards-filter * - * @param string $id the board's id + * @param string $id the board's id * @param string|array $filter array of / one of 'all', none', 'open', 'closed', 'all' * * @return array @@ -46,28 +45,28 @@ public function filter($id, $filter = 'all') $allowed = array('all', 'members', 'organization', 'public', 'open', 'closed', 'pinned', 'unpinned', 'starred'); $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); - return $this->get($this->getPath($id).'/'.implode(',', $filters)); + return $this->get($this->getPath($id) . '/' . implode(',', $filters)); } /** * Get boads a given member is invited to * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-boardsinvited * - * @param string $id the member's id or username - * @param array $params optional parameters + * @param string $id the member's id or username + * @param array $params optional parameters * * @return array */ public function invitedTo($id, array $params = array()) { - return $this->get($this->getPath($id).'Invited', $params); + return $this->get($this->getPath($id) . 'Invited', $params); } /** * Get a field of a boad a given member is invited to * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-boardsinvited-field * - * @param string $id the member's id or username + * @param string $id the member's id or username * * @return array */ @@ -75,35 +74,35 @@ public function invitedToField($id, $field) { $this->validateAllowedParameters(Board::$fields, $field, 'field'); - return $this->get($this->getPath($id).'Invited/'.rawurlencode($field)); + return $this->get($this->getPath($id) . 'Invited/' . rawurlencode($field)); } /** * Pin a boad for a given member * @link https://trello.com/docs/api/member/#post-1-members-idmember-or-username-idboardspinned * - * @param string $id the member's id or username + * @param string $id the member's id or username * @param string $boardId the board's id * * @return array */ public function pin($id, $boardId) { - return $this->post('members/'.rawurlencode($id).'/idBoardsPinned', array('value' => $boardId)); + return $this->post('members/' . rawurlencode($id) . '/idBoardsPinned', array('value' => $boardId)); } /** * Unpin a boad for a given member * @link https://trello.com/docs/api/member/#delete-1-members-idmember-or-username-idboardspinned-idboard * - * @param string $id the member's id or username + * @param string $id the member's id or username * @param string $boardId the board's id * * @return array */ public function unpin($id, $boardId) { - return $this->delete('members/'.rawurlencode($id).'/idBoardsPinned/'.rawurlencode($boardId)); + return $this->delete('members/' . rawurlencode($id) . '/idBoardsPinned/' . rawurlencode($boardId)); } /** diff --git a/lib/Trello/Api/Member/Cards.php b/lib/Trello/Api/Member/Cards.php index f9c4c7c..1734b82 100644 --- a/lib/Trello/Api/Member/Cards.php +++ b/lib/Trello/Api/Member/Cards.php @@ -18,8 +18,8 @@ class Cards extends AbstractApi * Get cards related to a given list * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-cards * - * @param string $id the member's id or username - * @param array $params optional parameters + * @param string $id the member's id or username + * @param array $params optional parameters * * @return array */ @@ -32,8 +32,8 @@ public function all($id, array $params = array()) * Filter cards related to a given list * @link https://trello.com/docs/api/list/#get-1-lists-idlist-cards-filter * - * @param string $id the list's id - * @param array $filter one of 'none', 'visible', 'open', 'closed', 'all' + * @param string $id the list's id + * @param array $filter one of 'none', 'visible', 'open', 'closed', 'all' * * @return array */ @@ -42,6 +42,6 @@ public function filter($id, $filter = 'all') $allowed = array('none', 'visible', 'open', 'closed', 'all'); $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); - return $this->get($this->getPath($id).'/'.implode(',', $filters)); + return $this->get($this->getPath($id) . '/' . implode(',', $filters)); } } diff --git a/lib/Trello/Api/Member/Notifications.php b/lib/Trello/Api/Member/Notifications.php index 5470461..7f70439 100644 --- a/lib/Trello/Api/Member/Notifications.php +++ b/lib/Trello/Api/Member/Notifications.php @@ -19,8 +19,8 @@ class Notifications extends AbstractApi * Get notifications related to a given list * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-notifications * - * @param string $id the member's id or username - * @param array $params optional parameters + * @param string $id the member's id or username + * @param array $params optional parameters * * @return array */ @@ -33,8 +33,8 @@ public function all($id, array $params = array()) * Filter notifications related to a given member * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-notifications-filter * - * @param string $id the member's id or username - * @param array $event one of the events defined in \Trello\Events or 'all' + * @param string $id the member's id or username + * @param array $event one of the events defined in \Trello\Events or 'all' * * @return array */ @@ -45,6 +45,6 @@ public function filter($id, $event = 'all') $events = $this->validateAllowedParameters($events, $event, 'event'); - return $this->get($this->getPath($id).'/'.implode(',', $events)); + return $this->get($this->getPath($id) . '/' . implode(',', $events)); } } diff --git a/lib/Trello/Api/Member/Organizations.php b/lib/Trello/Api/Member/Organizations.php index a32e17f..7c29676 100644 --- a/lib/Trello/Api/Member/Organizations.php +++ b/lib/Trello/Api/Member/Organizations.php @@ -4,7 +4,6 @@ use Trello\Api\AbstractApi; use Trello\Api\Organization; -use Trello\Exception\InvalidArgumentException; /** * Trello Member Organizations API @@ -20,8 +19,8 @@ class Organizations extends AbstractApi * Get organizations related to a given member * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-organizations * - * @param string $id the member's id or username - * @param array $params optional parameters + * @param string $id the member's id or username + * @param array $params optional parameters * * @return array */ @@ -34,7 +33,7 @@ public function all($id, array $params = array()) * Filter organizations related to a given member * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-organizations-filter * - * @param string $id the organization's id + * @param string $id the organization's id * @param string|array $filter array of / one of 'all', 'none', 'members', 'public' * * @return array @@ -44,28 +43,28 @@ public function filter($id, $filter = 'all') $allowed = array('all', 'none', 'members', 'public'); $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); - return $this->get($this->getPath($id).'/'.implode(',', $filters)); + return $this->get($this->getPath($id) . '/' . implode(',', $filters)); } /** * Get organizations a given member is invited to * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-organizationsinvited * - * @param string $id the member's id or username - * @param array $params optional parameters + * @param string $id the member's id or username + * @param array $params optional parameters * * @return array */ public function invitedTo($id, array $params = array()) { - return $this->get($this->getPath($id).'Invited', $params); + return $this->get($this->getPath($id) . 'Invited', $params); } /** * Get a field of an organization a given member is invited to * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-organizationsinvited-field * - * @param string $id the member's id or username + * @param string $id the member's id or username * * @return array */ @@ -73,6 +72,6 @@ public function invitedToField($id, $field) { $this->validateAllowedParameters(Organization::$fields, $field, 'field'); - return $this->get($this->getPath($id).'Invited/'.rawurlencode($field)); + return $this->get($this->getPath($id) . 'Invited/' . rawurlencode($field)); } } diff --git a/lib/Trello/Api/Notification.php b/lib/Trello/Api/Notification.php index b897dec..6e34634 100644 --- a/lib/Trello/Api/Notification.php +++ b/lib/Trello/Api/Notification.php @@ -35,42 +35,42 @@ class Notification extends AbstractApi * Find a notification by id * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification * - * @param string $id the notification's id - * @param array $params optional attributes + * @param string $id the notification's id + * @param array $params optional attributes * * @return array */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } /** * Update a notification * @link https://trello.com/docs/api/notification/#put-1-notifications-idnotification * - * @param string $id the notification's id - * @param array $data attributes to update + * @param string $id the notification's id + * @param array $data attributes to update * * @return arrays */ public function update($id, array $data) { - return $this->put($this->getPath().'/'.rawurlencode($id), $data); + return $this->put($this->getPath() . '/' . rawurlencode($id), $data); } /** * Set a notification's unread status * @link https://trello.com/docs/api/notification/#put-1-notifications-idnotification-unread * - * @param string $id the notification's id - * @param bool $status true for unread, false for read + * @param string $id the notification's id + * @param bool $status true for unread, false for read * * @return arrays */ public function setUnread($id, $status) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/unread', array('value' => $status)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/unread', array('value' => $status)); } /** @@ -81,43 +81,43 @@ public function setUnread($id, $status) */ public function setAllRead() { - return $this->post($this->getPath().'/all/read'); + return $this->post($this->getPath() . '/all/read'); } /** * Get a given notification's entities * @link https://trello.com/docs/api/notification/#get-1-notifications-notification-id-entities * - * @param string $id the notification's id - * @param array $params optional parameters + * @param string $id the notification's id + * @param array $params optional parameters * * @return array */ public function getEntities($id, array $params = array()) { - return $this->get($this->path.'/'.rawurlencode($id).'/entities', $params); + return $this->get($this->path . '/' . rawurlencode($id) . '/entities', $params); } /** * Get a notification's board * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-board * - * @param string $id the notification's id - * @param array $params optional parameters + * @param string $id the notification's id + * @param array $params optional parameters * * @return array */ public function getBoard($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } /** * Get the field of a board of a given card * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-board * - * @param string $id the notification's id - * @param array $field the name of the field + * @param string $id the notification's id + * @param array $field the name of the field * * @return array * @@ -127,29 +127,29 @@ public function getBoardField($id, $field) { $this->validateAllowedParameters(Board::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board/' . rawurlencode($field)); } /** * Get a notification's list * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-list * - * @param string $id the notification's id - * @param array $params optional parameters + * @param string $id the notification's id + * @param array $params optional parameters * * @return array */ public function getList($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/list', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/list', $params); } /** * Get the field of a list of a given notification * @link https://trello.com/docs/api/notification/index.html#get-1-notifications-idnotification-list-field * - * @param string $id the notification's id - * @param array $field the name of the field + * @param string $id the notification's id + * @param array $field the name of the field * * @return array * @@ -159,29 +159,29 @@ public function getListField($id, $field) { $this->validateAllowedParameters(Cardlist::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/list/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/list/' . rawurlencode($field)); } /** * Get a notification's card * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-card * - * @param string $id the notification's id - * @param array $params optional parameters + * @param string $id the notification's id + * @param array $params optional parameters * * @return array */ public function getCard($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/card', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/card', $params); } /** * Get the field of a card of a given notification * @link https://trello.com/docs/api/notification/index.html#get-1-notifications-idnotification-card-field * - * @param string $id the notification's id - * @param array $field the name of the field + * @param string $id the notification's id + * @param array $field the name of the field * * @return array * @@ -191,29 +191,29 @@ public function getCardField($id, $field) { $this->validateAllowedParameters(Card::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/card/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/card/' . rawurlencode($field)); } /** * Get a notification's member * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-member * - * @param string $id the notification's id - * @param array $params optional parameters + * @param string $id the notification's id + * @param array $params optional parameters * * @return array */ public function getMember($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/member', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/member', $params); } /** * Get the field of a member of a given notification * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-member-field * - * @param string $id the notification's id - * @param array $field the name of the field + * @param string $id the notification's id + * @param array $field the name of the field * * @return array * @@ -223,29 +223,29 @@ public function getMemberField($id, $field) { $this->validateAllowedParameters(Member::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/member/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/member/' . rawurlencode($field)); } /** * Get a notification's creator * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-creator * - * @param string $id the notification's id - * @param array $params optional parameters + * @param string $id the notification's id + * @param array $params optional parameters * * @return array */ public function getCreator($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/memberCreator', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/memberCreator', $params); } /** * Get the field of a creator of a given notification * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-creator-field * - * @param string $id the notification's id - * @param array $field the name of the field + * @param string $id the notification's id + * @param array $field the name of the field * * @return array * @@ -255,29 +255,29 @@ public function getCreatorField($id, $field) { $this->validateAllowedParameters(Member::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/memberCreator/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/memberCreator/' . rawurlencode($field)); } /** * Get a notification's organization * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-organization * - * @param string $id the notification's id - * @param array $params optional parameters + * @param string $id the notification's id + * @param array $params optional parameters * * @return array */ public function getOrganization($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/organization', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/organization', $params); } /** * Get the field of an organization of a given notification * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-organization-field * - * @param string $id the notification's id - * @param array $field the name of the field + * @param string $id the notification's id + * @param array $field the name of the field * * @return array * @@ -287,6 +287,6 @@ public function getOrganizationField($id, $field) { $this->validateAllowedParameters(Organization::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/organization/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/organization/' . rawurlencode($field)); } } diff --git a/lib/Trello/Api/Organization.php b/lib/Trello/Api/Organization.php index 6fce6b1..f99498d 100644 --- a/lib/Trello/Api/Organization.php +++ b/lib/Trello/Api/Organization.php @@ -44,13 +44,13 @@ class Organization extends AbstractApi * Find an organization by id * @link https://trello.com/docs/api/organization/#get-1-organizations-idorg-or-name * - * @param string $id the organization's id - * @param array $params optional attributes + * @param string $id the organization's id + * @param array $params optional attributes * * @return array */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } } diff --git a/lib/Trello/Api/Token.php b/lib/Trello/Api/Token.php index ac6aaef..fdb0123 100644 --- a/lib/Trello/Api/Token.php +++ b/lib/Trello/Api/Token.php @@ -2,8 +2,6 @@ namespace Trello\Api; -use Trello\Exception\InvalidArgumentException; - /** * Trello Token API * @link https://trello.com/docs/api/token @@ -35,14 +33,14 @@ class Token extends AbstractApi * Find a token by id * @link https://trello.com/docs/api/token/#get-1-tokens-idtoken * - * @param string $id the token's id - * @param array $params optional attributes + * @param string $id the token's id + * @param array $params optional attributes * * @return array */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } /** @@ -55,28 +53,28 @@ public function show($id, array $params = array()) */ public function remove($id) { - return $this->delete($this->getPath().'/'.rawurlencode($id)); + return $this->delete($this->getPath() . '/' . rawurlencode($id)); } /** * Get a given token's member * @link https://trello.com/docs/api/token/#get-1-tokens-token-member * - * @param string $id the token's id - * @param array $params optional parameters + * @param string $id the token's id + * @param array $params optional parameters * * @return array */ public function getMember($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id).'/member', $params); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/member', $params); } /** * Get a given token's member's field * @link https://trello.com/docs/api/token/#get-1-tokens-token-member-field * - * @param string $id the token's id + * @param string $id the token's id * * @return array */ @@ -84,7 +82,7 @@ public function getMemberField($id, $field) { $this->validateAllowedParameters(Member::$fields, $field, 'field'); - return $this->get($this->getPath().'/'.rawurlencode($id).'/member/'.rawurlencode($field)); + return $this->get($this->getPath() . '/' . rawurlencode($id) . '/member/' . rawurlencode($field)); } /** diff --git a/lib/Trello/Api/Token/Webhooks.php b/lib/Trello/Api/Token/Webhooks.php index 7b2f947..bcf918e 100644 --- a/lib/Trello/Api/Token/Webhooks.php +++ b/lib/Trello/Api/Token/Webhooks.php @@ -18,8 +18,8 @@ class Webhooks extends AbstractApi * Get webhooks related to a given token * @link https://trello.com/docs/api/token/#get-1-tokens-token-webhooks * - * @param string $id the token's id - * @param array $params optional parameters + * @param string $id the token's id + * @param array $params optional parameters * * @return array */ @@ -32,22 +32,22 @@ public function all($id, array $params = array()) * Get a webhook * @link https://trello.com/docs/api/token/#get-1-tokens-token-webhooks-idwebhook * - * @param string $id the token's id + * @param string $id the token's id * @param string $webhookId the webhook's id * * @return array */ public function show($id, $webhookId) { - return $this->get($this->getPath($id).'/'.rawurlencode($webhookId)); + return $this->get($this->getPath($id) . '/' . rawurlencode($webhookId)); } /** * Create a webhook * @link https://trello.com/docs/api/token/#post-1-tokens-token-webhooks * - * @param string $id the id of the token the webhook should be created on - * @param array $params optional attributes + * @param string $id the id of the token the webhook should be created on + * @param array $params optional attributes * * @return array card info */ @@ -62,8 +62,8 @@ public function create($id, array $params) * Update a webhook * @link https://trello.com/docs/api/token/#put-1-tokens-token-webhooks * - * @param string $id the id of the token the webhook is attached to - * @param array $params optional attributes + * @param string $id the id of the token the webhook is attached to + * @param array $params optional attributes * * @return array card info */ @@ -78,13 +78,13 @@ public function update($id, array $params) * Remove a webhook * @link https://trello.com/docs/api/token/#delete-1-tokens-token-webhooks-idwebhook * - * @param string $id the id of the token the webhook is attached to + * @param string $id the id of the token the webhook is attached to * @param string $webhookId id of the webhook to remove * * @return array card info */ public function remove($id, $webhookId) { - return $this->delete($this->getPath($id).'/'.rawurlencode($webhookId)); + return $this->delete($this->getPath($id) . '/' . rawurlencode($webhookId)); } } diff --git a/lib/Trello/Api/Webhook.php b/lib/Trello/Api/Webhook.php index 79946f5..da2a05c 100644 --- a/lib/Trello/Api/Webhook.php +++ b/lib/Trello/Api/Webhook.php @@ -33,14 +33,14 @@ class Webhook extends AbstractApi * Find a webhook by id * @link https://trello.com/docs/api/webhook/#get-1-webhooks-idwebhook * - * @param string $id the webhook's id - * @param array $params optional attributes + * @param string $id the webhook's id + * @param array $params optional attributes * * @return array */ public function show($id, array $params = array()) { - return $this->get($this->getPath().'/'.rawurlencode($id), $params); + return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } /** @@ -62,8 +62,8 @@ public function create(array $params = array()) * Update a webhook * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook * - * @param string $id the webhook's id - * @param array $params webhook attributes to update + * @param string $id the webhook's id + * @param array $params webhook attributes to update * * @return array */ @@ -71,7 +71,7 @@ public function update($id, array $params = array()) { $this->validateRequiredParameters(array('callbackURL', 'idModel'), $params); - return $this->put($this->getPath().'/'.rawurlencode($id), $params); + return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } /** @@ -84,62 +84,62 @@ public function update($id, array $params = array()) */ public function remove($id) { - return $this->delete($this->getPath().'/'.rawurlencode($id)); + return $this->delete($this->getPath() . '/' . rawurlencode($id)); } /** * Set a given webhook's callback url * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook-callbackurl * - * @param string $id the webhook's id + * @param string $id the webhook's id * @param string $url the webhook's callback url * * @return array */ public function setCallbackUrl($id, $url) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/callbackUrl', array('value' => $url)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/callbackUrl', array('value' => $url)); } /** * Set a given webhook's description * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook-description * - * @param string $id the webhook's id + * @param string $id the webhook's id * @param string $description the webhook's description * * @return array */ public function setDescription($id, $description) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/description', array('value' => $description)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/description', array('value' => $description)); } /** * Set a given webhook's board * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook-idmodel * - * @param string $id the webhook's id + * @param string $id the webhook's id * @param string $modelId the webhook's model id * * @return array */ public function setModel($id, $modelId) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/idModel', array('value' => $modelId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idModel', array('value' => $modelId)); } /** * Set a given webhook's active state * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook-active * - * @param string $id the webhook's id - * @param bool $active the webhook's status + * @param string $id the webhook's id + * @param bool $active the webhook's status * * @return array */ public function setActive($id, $active) { - return $this->put($this->getPath().'/'.rawurlencode($id).'/active', array('value' => $active)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/active', array('value' => $active)); } } diff --git a/lib/Trello/Client.php b/lib/Trello/Client.php index d276941..257c776 100644 --- a/lib/Trello/Client.php +++ b/lib/Trello/Client.php @@ -60,12 +60,12 @@ class Client implements ClientInterface * @var array */ private $options = array( - 'base_url' => 'https://api.trello.com/', - 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', - 'timeout' => 10, - 'api_limit' => 5000, + 'base_url' => 'https://api.trello.com/', + 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', + 'timeout' => 10, + 'api_limit' => 5000, 'api_version' => 1, - 'cache_dir' => null, + 'cache_dir' => null, ); /** @@ -147,9 +147,9 @@ public function api($name) /** * Authenticate a user for all next requests * - * @param string $tokenOrLogin Trello private token/username/client ID - * @param null|string $password Trello password/secret (optionally can contain $authMethod) - * @param null|string $authMethod One of the AUTH_* class constants + * @param string $tokenOrLogin Trello private token/username/client ID + * @param null|string $password Trello password/secret (optionally can contain $authMethod) + * @param null|string $authMethod One of the AUTH_* class constants * * @throws InvalidArgumentException If no authentication method was given */ @@ -159,9 +159,14 @@ public function authenticate($tokenOrLogin, $password = null, $authMethod = null throw new InvalidArgumentException('You need to specify authentication method!'); } - if (null === $authMethod && in_array($password, array(self::AUTH_URL_TOKEN, self::AUTH_URL_CLIENT_ID, self::AUTH_HTTP_PASSWORD, self::AUTH_HTTP_TOKEN))) { + if (null === $authMethod && in_array($password, array( + self::AUTH_URL_TOKEN, + self::AUTH_URL_CLIENT_ID, + self::AUTH_HTTP_PASSWORD, + self::AUTH_HTTP_TOKEN + ))) { $authMethod = $password; - $password = null; + $password = null; } if (null === $authMethod) { @@ -235,7 +240,7 @@ public function getOption($name) * Set option * * @param string $name - * @param mixed $value + * @param mixed $value * * @throws InvalidArgumentException if the option is not defined * @throws InvalidArgumentException if the api version is set to an unsupported one @@ -267,7 +272,7 @@ public function getSupportedApiVersions() * Proxies $this->members() to $this->api('members') * * @param string $name method name - * @param array $args arguments + * @param array $args arguments * * @return ApiInterface * diff --git a/lib/Trello/Events.php b/lib/Trello/Events.php index 17ceef7..eeab203 100644 --- a/lib/Trello/Events.php +++ b/lib/Trello/Events.php @@ -16,97 +16,97 @@ final class Events * When a board is created * The event listener method receives a Trello\Event\BoardEvent instance. */ - const BOARD_CREATE = 'createBoard'; + const BOARD_CREATE = 'createBoard'; /** * When a board is updated * The event listener method receives a Trello\Event\BoardEvent instance. */ - const BOARD_UPDATE = 'updateBoard'; + const BOARD_UPDATE = 'updateBoard'; /** * When a board is copied * The event listener method receives a Trello\Event\BoardEvent instance. */ - const BOARD_COPY = 'copyBoard'; + const BOARD_COPY = 'copyBoard'; /** * When a card is moved from a board * The event listener method receives a Trello\Event\CardMoveEvent instance. */ - const BOARD_MOVE_CARD_FROM = 'moveCardFromBoard'; + const BOARD_MOVE_CARD_FROM = 'moveCardFromBoard'; /** * When a card is moved to a board * The event listener method receives a Trello\Event\CardMoveEvent instance. */ - const BOARD_MOVE_CARD_TO = 'moveCardToBoard'; + const BOARD_MOVE_CARD_TO = 'moveCardToBoard'; /** * When a card is moved from a board * The event listener method receives a Trello\Event\ListMoveEvent instance. */ - const BOARD_MOVE_LIST_FROM = 'moveListFromBoard'; + const BOARD_MOVE_LIST_FROM = 'moveListFromBoard'; /** * When a card is moved to a board * The event listener method receives a Trello\Event\ListMoveEvent instance. */ - const BOARD_MOVE_LIST_TO = 'moveListToBoard'; + const BOARD_MOVE_LIST_TO = 'moveListToBoard'; /** * When a member is added to a board * The event listener method receives a Trello\Event\BoardMemberEvent instance. */ - const BOARD_ADD_MEMBER = 'addMemberToBoard'; + const BOARD_ADD_MEMBER = 'addMemberToBoard'; /** * When a member becomes admin of a board * The event listener method receives a Trello\Event\BoardMemberEvent instance. */ - const BOARD_MAKE_ADMIN = 'makeAdminOfBoard'; + const BOARD_MAKE_ADMIN = 'makeAdminOfBoard'; /** * When a member becomes normal member of a board * The event listener method receives a Trello\Event\BoardMemberEvent instance. */ - const BOARD_MAKE_NORMAL_MEMBER = 'makeNormalMemberOfBoard'; + const BOARD_MAKE_NORMAL_MEMBER = 'makeNormalMemberOfBoard'; /** * When a member becomes observer of a board * The event listener method receives a Trello\Event\BoardMemberEvent instance. */ - const BOARD_MAKE_OBSERVER = 'makeObserverOfBoard'; + const BOARD_MAKE_OBSERVER = 'makeObserverOfBoard'; /** * When a member looses admin rights on a board * The event listener method receives a Trello\Event\BoardMemberEvent instance. */ - const BOARD_REMOVE_ADMIN = 'removeAdminFromBoard'; + const BOARD_REMOVE_ADMIN = 'removeAdminFromBoard'; /** * When an invitation is deleted * The event listener method receives a Trello\Event\BoardMemberEvent instance. */ - const BOARD_DELETE_INVITATION = 'deleteBoardInvitation'; + const BOARD_DELETE_INVITATION = 'deleteBoardInvitation'; /** * When an invitation is in unconfirmed state * The event listener method receives a Trello\Event\BoardMemberEvent instance. */ - const BOARD_UNCONFIRMED_INVITATION = 'unconfirmedBoardInvitation'; + const BOARD_UNCONFIRMED_INVITATION = 'unconfirmedBoardInvitation'; /** * When a board is added to an organization * The event listener method receives a Trello\Event\BoardOrganizationEvent instance. */ - const BOARD_ADD_TO_ORGANIZATION = 'addToOrganizationBoard'; + const BOARD_ADD_TO_ORGANIZATION = 'addToOrganizationBoard'; /** * When a board is removed from an organization * The event listener method receives a Trello\Event\BoardOrganizationEvent instance. */ - const BOARD_REMOVE_FROM_ORGANIZATION = 'removeFromOrganizationBoard'; + const BOARD_REMOVE_FROM_ORGANIZATION = 'removeFromOrganizationBoard'; /************************************************************************************** * List Events * @@ -116,25 +116,25 @@ final class Events * When a list is created * The event listener method receives a Trello\Event\ListEvent instance. */ - const LIST_CREATE = 'createList'; + const LIST_CREATE = 'createList'; /** * When a list is updated * The event listener method receives a Trello\Event\ListEvent instance. */ - const LIST_UPDATE = 'updateList'; + const LIST_UPDATE = 'updateList'; /** * When a list's closed state changes * The event listener method receives a Trello\Event\ListEvent instance. */ - const LIST_UPDATE_CLOSED = 'updateList:closed'; + const LIST_UPDATE_CLOSED = 'updateList:closed'; /** * When a list's name changes * The event listener method receives a Trello\Event\ListEvent instance. */ - const LIST_UPDATE_NAME = 'updateList:name'; + const LIST_UPDATE_NAME = 'updateList:name'; /************************************************************************************** * Card Events * @@ -144,109 +144,109 @@ final class Events * When a card is created * The event listener method receives a Trello\Event\CardEvent instance. */ - const CARD_CREATE = 'createCard'; + const CARD_CREATE = 'createCard'; /** * When a card is updated * The event listener method receives a Trello\Event\CardEvent instance. */ - const CARD_UPDATE = 'updateCard'; + const CARD_UPDATE = 'updateCard'; /** * When a card is moved to an other list * The event listener method receives a Trello\Event\CardMoveEvent instance. */ - const CARD_UPDATE_LIST = 'updateCard:idList'; + const CARD_UPDATE_LIST = 'updateCard:idList'; /** * When a card's name is updated * The event listener method receives a Trello\Event\CardEvent instance. */ - const CARD_UPDATE_NAME = 'updateCard:name'; + const CARD_UPDATE_NAME = 'updateCard:name'; /** * When a card's description is updated * The event listener method receives a Trello\Event\CardEvent instance. */ - const CARD_UPDATE_DESC = 'updateCard:desc'; + const CARD_UPDATE_DESC = 'updateCard:desc'; /** * When a card's closed state changes * The event listener method receives a Trello\Event\CardEvent instance. */ - const CARD_UPDATE_CLOSED = 'updateCard:closed'; + const CARD_UPDATE_CLOSED = 'updateCard:closed'; /** * When a card is deleted * The event listener method receives a Trello\Event\CardEvent instance. */ - const CARD_DELETE = 'deleteCard'; + const CARD_DELETE = 'deleteCard'; /** * When a card is copied * The event listener method receives a Trello\Event\CardCopyEvent instance. */ - const CARD_COPY = 'copyCard'; + const CARD_COPY = 'copyCard'; /** * When a new member is added to a card * The event listener method receives a Trello\Event\CardMemberEvent instance. */ - const CARD_ADD_MEMBER = 'addMemberToCard'; + const CARD_ADD_MEMBER = 'addMemberToCard'; /** * When a new member is removed from a card * The event listener method receives a Trello\Event\CardMemberEvent instance. */ - const CARD_REMOVE_MEMBER = 'removeMemberFromCard'; + const CARD_REMOVE_MEMBER = 'removeMemberFromCard'; /** * When a new label is added to a card * The event listener method receives a Trello\Event\CardEvent instance. */ - const CARD_ADD_LABEL = 'addLabelToCard'; + const CARD_ADD_LABEL = 'addLabelToCard'; /** * When a new label is removed from a card * The event listener method receives a Trello\Event\CardEvent instance. */ - const CARD_REMOVE_LABEL = 'removeLabelFromCard'; + const CARD_REMOVE_LABEL = 'removeLabelFromCard'; /** * When a comment is added to a card * The event listener method receives a Trello\Event\CardCommentEvent instance. */ - const CARD_COMMENT = 'commentCard'; + const CARD_COMMENT = 'commentCard'; /** * When a card's comment is copied * The event listener method receives a Trello\Event\CardCommentEvent instance. */ - const CARD_COPY_COMMENT = 'copyCommentCard'; + const CARD_COPY_COMMENT = 'copyCommentCard'; /** * When a card is created from a check item * The event listener method receives a Trello\Event\CardFromCheckItemEvent instance. */ - const CARD_FROM_CHECKITEM = 'convertToCardFromCheckItem'; + const CARD_FROM_CHECKITEM = 'convertToCardFromCheckItem'; /** * When an attachment is added to a card * The event listener method receives a Trello\Event\CardAttachmentEvent instance. */ - const CARD_ADD_ATTACHMENT = 'addAttachmentToCard'; + const CARD_ADD_ATTACHMENT = 'addAttachmentToCard'; /** * When an attachment is deleted from a card * The event listener method receives a Trello\Event\CardAttachmentEvent instance. */ - const CARD_DELETE_ATTACHMENT = 'deleteAttachmentFromCard'; + const CARD_DELETE_ATTACHMENT = 'deleteAttachmentFromCard'; /** * When a card is shared by email * The event listener method receives a Trello\Event\CardEvent instance. */ - const CARD_EMAIL = 'emailCard'; + const CARD_EMAIL = 'emailCard'; /************************************************************************************** * Checklist Events * @@ -256,37 +256,37 @@ final class Events * When a checklist is added to a card * The event listener method receives a Trello\Event\CardChecklistEvent instance. */ - const CARD_ADD_CHECKLIST = 'addChecklistToCard'; + const CARD_ADD_CHECKLIST = 'addChecklistToCard'; /** * When a checklist is updated on a card * The event listener method receives a Trello\Event\CardChecklistEvent instance. */ - const CARD_CREATE_CHECKLIST = 'createChecklist'; + const CARD_CREATE_CHECKLIST = 'createChecklist'; /** * When a checklist is updated on a card * The event listener method receives a Trello\Event\CardChecklistEvent instance. */ - const CARD_UPDATE_CHECKLIST = 'updateChecklist'; + const CARD_UPDATE_CHECKLIST = 'updateChecklist'; /** * When a checklist is removed from a card * The event listener method receives a Trello\Event\CardChecklistEvent instance. */ - const CARD_REMOVE_CHECKLIST = 'removeChecklistFromCard'; + const CARD_REMOVE_CHECKLIST = 'removeChecklistFromCard'; /** * When an item is added to a checklist * The event listener method receives a Trello\Event\CardChecklistEvent instance. */ - const CARD_CREATE_CHECKLIST_ITEM = 'createCheckItem'; + const CARD_CREATE_CHECKLIST_ITEM = 'createCheckItem'; /** * When a checklist is removed from a card * The event listener method receives a Trello\Event\CardChecklistEvent instance. */ - const CARD_UPDATE_CHECKLIST_ITEM_STATE = 'updateCheckItemStateOnCard'; + const CARD_UPDATE_CHECKLIST_ITEM_STATE = 'updateCheckItemStateOnCard'; /************************************************************************************** * Organization Events * @@ -296,37 +296,37 @@ final class Events * When an organization is created * The event listener method receives a Trello\Event\OrganizationEvent instance. */ - const ORGANIZATION_CREATE = 'createOrganization'; + const ORGANIZATION_CREATE = 'createOrganization'; /** * When an organization is updated * The event listener method receives a Trello\Event\OrganizationEvent instance. */ - const ORGANIZATION_UPDATE = 'updateOrganization'; + const ORGANIZATION_UPDATE = 'updateOrganization'; /** * When a member is added to an organization * The event listener method receives a Trello\Event\OrganizationMemberEvent instance. */ - const ORGANIZATION_ADD_MEMBER = 'addMemberToOrganization'; + const ORGANIZATION_ADD_MEMBER = 'addMemberToOrganization'; /** * When a member is made normal member of an organization * The event listener method receives a Trello\Event\OrganizationMemberEvent instance. */ - const ORGANIZATION_MAKE_NORMAL_MEMBER = 'makeNormalMemberOfOrganization'; + const ORGANIZATION_MAKE_NORMAL_MEMBER = 'makeNormalMemberOfOrganization'; /** * When a member looses admin rights of an organization * The event listener method receives a Trello\Event\OrganizationMemberEvent instance. */ - const ORGANIZATION_REMOVE_ADMIN = 'removeAdminFromOrganization'; + const ORGANIZATION_REMOVE_ADMIN = 'removeAdminFromOrganization'; /** * When an invitation to join an organization is deleted * The event listener method receives a Trello\Event\OrganizationMemberEvent instance. */ - const ORGANIZATION_DELETE_INVITATION = 'deleteOrganizationInvitation'; + const ORGANIZATION_DELETE_INVITATION = 'deleteOrganizationInvitation'; /** * When a member is invited to an organization @@ -342,13 +342,13 @@ final class Events * When a member joins * The event listener method receives a Trello\Event\MemberEvent instance. */ - const MEMBER_JOINED = 'memberJoinedTrello'; + const MEMBER_JOINED = 'memberJoinedTrello'; /** * When a member is updated * The event listener method receives a Trello\Event\MemberEvent instance. */ - const MEMBER_UPDATE = 'updateMember'; + const MEMBER_UPDATE = 'updateMember'; /************************************************************************************** * PowerUp Events * @@ -358,13 +358,13 @@ final class Events * When a power up is enabled * The event listener method receives a Trello\Event\PowerUpEvent instance. */ - const POWERUP_ENABLE = 'enablePowerUp'; + const POWERUP_ENABLE = 'enablePowerUp'; /** * When a power up is disabled * The event listener method receives a Trello\Event\PowerUpEvent instance. */ - const POWERUP_DISABLE = 'disablePowerUp'; + const POWERUP_DISABLE = 'disablePowerUp'; public static function all() { diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index b02ecd6..4aa1b74 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -15,9 +15,9 @@ class HttpClient implements HttpClientInterface { protected $options = array( - 'base_url' => 'https://api.trello.com/', - 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', - 'timeout' => 10, + 'base_url' => 'https://api.trello.com/', + 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', + 'timeout' => 10, 'api_version' => 1, ); @@ -32,16 +32,16 @@ class HttpClient implements HttpClientInterface private $lastRequest; /** - * @param array $options + * @param array $options * @param ClientInterface $client */ public function __construct(array $options = array(), ClientInterface $client = null) { $this->options = array_merge($this->options, $options); - $client = $client ?: new GuzzleClient($this->options['base_url'], $this->options); - $this->client = $client; + $client = $client ?: new GuzzleClient($this->options); + $this->client = $client; - $this->addListener('request.error', array(new ErrorListener($this->options), 'onRequestError')); + $this->addListener('request.error', array(new ErrorListener(), 'onRequestError')); $this->clearHeaders(); } @@ -152,7 +152,7 @@ public function request($path, $body = null, $httpMethod = 'GET', array $headers throw new RuntimeException($e->getMessage(), $e->getCode(), $e); } - $this->lastRequest = $request; + $this->lastRequest = $request; $this->lastResponse = $response; return $response; @@ -164,7 +164,8 @@ public function request($path, $body = null, $httpMethod = 'GET', array $headers public function authenticate($tokenOrLogin, $password = null, $method) { $this->addListener('request.before_send', array( - new AuthListener($tokenOrLogin, $password, $method), 'onRequestBeforeSend', + new AuthListener($tokenOrLogin, $password, $method), + 'onRequestBeforeSend', )); } @@ -190,7 +191,7 @@ public function getLastResponse() */ protected function createRequest($httpMethod, $path, $body = null, array $headers = array(), array $options = array()) { - $path = $this->options['api_version'].'/'.$path; + $path = $this->options['api_version'] . '/' . $path; if ($httpMethod === 'GET' && $body) { $path .= (false === strpos($path, '?') ? '?' : '&'); diff --git a/lib/Trello/HttpClient/HttpClientInterface.php b/lib/Trello/HttpClient/HttpClientInterface.php index 5a6e1ab..d7b8dcb 100644 --- a/lib/Trello/HttpClient/HttpClientInterface.php +++ b/lib/Trello/HttpClient/HttpClientInterface.php @@ -10,9 +10,9 @@ interface HttpClientInterface /** * Send a GET request * - * @param string $path Request path - * @param array $parameters GET Parameters - * @param array $headers Reconfigure the request headers for this call only + * @param string $path Request path + * @param array $parameters GET Parameters + * @param array $headers Reconfigure the request headers for this call only * * @return Response */ @@ -21,9 +21,9 @@ public function get($path, array $parameters = array(), array $headers = array() /** * Send a POST request * - * @param string $path Request path - * @param mixed $body Request body - * @param array $headers Reconfigure the request headers for this call only + * @param string $path Request path + * @param mixed $body Request body + * @param array $headers Reconfigure the request headers for this call only * * @return Response */ @@ -32,21 +32,21 @@ public function post($path, $body = null, array $headers = array()); /** * Send a PATCH request * - * @param string $path Request path - * @param mixed $body Request body - * @param array $headers Reconfigure the request headers for this call only + * @param string $path Request path + * @param mixed $body Request body + * @param array $headers Reconfigure the request headers for this call only * - * @internal param array $parameters Request body * @return Response + * @internal param array $parameters Request body */ public function patch($path, $body = null, array $headers = array()); /** * Send a PUT request * - * @param string $path Request path - * @param mixed $body Request body - * @param array $headers Reconfigure the request headers for this call only + * @param string $path Request path + * @param mixed $body Request body + * @param array $headers Reconfigure the request headers for this call only * * @return Response */ @@ -55,9 +55,9 @@ public function put($path, $body, array $headers = array()); /** * Send a DELETE request * - * @param string $path Request path - * @param mixed $body Request body - * @param array $headers Reconfigure the request headers for this call only + * @param string $path Request path + * @param mixed $body Request body + * @param array $headers Reconfigure the request headers for this call only * * @return Response */ @@ -67,10 +67,10 @@ public function delete($path, $body = null, array $headers = array()); * Send a request to the server, receive a response, * decode the response and returns an associative array * - * @param string $path Request path - * @param mixed $body Request body + * @param string $path Request path + * @param mixed $body Request body * @param string $httpMethod HTTP method to use - * @param array $headers Request headers + * @param array $headers Request headers * * @return Response */ @@ -79,18 +79,19 @@ public function request($path, $body, $httpMethod = 'GET', array $headers = arra /** * Change an option value. * - * @param string $name The option name - * @param mixed $value The value + * @param string $name The option name + * @param mixed $value The value * - * @throws InvalidArgumentException * @return void + * @throws InvalidArgumentException */ public function setOption($name, $value); /** * Set HTTP headers * - * @param array $headers + * @param array $headers + * * @return void */ public function setHeaders(array $headers); @@ -98,12 +99,12 @@ public function setHeaders(array $headers); /** * Authenticate a user for all next requests * - * @param string $tokenOrLogin Trello private token/username/client ID - * @param null|string $password Trello password/secret (optionally can contain $authMethod) - * @param null|string $authMethod One of the AUTH_* class constants + * @param string $tokenOrLogin Trello private token/username/client ID + * @param null|string $password Trello password/secret (optionally can contain $authMethod) + * @param null|string $authMethod One of the AUTH_* class constants * - * @throws InvalidArgumentException If no authentication method was given * @return void + * @throws InvalidArgumentException If no authentication method was given */ public function authenticate($tokenOrLogin, $password, $authMethod); } diff --git a/lib/Trello/HttpClient/Listener/AuthListener.php b/lib/Trello/HttpClient/Listener/AuthListener.php index cab17e9..d0a0c6e 100644 --- a/lib/Trello/HttpClient/Listener/AuthListener.php +++ b/lib/Trello/HttpClient/Listener/AuthListener.php @@ -35,7 +35,7 @@ public function onRequestBeforeSend(Event $event) case Client::AUTH_HTTP_PASSWORD: $event['request']->setHeader( 'Authorization', - sprintf('Basic %s', base64_encode($this->tokenOrLogin.':'.$this->password)) + sprintf('Basic %s', base64_encode($this->tokenOrLogin . ':' . $this->password)) ); break; @@ -50,7 +50,7 @@ public function onRequestBeforeSend(Event $event) $url = $event['request']->getUrl(); $parameters = array( - 'key' => $this->tokenOrLogin, + 'key' => $this->tokenOrLogin, 'token' => $this->password, ); diff --git a/lib/Trello/HttpClient/Listener/ErrorListener.php b/lib/Trello/HttpClient/Listener/ErrorListener.php index cb9e165..9982aec 100644 --- a/lib/Trello/HttpClient/Listener/ErrorListener.php +++ b/lib/Trello/HttpClient/Listener/ErrorListener.php @@ -47,30 +47,30 @@ public function onRequestError(Event $event) $errors = array(); foreach ($content['errors'] as $error) { switch ($error['code']) { - case 'missing': - $errors[] = sprintf('The %s %s does not exist, for resource "%s"', $error['field'], $error['value'], $error['resource']); - break; + case 'missing': + $errors[] = sprintf('The %s %s does not exist, for resource "%s"', $error['field'], $error['value'], $error['resource']); + break; - case 'missing_field': - $errors[] = sprintf('Field "%s" is missing, for resource "%s"', $error['field'], $error['resource']); - break; + case 'missing_field': + $errors[] = sprintf('Field "%s" is missing, for resource "%s"', $error['field'], $error['resource']); + break; - case 'invalid': - $errors[] = sprintf('Field "%s" is invalid, for resource "%s"', $error['field'], $error['resource']); - break; + case 'invalid': + $errors[] = sprintf('Field "%s" is invalid, for resource "%s"', $error['field'], $error['resource']); + break; - case 'already_exists': - $errors[] = sprintf('Field "%s" already exists, for resource "%s"', $error['field'], $error['resource']); - break; + case 'already_exists': + $errors[] = sprintf('Field "%s" already exists, for resource "%s"', $error['field'], $error['resource']); + break; - default: - $errors[] = $error['message']; - break; + default: + $errors[] = $error['message']; + break; } } - throw new ValidationFailedException('Validation Failed: '.implode(', ', $errors), 422); + throw new ValidationFailedException('Validation Failed: ' . implode(', ', $errors), 422); } } diff --git a/lib/Trello/HttpClient/Message/ResponseMediator.php b/lib/Trello/HttpClient/Message/ResponseMediator.php index 1f45dc0..ab56e4a 100644 --- a/lib/Trello/HttpClient/Message/ResponseMediator.php +++ b/lib/Trello/HttpClient/Message/ResponseMediator.php @@ -8,7 +8,7 @@ class ResponseMediator { public static function getContent(Response $response) { - $body = $response->getBody(); + $body = $response->getBody(); $content = json_decode($body, true); diff --git a/lib/Trello/Model/AbstractObject.php b/lib/Trello/Model/AbstractObject.php index deeabb2..0d7ed7f 100644 --- a/lib/Trello/Model/AbstractObject.php +++ b/lib/Trello/Model/AbstractObject.php @@ -53,12 +53,12 @@ abstract class AbstractObject * Constructor. * * @param ClientInterface $client the Trello client - * @param string $id the id of the object + * @param string $id the id of the object */ public function __construct(ClientInterface $client, $id = null) { $this->client = $client; - $this->api = $client->api($this->apiName); + $this->api = $client->api($this->apiName); $this->fields = $this->api->getFields(); @@ -168,7 +168,7 @@ protected function create() { $this->preCreate(); $this->data = $this->api->create($this->data); - $this->id = $this->data['id']; + $this->id = $this->data['id']; $this->postCreate(); return $this; diff --git a/lib/Trello/Model/Board.php b/lib/Trello/Model/Board.php index 733600b..0553bbc 100644 --- a/lib/Trello/Model/Board.php +++ b/lib/Trello/Model/Board.php @@ -12,13 +12,13 @@ class Board extends AbstractObject implements BoardInterface protected $apiName = 'board'; protected $loadParams = array( - 'fields' => 'all', - 'organization' => true, + 'fields' => 'all', + 'organization' => true, 'organization_memberships' => 'all', - 'members' => 'all', - 'membersInvited' => 'all', - 'memberships' => 'all', - 'lists' => 'all', + 'members' => 'all', + 'membersInvited' => 'all', + 'memberships' => 'all', + 'lists' => 'all', ); /** diff --git a/lib/Trello/Model/Card.php b/lib/Trello/Model/Card.php index bead76d..101d3a7 100644 --- a/lib/Trello/Model/Card.php +++ b/lib/Trello/Model/Card.php @@ -14,16 +14,16 @@ class Card extends AbstractObject implements CardInterface protected $apiName = 'card'; protected $loadParams = array( - 'fields' => 'all', - 'board' => true, - 'list' => true, - 'stickers' => true, - 'members' => true, - 'membersVoted' => true, - 'attachments' => true, - 'checklists' => 'all', + 'fields' => 'all', + 'board' => true, + 'list' => true, + 'stickers' => true, + 'members' => true, + 'membersVoted' => true, + 'attachments' => true, + 'checklists' => 'all', 'checkItemStates' => true, - 'actions' => Events::CARD_COMMENT, + 'actions' => Events::CARD_COMMENT, ); protected $newChecklists = array(); diff --git a/lib/Trello/Model/Cardlist.php b/lib/Trello/Model/Cardlist.php index eed816f..ba18090 100644 --- a/lib/Trello/Model/Cardlist.php +++ b/lib/Trello/Model/Cardlist.php @@ -10,7 +10,7 @@ class Cardlist extends AbstractObject implements CardlistInterface protected $apiName = 'list'; protected $loadParams = array( - 'cards' => 'all', + 'cards' => 'all', 'fields' => 'all', ); diff --git a/lib/Trello/Model/Checklist.php b/lib/Trello/Model/Checklist.php index dce17ec..ec2d37c 100644 --- a/lib/Trello/Model/Checklist.php +++ b/lib/Trello/Model/Checklist.php @@ -206,8 +206,8 @@ public function setItem($nameOrId, $checked = null, $position = null) } } else { $this->data['checkItems'][] = array( - 'name' => $nameOrId, - 'state' => $checked, + 'name' => $nameOrId, + 'state' => $checked, 'position' => $position, ); } diff --git a/lib/Trello/Model/ChecklistInterface.php b/lib/Trello/Model/ChecklistInterface.php index 5d7c2d2..61a2fe7 100644 --- a/lib/Trello/Model/ChecklistInterface.php +++ b/lib/Trello/Model/ChecklistInterface.php @@ -114,8 +114,8 @@ public function getItems(); /** * Set an item * - * @param string $name name of the item - * @param bool $checked whether it should be marked as completed or not + * @param string $name name of the item + * @param bool $checked whether it should be marked as completed or not * @param integer $position position on the list * * @return ChecklistInterface diff --git a/lib/Trello/Service.php b/lib/Trello/Service.php index fc9d480..9e23aa3 100644 --- a/lib/Trello/Service.php +++ b/lib/Trello/Service.php @@ -18,7 +18,7 @@ class Service extends Manager /** * Constructor. * - * @param ClientInterface $client + * @param ClientInterface $client * @param EventDispatcherInterface|null $dispatcher */ public function __construct(ClientInterface $client, EventDispatcherInterface $dispatcher = null) @@ -41,9 +41,9 @@ public function getEventDispatcher() /** * Attach an event listener * - * @param string $eventName @see Events for name constants - * @param callable $listener The listener - * @param int $priority The higher this value, the earlier an event + * @param string $eventName @see Events for name constants + * @param callable $listener The listener + * @param int $priority The higher this value, the earlier an event * listener will be triggered in the chain (defaults to 0) */ public function addListener($eventName, $listener, $priority = 0) @@ -83,9 +83,9 @@ public function isTrelloWebhook(Request $request) /** * Checks whether a given request is a Trello webhook - * and raises appropriate events @see Events + * and raises appropriate events @param Request|null $request + * @see Events * - * @param Request|null $request */ public function handleWebhook(Request $request = null) { @@ -108,7 +108,7 @@ public function handleWebhook(Request $request = null) } $eventName = $action['type']; - $data = $action['data']; + $data = $action['data']; switch ($eventName) { case Events::BOARD_CREATE: From 492cbc928a1fc990ab0320a5103fcc0b51dcafed Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 03:24:41 +0100 Subject: [PATCH 09/18] Solving some problems --- lib/Trello/HttpClient/HttpClient.php | 7 ++++--- lib/Trello/HttpClient/Listener/AuthListener.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index 4aa1b74..2db6a3d 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -74,15 +74,16 @@ public function clearHeaders() /** * @param string $eventName + * @param callable $listener */ public function addListener($eventName, $listener) { - $this->client->getEventDispatcher()->addListener($eventName, $listener); + $this->client->getEmitter()->on($eventName, $listener); } public function addSubscriber(EventSubscriberInterface $subscriber) { - $this->client->addSubscriber($subscriber); + $this->client->getEmitter()->attach($subscriber); } /** @@ -161,7 +162,7 @@ public function request($path, $body = null, $httpMethod = 'GET', array $headers /** * {@inheritDoc} */ - public function authenticate($tokenOrLogin, $password = null, $method) + public function authenticate($tokenOrLogin, $password, $method) { $this->addListener('request.before_send', array( new AuthListener($tokenOrLogin, $password, $method), diff --git a/lib/Trello/HttpClient/Listener/AuthListener.php b/lib/Trello/HttpClient/Listener/AuthListener.php index d0a0c6e..93d252a 100644 --- a/lib/Trello/HttpClient/Listener/AuthListener.php +++ b/lib/Trello/HttpClient/Listener/AuthListener.php @@ -17,10 +17,10 @@ class AuthListener * @param string $password * @param null|string $method */ - public function __construct($tokenOrLogin, $password = null, $method) + public function __construct($tokenOrLogin, $password, $method) { $this->tokenOrLogin = $tokenOrLogin; - $this->password = $password; + $this->password = $password ?: null; $this->method = $method; } From 80d483c9a43587c776a470b91c7db95f6d9302d1 Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 03:35:57 +0100 Subject: [PATCH 10/18] changes in http request --- lib/Trello/HttpClient/HttpClient.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index 2db6a3d..730d5f0 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -189,6 +189,8 @@ public function getLastResponse() /** * @param string $httpMethod * @param string $path + * + * @return Request|\GuzzleHttp\Message\RequestInterface */ protected function createRequest($httpMethod, $path, $body = null, array $headers = array(), array $options = array()) { @@ -199,12 +201,9 @@ protected function createRequest($httpMethod, $path, $body = null, array $header $path .= utf8_encode(http_build_query($body, '', '&')); } - return $this->client->createRequest( - $httpMethod, - $path, - array_merge($this->headers, $headers), - $body, - $options - ); + $options['body'] = $body; + $options['headers'] = array_merge($this->headers, $headers); + + return $this->client->createRequest($httpMethod, $path, $options); } } From 4bb9e6abd224ba5897b8d06708ae24cdf45200ae Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 03:42:21 +0100 Subject: [PATCH 11/18] v1 --- README.md | 10 ++++++---- composer.json | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2e1b154..5c20584 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -PHP Trello API v1 client +PHP Trello API v2 client ======================== [![Build Status](https://img.shields.io/travis/cdaguerre/php-trello-api.svg?branch=master&style=flat-square)](https://travis-ci.org/cdaguerre/php-trello-api) @@ -6,7 +6,7 @@ PHP Trello API v1 client [![Code Quality](https://img.shields.io/scrutinizer/g/cdaguerre/php-trello-api.svg?style=flat-square)](https://scrutinizer-ci.com/g/cdaguerre/php-trello-api/) [![Packagist](https://img.shields.io/packagist/dt/cdaguerre/php-trello-api.svg?style=flat-square)](https://packagist.org/packages/cdaguerre/php-trello-api) -A simple Object Oriented wrapper for the Trello API, written in PHP5. +A simple Object Oriented wrapper for the Trello API, written in PHP7.4. Uses [Trello API v1](https://trello.com/docs/index.html). The object API is very similar to the RESTful API. @@ -15,10 +15,11 @@ Uses [Trello API v1](https://trello.com/docs/index.html). The object API is very * Follows PSR-0 conventions and coding standards: autoload friendly * Light and fast thanks to lazy loading of API classes * Extensively tested +* Ready for Symfony 5 ## Requirements -* PHP >= 5.3.2 with [cURL](http://php.net/manual/en/book.curl.php) extension, +* PHP >= 7.4 with [cURL](http://php.net/manual/en/book.curl.php) extension, * [Guzzle](https://github.com/guzzle/guzzle) library, * (optional) [PHPUnit](https://phpunit.de) to run tests. @@ -27,7 +28,7 @@ Uses [Trello API v1](https://trello.com/docs/index.html). The object API is very The recommended way is using [composer](http://getcomposer.org): ```bash -$ composer require cdaguerre/php-trello-api:@dev +$ composer require matteocacciola/php-trello-api:@dev ``` However, `php-trello-api` follows the PSR-0 naming conventions, which means you can easily integrate `php-trello-api` class loading in your own autoloader. @@ -107,5 +108,6 @@ Feel free to make any comments, file issues or make pull requests. ## Credits +- Forked by [cdaguerre/php-trello-api](https://github.com/cdaguerre/php-trello-api) - Largely inspired by the excellent [php-github-api](https://github.com/KnpLabs/php-github-api) developed by the guys at [KnpLabs](http://knplabs.fr) - Thanks to Trello for the API and documentation. diff --git a/composer.json b/composer.json index 6a139ea..eef28ae 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "matteocacciola/php-trello-api", "type": "library", - "description": "Trello API v1 client", + "description": "Trello API v1.1 client", "homepage": "https://github.com/matteocacciola/php-trello-api", "keywords": ["trello"], "license": "MIT", @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3", + "php": ">=7.4", "guzzlehttp/guzzle": "~5.3" }, "require-dev": { From abeaf34f48824edf714208d37a999a66a08885c2 Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 03:44:36 +0100 Subject: [PATCH 12/18] v1.0.1 --- composer.json | 2 +- lib/Trello/Api/AbstractApi.php | 20 ++--- lib/Trello/Api/Action.php | 22 ++--- lib/Trello/Api/Board.php | 26 +++--- lib/Trello/Api/Board/Actions.php | 2 +- lib/Trello/Api/Board/Cardlists.php | 8 +- lib/Trello/Api/Board/Cards.php | 4 +- lib/Trello/Api/Board/Checklists.php | 4 +- lib/Trello/Api/Board/Labels.php | 8 +- lib/Trello/Api/Board/Members.php | 20 ++--- lib/Trello/Api/Card.php | 32 ++++---- lib/Trello/Api/Card/Actions.php | 4 +- lib/Trello/Api/Card/Attachments.php | 6 +- lib/Trello/Api/Card/Checklists.php | 8 +- lib/Trello/Api/Card/Labels.php | 6 +- lib/Trello/Api/Card/Members.php | 8 +- lib/Trello/Api/Card/Stickers.php | 8 +- lib/Trello/Api/Cardlist.php | 24 +++--- lib/Trello/Api/Cardlist/Actions.php | 2 +- lib/Trello/Api/Cardlist/Cards.php | 10 +-- lib/Trello/Api/Checklist.php | 20 ++--- lib/Trello/Api/Checklist/Cards.php | 4 +- lib/Trello/Api/Checklist/Items.php | 10 +-- lib/Trello/Api/Member.php | 22 ++--- lib/Trello/Api/Member/Actions.php | 2 +- lib/Trello/Api/Member/Boards.php | 8 +- lib/Trello/Api/Member/Cards.php | 4 +- lib/Trello/Api/Member/Notifications.php | 2 +- lib/Trello/Api/Member/Organizations.php | 6 +- lib/Trello/Api/Notification.php | 22 ++--- lib/Trello/Api/Organization.php | 6 +- lib/Trello/Api/Token.php | 8 +- lib/Trello/Api/Token/Webhooks.php | 6 +- lib/Trello/Api/Webhook.php | 22 ++--- lib/Trello/Client.php | 10 +-- lib/Trello/Events.php | 4 +- .../Exception/MissingArgumentException.php | 2 +- lib/Trello/HttpClient/HttpClient.php | 32 ++++---- lib/Trello/HttpClient/HttpClientInterface.php | 12 +-- .../HttpClient/Listener/AuthListener.php | 6 +- .../HttpClient/Listener/ErrorListener.php | 2 +- lib/Trello/Model/AbstractObject.php | 2 +- lib/Trello/Model/Board.php | 6 +- lib/Trello/Model/Card.php | 26 +++--- lib/Trello/Model/Cardlist.php | 6 +- lib/Trello/Model/Checklist.php | 18 ++--- lib/Trello/Model/Member.php | 12 +-- lib/Trello/Model/Organization.php | 6 +- lib/Trello/Model/Token.php | 6 +- .../Trello/Tests/Unit/Api/AbstractApiTest.php | 52 ++++++------ test/Trello/Tests/Unit/Api/ActionTest.php | 36 ++++----- .../Tests/Unit/Api/Board/CardlistsTest.php | 12 +-- .../Trello/Tests/Unit/Api/Board/CardsTest.php | 10 +-- .../Tests/Unit/Api/Board/ChecklistsTest.php | 4 +- .../Tests/Unit/Api/Board/LabelsTest.php | 4 +- .../Tests/Unit/Api/Board/MembersTest.php | 18 ++--- .../Unit/Api/Board/MyPreferencesTest.php | 2 +- .../Tests/Unit/Api/Board/PowerUpsTest.php | 4 +- .../Tests/Unit/Api/Board/PreferencesTest.php | 2 +- test/Trello/Tests/Unit/Api/BoardTest.php | 34 ++++---- .../Tests/Unit/Api/Card/ActionsTest.php | 4 +- .../Tests/Unit/Api/Card/AttachmentsTest.php | 10 +-- .../Tests/Unit/Api/Card/ChecklistsTest.php | 22 ++--- .../Trello/Tests/Unit/Api/Card/LabelsTest.php | 6 +- .../Tests/Unit/Api/Card/MembersTest.php | 12 +-- .../Tests/Unit/Api/Card/StickersTest.php | 34 ++++---- test/Trello/Tests/Unit/Api/CardTest.php | 52 ++++++------ .../Tests/Unit/Api/Cardlist/CardsTest.php | 12 +-- test/Trello/Tests/Unit/Api/CardlistTest.php | 36 ++++----- .../Tests/Unit/Api/Checklist/CardsTest.php | 8 +- .../Tests/Unit/Api/Checklist/ItemsTest.php | 6 +- test/Trello/Tests/Unit/Api/ChecklistTest.php | 36 ++++----- .../Tests/Unit/Api/Member/BoardsTest.php | 16 ++-- .../Tests/Unit/Api/Member/CardsTest.php | 8 +- .../Unit/Api/Member/NotificationsTest.php | 8 +- .../Unit/Api/Member/OrganizationsTest.php | 12 +-- test/Trello/Tests/Unit/Api/MemberTest.php | 24 +++--- .../Tests/Unit/Api/NotificationTest.php | 42 +++++----- .../Tests/Unit/Api/OrganizationTest.php | 2 +- test/Trello/Tests/Unit/Api/TestCase.php | 12 +-- .../Tests/Unit/Api/Token/WebhooksTest.php | 28 +++---- test/Trello/Tests/Unit/Api/TokenTest.php | 10 +-- test/Trello/Tests/Unit/Api/WebhookTest.php | 40 +++++----- test/Trello/Tests/Unit/ClientTest.php | 75 ++++++++--------- .../Tests/Unit/HttpClient/HttpClientTest.php | 80 +++++++++---------- .../HttpClient/Listener/AuthListenerTest.php | 4 +- .../HttpClient/Listener/ErrorListenerTest.php | 39 ++++----- 87 files changed, 669 insertions(+), 663 deletions(-) diff --git a/composer.json b/composer.json index eef28ae..b501712 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "matteocacciola/php-trello-api", "type": "library", - "description": "Trello API v1.1 client", + "description": "Trello API v2 client", "homepage": "https://github.com/matteocacciola/php-trello-api", "keywords": ["trello"], "license": "MIT", diff --git a/lib/Trello/Api/AbstractApi.php b/lib/Trello/Api/AbstractApi.php index fd680af..a8677cb 100644 --- a/lib/Trello/Api/AbstractApi.php +++ b/lib/Trello/Api/AbstractApi.php @@ -112,7 +112,7 @@ public function getField($id, $field) * * @return mixed */ - protected function get($path, array $parameters = array(), $requestHeaders = array()) + protected function get($path, array $parameters = [], $requestHeaders = []) { $response = $this->client->getHttpClient()->get($path, $parameters, $requestHeaders); @@ -128,11 +128,11 @@ protected function get($path, array $parameters = array(), $requestHeaders = arr * * @return \GuzzleHttp\Message\Response */ - protected function head($path, array $parameters = array(), $requestHeaders = array()) + protected function head($path, array $parameters = [], $requestHeaders = []) { - $response = $this->client->getHttpClient()->request($path, null, 'HEAD', $requestHeaders, array( + $response = $this->client->getHttpClient()->request($path, null, 'HEAD', $requestHeaders, [ 'query' => $parameters, - )); + ]); return $response; } @@ -146,7 +146,7 @@ protected function head($path, array $parameters = array(), $requestHeaders = ar * * @return mixed */ - protected function post($path, array $parameters = array(), $requestHeaders = array()) + protected function post($path, array $parameters = [], $requestHeaders = []) { return $this->postRaw( $path, @@ -164,7 +164,7 @@ protected function post($path, array $parameters = array(), $requestHeaders = ar * * @return mixed */ - protected function postRaw($path, $body, $requestHeaders = array()) + protected function postRaw($path, $body, $requestHeaders = []) { $response = $this->client->getHttpClient()->post( $path, @@ -184,7 +184,7 @@ protected function postRaw($path, $body, $requestHeaders = array()) * * @return mixed */ - protected function patch($path, array $parameters = array(), $requestHeaders = array()) + protected function patch($path, array $parameters = [], $requestHeaders = []) { $response = $this->client->getHttpClient()->patch( $path, @@ -204,7 +204,7 @@ protected function patch($path, array $parameters = array(), $requestHeaders = a * * @return mixed */ - protected function put($path, array $parameters = array(), $requestHeaders = array()) + protected function put($path, array $parameters = [], $requestHeaders = []) { foreach ($parameters as $name => $parameter) { if (is_bool($parameter)) { @@ -230,7 +230,7 @@ protected function put($path, array $parameters = array(), $requestHeaders = arr * * @return mixed */ - protected function delete($path, array $parameters = array(), $requestHeaders = array()) + protected function delete($path, array $parameters = [], $requestHeaders = []) { $response = $this->client->getHttpClient()->delete( $path, @@ -310,7 +310,7 @@ protected function validateRequiredParameters(array $required, array $params) protected function validateAllowedParameters(array $allowed, $params, $paramName) { if (!is_array($params)) { - $params = array($params); + $params = [$params]; } foreach ($params as $param) { diff --git a/lib/Trello/Api/Action.php b/lib/Trello/Api/Action.php index 54124fa..1918cf3 100644 --- a/lib/Trello/Api/Action.php +++ b/lib/Trello/Api/Action.php @@ -23,12 +23,12 @@ class Action extends AbstractApi * @link https://trello.com/docs/api/action/#get-1-actions-idaction-field * @var array */ - public static $fields = array( + public static $fields = [ 'idMemberCreator', 'data', 'type', 'date' - ); + ]; /** * Find an action by id @@ -39,7 +39,7 @@ class Action extends AbstractApi * * @return array */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } @@ -53,7 +53,7 @@ public function show($id, array $params = array()) * * @return array list info */ - public function update($id, array $params = array()) + public function update($id, array $params = []) { return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } @@ -80,7 +80,7 @@ public function remove($id) * * @return array */ - public function getBoard($id, array $params = array()) + public function getBoard($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } @@ -112,7 +112,7 @@ public function getBoardField($id, $field) * * @return array */ - public function getList($id, array $params = array()) + public function getList($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/list', $params); } @@ -144,7 +144,7 @@ public function getListField($id, $field) * * @return array */ - public function getCard($id, array $params = array()) + public function getCard($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/card', $params); } @@ -176,7 +176,7 @@ public function getCardField($id, $field) * * @return array */ - public function getMember($id, array $params = array()) + public function getMember($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/member', $params); } @@ -208,7 +208,7 @@ public function getMemberField($id, $field) * * @return array */ - public function getCreator($id, array $params = array()) + public function getCreator($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/memberCreator', $params); } @@ -240,7 +240,7 @@ public function getCreatorField($id, $field) * * @return array */ - public function getOrganization($id, array $params = array()) + public function getOrganization($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/organization', $params); } @@ -274,6 +274,6 @@ public function getOrganizationField($id, $field) */ public function setText($id, $text) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/text', array('value' => $text)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/text', ['value' => $text]); } } diff --git a/lib/Trello/Api/Board.php b/lib/Trello/Api/Board.php index e96ed93..050b5fa 100644 --- a/lib/Trello/Api/Board.php +++ b/lib/Trello/Api/Board.php @@ -29,7 +29,7 @@ class Board extends AbstractApi * @link https://trello.com/docs/api/board/#get-1-boards-board-id-field * @var array */ - public static $fields = array( + public static $fields = [ 'name', 'desc', 'descData', @@ -49,7 +49,7 @@ class Board extends AbstractApi 'dateLastActivity', 'dateLastView', 'shortUrl', - ); + ]; /** * Find a board by id @@ -60,7 +60,7 @@ class Board extends AbstractApi * * @return array board info */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } @@ -73,9 +73,9 @@ public function show($id, array $params = array()) * * @return array board info */ - public function create(array $params = array()) + public function create(array $params = []) { - $this->validateRequiredParameters(array('name'), $params); + $this->validateRequiredParameters(['name'], $params); return $this->post($this->getPath(), $params); } @@ -89,7 +89,7 @@ public function create(array $params = array()) * * @return array */ - public function update($id, array $params = array()) + public function update($id, array $params = []) { return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } @@ -105,7 +105,7 @@ public function update($id, array $params = array()) */ public function setName($id, $name) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', array('value' => $name)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', ['value' => $name]); } /** @@ -119,7 +119,7 @@ public function setName($id, $name) */ public function setDescription($id, $description) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/desc', array('value' => $description)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/desc', ['value' => $description]); } /** @@ -133,7 +133,7 @@ public function setDescription($id, $description) */ public function setClosed($id, $closed = true) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/closed', array('value' => $closed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/closed', ['value' => $closed]); } /** @@ -147,7 +147,7 @@ public function setClosed($id, $closed = true) */ public function setSubscribed($id, $subscribed = true) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/subscribed', array('value' => $subscribed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/subscribed', ['value' => $subscribed]); } /** @@ -173,7 +173,7 @@ public function setOrganization($id, $organizationId) * * @return array */ - public function getOrganization($id, array $params = array()) + public function getOrganization($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/organization', $params); } @@ -203,7 +203,7 @@ public function getOrganizationField($id, $field) * * @return array */ - public function getStars($id, array $params = array()) + public function getStars($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/boardStars', $params); } @@ -217,7 +217,7 @@ public function getStars($id, array $params = array()) * * @return array */ - public function getDeltas($id, array $params = array()) + public function getDeltas($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/deltas', $params); } diff --git a/lib/Trello/Api/Board/Actions.php b/lib/Trello/Api/Board/Actions.php index d7bb401..190b291 100644 --- a/lib/Trello/Api/Board/Actions.php +++ b/lib/Trello/Api/Board/Actions.php @@ -27,7 +27,7 @@ class Actions extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } diff --git a/lib/Trello/Api/Board/Cardlists.php b/lib/Trello/Api/Board/Cardlists.php index 0f43c9c..791e744 100644 --- a/lib/Trello/Api/Board/Cardlists.php +++ b/lib/Trello/Api/Board/Cardlists.php @@ -27,7 +27,7 @@ class Cardlists extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -43,7 +43,7 @@ public function all($id, array $params = array()) */ public function filter($id, $filter = 'all') { - $allowed = array('all', 'none', 'open', 'closed'); + $allowed = ['all', 'none', 'open', 'closed']; $filter = $this->validateAllowedParameters($allowed, $filter, 'filter'); return $this->get($this->getPath($id) . '/' . implode(',', $filter)); @@ -57,9 +57,9 @@ public function filter($id, $filter = 'all') * * @return array */ - public function create($id, array $params = array()) + public function create($id, array $params = []) { - $this->validateRequiredParameters(array('name'), $params); + $this->validateRequiredParameters(['name'], $params); return $this->post($this->getPath($id), $params); } diff --git a/lib/Trello/Api/Board/Cards.php b/lib/Trello/Api/Board/Cards.php index 60340ec..e76adcb 100644 --- a/lib/Trello/Api/Board/Cards.php +++ b/lib/Trello/Api/Board/Cards.php @@ -27,7 +27,7 @@ class Cards extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -43,7 +43,7 @@ public function all($id, array $params = array()) */ public function filter($id, $filter = 'all') { - $allowed = array('all', 'visible', 'none', 'open', 'closed'); + $allowed = ['all', 'visible', 'none', 'open', 'closed']; $filter = $this->validateAllowedParameters($allowed, $filter, 'filter'); return $this->get($this->getPath($id) . '/' . implode(',', $filter)); diff --git a/lib/Trello/Api/Board/Checklists.php b/lib/Trello/Api/Board/Checklists.php index 03403e7..6f86364 100644 --- a/lib/Trello/Api/Board/Checklists.php +++ b/lib/Trello/Api/Board/Checklists.php @@ -27,7 +27,7 @@ class Checklists extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -43,7 +43,7 @@ public function all($id, array $params = array()) */ public function create($id, array $params) { - $this->validateRequiredParameters(array('name'), $params); + $this->validateRequiredParameters(['name'], $params); return $this->post($this->getPath($id), $params); } diff --git a/lib/Trello/Api/Board/Labels.php b/lib/Trello/Api/Board/Labels.php index 320ce88..6a2ae92 100644 --- a/lib/Trello/Api/Board/Labels.php +++ b/lib/Trello/Api/Board/Labels.php @@ -28,7 +28,7 @@ class Labels extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -44,7 +44,7 @@ public function all($id, array $params = array()) */ public function show($id, $color) { - $colors = array('blue', 'green', 'orange', 'purple', 'red', 'yellow'); + $colors = ['blue', 'green', 'orange', 'purple', 'red', 'yellow']; if (!in_array($color, $colors)) { throw new InvalidArgumentException(sprintf( @@ -73,7 +73,7 @@ public function show($id, $color) */ public function setName($id, $color, $name) { - $colors = array('blue', 'green', 'orange', 'purple', 'red', 'yellow'); + $colors = ['blue', 'green', 'orange', 'purple', 'red', 'yellow']; if (!in_array($color, $colors)) { throw new InvalidArgumentException(sprintf( @@ -82,6 +82,6 @@ public function setName($id, $color, $name) )); } - return $this->put('boards/' . rawurlencode($id) . '/labelNames/' . rawurlencode($color), array('value' => $name)); + return $this->put('boards/' . rawurlencode($id) . '/labelNames/' . rawurlencode($color), ['value' => $name]); } } diff --git a/lib/Trello/Api/Board/Members.php b/lib/Trello/Api/Board/Members.php index d98d354..03f3a7f 100644 --- a/lib/Trello/Api/Board/Members.php +++ b/lib/Trello/Api/Board/Members.php @@ -29,7 +29,7 @@ class Members extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -59,7 +59,7 @@ public function remove($id, $memberId) */ public function filter($id, $filter = 'all') { - $allowed = array('none', 'normal', 'admins', 'owners', 'all'); + $allowed = ['none', 'normal', 'admins', 'owners', 'all']; $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); return $this->get($this->getPath($id) . '/' . implode(',', $filters)); @@ -75,7 +75,7 @@ public function filter($id, $filter = 'all') * * @return array */ - public function cards($id, $memberId, array $params = array()) + public function cards($id, $memberId, array $params = []) { return $this->get($this->getPath($id) . '/' . rawurlencode($memberId) . '/cards', $params); } @@ -93,7 +93,7 @@ public function cards($id, $memberId, array $params = array()) */ public function invite($id, $email, $fullName, $role = 'normal') { - $roles = array('normal', 'observer', 'admin'); + $roles = ['normal', 'observer', 'admin']; if (!in_array($role, $roles)) { throw new InvalidArgumentException(sprintf( @@ -102,11 +102,11 @@ public function invite($id, $email, $fullName, $role = 'normal') )); } - $params = array( + $params = [ 'email' => $email, 'fullName' => $fullName, 'type' => $role, - ); + ]; return $this->put($this->getPath($id), $params); } @@ -120,7 +120,7 @@ public function invite($id, $email, $fullName, $role = 'normal') * * @return array */ - public function getInvitedMembers($id, array $params = array()) + public function getInvitedMembers($id, array $params = []) { return $this->get($this->getPath($id) . 'Invited', $params); } @@ -152,7 +152,7 @@ public function getInvitedMembersField($id, $field) */ public function setRole($id, $memberOrOrganization, $role) { - $roles = array('normal', 'observer', 'admin'); + $roles = ['normal', 'observer', 'admin']; if (!in_array($role, $roles)) { throw new InvalidArgumentException(sprintf( @@ -161,10 +161,10 @@ public function setRole($id, $memberOrOrganization, $role) )); } - $params = array( + $params = [ 'idMember' => $memberOrOrganization, 'type' => $role, - ); + ]; return $this->post($this->getPath($id) . '/' . rawurlencode($memberOrOrganization), $params); } diff --git a/lib/Trello/Api/Card.php b/lib/Trello/Api/Card.php index 809e5ad..767a723 100644 --- a/lib/Trello/Api/Card.php +++ b/lib/Trello/Api/Card.php @@ -30,7 +30,7 @@ class Card extends AbstractApi * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-field * @var array */ - public static $fields = array( + public static $fields = [ 'badges', 'checkItemStates', 'closed', @@ -54,7 +54,7 @@ class Card extends AbstractApi 'shortUrl', 'subscribed', 'url', - ); + ]; /** * Find a card by id @@ -65,7 +65,7 @@ class Card extends AbstractApi * * @return array card info */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } @@ -78,9 +78,9 @@ public function show($id, array $params = array()) * * @return array card info */ - public function create(array $params = array()) + public function create(array $params = []) { - $this->validateRequiredParameters(array('idList', 'name'), $params); + $this->validateRequiredParameters(['idList', 'name'], $params); if (!array_key_exists('due', $params)) { $params['due'] = null; @@ -101,7 +101,7 @@ public function create(array $params = array()) * * @return array card info */ - public function update($id, array $params = array()) + public function update($id, array $params = []) { return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } @@ -117,7 +117,7 @@ public function update($id, array $params = array()) */ public function setBoard($id, $boardId) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idBoard', array('value' => $boardId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idBoard', ['value' => $boardId]); } /** @@ -129,7 +129,7 @@ public function setBoard($id, $boardId) * * @return array board info */ - public function getBoard($id, array $params = array()) + public function getBoard($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } @@ -163,7 +163,7 @@ public function getBoardField($id, $field) */ public function setList($id, $listId) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idList', array('value' => $listId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idList', ['value' => $listId]); } /** @@ -175,7 +175,7 @@ public function setList($id, $listId) * * @return array list info */ - public function getList($id, array $params = array()) + public function getList($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/list', $params); } @@ -209,7 +209,7 @@ public function getListField($id, $field) */ public function setName($id, $name) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', array('value' => $name)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', ['value' => $name]); } /** @@ -223,7 +223,7 @@ public function setName($id, $name) */ public function setDescription($id, $description) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/desc', array('value' => $description)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/desc', ['value' => $description]); } /** @@ -237,7 +237,7 @@ public function setDescription($id, $description) */ public function setClosed($id, $closed = true) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/closed', array('value' => $closed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/closed', ['value' => $closed]); } /** @@ -251,7 +251,7 @@ public function setClosed($id, $closed = true) */ public function setDueDate($id, \DateTime $date = null) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/due', array('value' => $date)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/due', ['value' => $date]); } /** @@ -266,7 +266,7 @@ public function setDueDate($id, \DateTime $date = null) */ public function setPosition($id, $position) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/pos', array('value' => $position)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/pos', ['value' => $position]); } /** @@ -280,7 +280,7 @@ public function setPosition($id, $position) */ public function setSubscribed($id, $subscribed) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/subscribed', array('value' => $subscribed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/subscribed', ['value' => $subscribed]); } /** diff --git a/lib/Trello/Api/Card/Actions.php b/lib/Trello/Api/Card/Actions.php index 2081fdd..17d7448 100644 --- a/lib/Trello/Api/Card/Actions.php +++ b/lib/Trello/Api/Card/Actions.php @@ -23,7 +23,7 @@ class Actions extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -39,7 +39,7 @@ public function all($id, array $params = array()) */ public function addComment($id, $text) { - return $this->post($this->getPath($id) . '/comments', array('text' => $text)); + return $this->post($this->getPath($id) . '/comments', ['text' => $text]); } /** diff --git a/lib/Trello/Api/Card/Attachments.php b/lib/Trello/Api/Card/Attachments.php index 33d9fd9..e797a6d 100644 --- a/lib/Trello/Api/Card/Attachments.php +++ b/lib/Trello/Api/Card/Attachments.php @@ -23,7 +23,7 @@ class Attachments extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -39,7 +39,7 @@ public function all($id, array $params = array()) */ public function create($id, array $params) { - $atLeastOneOf = array('url', 'file'); + $atLeastOneOf = ['url', 'file']; $this->validateAtLeastOneOf($atLeastOneOf, $params); return $this->post($this->getPath($id), $params); @@ -84,6 +84,6 @@ public function remove($id, $attachmentId) */ public function setAsCover($id, $attachmentId) { - return $this->put('cards/' . rawurlencode($id) . '/idAttachmentCover', array('value' => $attachmentId)); + return $this->put('cards/' . rawurlencode($id) . '/idAttachmentCover', ['value' => $attachmentId]); } } diff --git a/lib/Trello/Api/Card/Checklists.php b/lib/Trello/Api/Card/Checklists.php index ffb7c24..df3f3a0 100644 --- a/lib/Trello/Api/Card/Checklists.php +++ b/lib/Trello/Api/Card/Checklists.php @@ -24,7 +24,7 @@ class Checklists extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get('cards/' . rawurlencode($id) . '/checklists', $params); } @@ -46,7 +46,7 @@ public function all($id, array $params = array()) */ public function create($id, array $params) { - $atLeastOneOf = array('value', 'name', 'idChecklistSource'); + $atLeastOneOf = ['value', 'name', 'idChecklistSource']; $this->validateAtLeastOneOf($atLeastOneOf, $params); return $this->post($this->getPath($id), $params); @@ -74,7 +74,7 @@ public function remove($id, $checklistId) * * @return array */ - public function itemStates($id, array $params = array()) + public function itemStates($id, array $params = []) { return $this->get('cards/' . rawurlencode($id) . '/checkItemStates', $params); } @@ -109,7 +109,7 @@ public function updateItem($id, $checklistId, $checkItemId, array $data) * * @return array */ - public function createItem($id, $checklistId, $name, array $data = array()) + public function createItem($id, $checklistId, $name, array $data = []) { $data['idChecklist'] = $checklistId; $data['name'] = $name; diff --git a/lib/Trello/Api/Card/Labels.php b/lib/Trello/Api/Card/Labels.php index 55cd226..c083187 100644 --- a/lib/Trello/Api/Card/Labels.php +++ b/lib/Trello/Api/Card/Labels.php @@ -29,14 +29,14 @@ class Labels extends AbstractApi public function set($id, array $labels) { foreach ($labels as $label) { - if (!in_array($label, array('all', 'green', 'yellow', 'orange', 'red', 'purple', 'blue'))) { + if (!in_array($label, ['all', 'green', 'yellow', 'orange', 'red', 'purple', 'blue'])) { throw new InvalidArgumentException(sprintf('Label "%s" does not exist.', $label)); } } $labels = implode(',', $labels); - return $this->put($this->getPath($id), array('value' => $labels)); + return $this->put($this->getPath($id), ['value' => $labels]); } /** @@ -52,7 +52,7 @@ public function set($id, array $labels) */ public function remove($id, $label) { - if (!in_array($label, array('green', 'yellow', 'orange', 'red', 'purple', 'blue'))) { + if (!in_array($label, ['green', 'yellow', 'orange', 'red', 'purple', 'blue'])) { throw new InvalidArgumentException(sprintf('Label "%s" does not exist.', $label)); } diff --git a/lib/Trello/Api/Card/Members.php b/lib/Trello/Api/Card/Members.php index 2877eba..1e8cf86 100644 --- a/lib/Trello/Api/Card/Members.php +++ b/lib/Trello/Api/Card/Members.php @@ -24,7 +24,7 @@ class Members extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -46,7 +46,7 @@ public function set($id, array $members) $members = implode(',', $members); - return $this->put($this->getPath($id), array('value' => $members)); + return $this->put($this->getPath($id), ['value' => $members]); } /** @@ -60,7 +60,7 @@ public function set($id, array $members) */ public function add($id, $memberId) { - return $this->post($this->getPath($id), array('value' => $memberId)); + return $this->post($this->getPath($id), ['value' => $memberId]); } /** @@ -88,7 +88,7 @@ public function remove($id, $memberId) */ public function addVote($id, $memberId) { - return $this->post($this->getPath($id) . '/membersVoted', array('value' => $memberId)); + return $this->post($this->getPath($id) . '/membersVoted', ['value' => $memberId]); } /** diff --git a/lib/Trello/Api/Card/Stickers.php b/lib/Trello/Api/Card/Stickers.php index a2d2ce2..29bcf85 100644 --- a/lib/Trello/Api/Card/Stickers.php +++ b/lib/Trello/Api/Card/Stickers.php @@ -23,7 +23,7 @@ class Stickers extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -48,7 +48,7 @@ public function all($id, array $params = array()) */ public function show($id, $stickerId, $fields = 'all') { - $allowed = array('all', 'image', 'imageScaled', 'imageUrl', 'left', 'rotate', 'top', 'zIndex'); + $allowed = ['all', 'image', 'imageScaled', 'imageUrl', 'left', 'rotate', 'top', 'zIndex']; $fields = $this->validateAllowedParameters($allowed, $fields, 'field'); return $this->get($this->getPath($id) . '/' . rawurlencode($stickerId), $fields); @@ -70,7 +70,7 @@ public function show($id, $stickerId, $fields = 'all') */ public function update($id, $stickerId, array $params) { - $oneOf = array('left', 'rotate', 'top', 'zIndex'); + $oneOf = ['left', 'rotate', 'top', 'zIndex']; $this->validateAtLeastOneOf($oneOf, $params); return $this->put($this->getPath($id) . '/' . rawurlencode($stickerId), $params); @@ -92,7 +92,7 @@ public function update($id, $stickerId, array $params) */ public function create($id, array $params) { - $required = array('image', 'left', 'top', 'zIndex'); + $required = ['image', 'left', 'top', 'zIndex']; $this->validateRequiredParameters($required, $params); return $this->post($this->getPath($id), $params); diff --git a/lib/Trello/Api/Cardlist.php b/lib/Trello/Api/Cardlist.php index dff2c78..d338ddf 100644 --- a/lib/Trello/Api/Cardlist.php +++ b/lib/Trello/Api/Cardlist.php @@ -23,13 +23,13 @@ class Cardlist extends AbstractApi * @link https://trello.com/docs/api/list/#get-1-lists-list-id-or-shortlink-field * @var array */ - public static $fields = array( + public static $fields = [ 'name', 'closed', 'idBoard', 'pos', 'subscribed', - ); + ]; /** * Find a list by id @@ -40,7 +40,7 @@ class Cardlist extends AbstractApi * * @return array list info */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } @@ -54,9 +54,9 @@ public function show($id, array $params = array()) * * @return array */ - public function create(array $params = array()) + public function create(array $params = []) { - $this->validateRequiredParameters(array('name', 'idBoard'), $params); + $this->validateRequiredParameters(['name', 'idBoard'], $params); return $this->post($this->getPath(), $params); } @@ -70,7 +70,7 @@ public function create(array $params = array()) * * @return array list info */ - public function update($id, array $params = array()) + public function update($id, array $params = []) { return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } @@ -86,7 +86,7 @@ public function update($id, array $params = array()) */ public function setBoard($id, $boardId) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idBoard', array('value' => $boardId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idBoard', ['value' => $boardId]); } /** @@ -98,7 +98,7 @@ public function setBoard($id, $boardId) * * @return array board info */ - public function getBoard($id, array $params = array()) + public function getBoard($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } @@ -132,7 +132,7 @@ public function getBoardField($id, $field) */ public function setName($id, $name) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', array('value' => $name)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', ['value' => $name]); } /** @@ -146,7 +146,7 @@ public function setName($id, $name) */ public function setSubscribed($id, $subscribed) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/subscribed', array('value' => $subscribed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/subscribed', ['value' => $subscribed]); } /** @@ -160,7 +160,7 @@ public function setSubscribed($id, $subscribed) */ public function setClosed($id, $closed = true) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/closed', array('value' => $closed)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/closed', ['value' => $closed]); } /** @@ -175,7 +175,7 @@ public function setClosed($id, $closed = true) */ public function setPosition($id, $position) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/pos', array('value' => $position)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/pos', ['value' => $position]); } /** diff --git a/lib/Trello/Api/Cardlist/Actions.php b/lib/Trello/Api/Cardlist/Actions.php index 9434254..3dad993 100644 --- a/lib/Trello/Api/Cardlist/Actions.php +++ b/lib/Trello/Api/Cardlist/Actions.php @@ -23,7 +23,7 @@ class Actions extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } diff --git a/lib/Trello/Api/Cardlist/Cards.php b/lib/Trello/Api/Cardlist/Cards.php index db0e6ec..827aa43 100644 --- a/lib/Trello/Api/Cardlist/Cards.php +++ b/lib/Trello/Api/Cardlist/Cards.php @@ -23,7 +23,7 @@ class Cards extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -39,7 +39,7 @@ public function all($id, array $params = array()) */ public function filter($id, $filter = 'all') { - $allowed = array('none', 'open', 'closed', 'all'); + $allowed = ['none', 'open', 'closed', 'all']; $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); return $this->get($this->getPath($id) . '/' . implode(',', $filters)); @@ -53,7 +53,7 @@ public function filter($id, $filter = 'all') * * @return array card info */ - public function create($id, $name, array $params = array()) + public function create($id, $name, array $params = []) { $params['idList'] = $id; $params['name'] = $name; @@ -90,10 +90,10 @@ public function archiveAll($id) */ public function moveAll($id, $boardId, $destListId) { - $data = array( + $data = [ 'idBoard' => $boardId, 'idList' => $destListId, - ); + ]; return $this->post('lists/' . rawurlencode($id) . '/moveAllCards', $data); } diff --git a/lib/Trello/Api/Checklist.php b/lib/Trello/Api/Checklist.php index ff2577c..7483ab3 100644 --- a/lib/Trello/Api/Checklist.php +++ b/lib/Trello/Api/Checklist.php @@ -23,12 +23,12 @@ class Checklist extends AbstractApi * @link https://trello.com/docs/api/list/#get-1-lists-list-id-or-shortlink-field * @var array */ - public static $fields = array( + public static $fields = [ 'name', 'idBoard', 'idCard', 'pos', - ); + ]; /** * Find a list by id @@ -39,7 +39,7 @@ class Checklist extends AbstractApi * * @return array list info */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } @@ -52,9 +52,9 @@ public function show($id, array $params = array()) * * @return array */ - public function create(array $params = array()) + public function create(array $params = []) { - $this->validateRequiredParameters(array('name', 'idCard'), $params); + $this->validateRequiredParameters(['name', 'idCard'], $params); return $this->post($this->getPath(), $params); } @@ -68,7 +68,7 @@ public function create(array $params = array()) * * @return array list info */ - public function update($id, array $params = array()) + public function update($id, array $params = []) { return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } @@ -95,7 +95,7 @@ public function remove($id) * * @return array board info */ - public function getBoard($id, array $params = array()) + public function getBoard($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } @@ -129,7 +129,7 @@ public function getBoardField($id, $field) */ public function setCard($id, $cardId) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idCard', array('value' => $cardId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idCard', ['value' => $cardId]); } /** @@ -143,7 +143,7 @@ public function setCard($id, $cardId) */ public function setName($id, $name) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', array('value' => $name)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/name', ['value' => $name]); } /** @@ -158,7 +158,7 @@ public function setName($id, $name) */ public function setPosition($id, $position) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/pos', array('value' => $position)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/pos', ['value' => $position]); } /** diff --git a/lib/Trello/Api/Checklist/Cards.php b/lib/Trello/Api/Checklist/Cards.php index 09f595c..f8425f4 100644 --- a/lib/Trello/Api/Checklist/Cards.php +++ b/lib/Trello/Api/Checklist/Cards.php @@ -23,7 +23,7 @@ class Cards extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -39,7 +39,7 @@ public function all($id, array $params = array()) */ public function filter($id, $filter = 'all') { - $allowed = array('none', 'open', 'closed', 'all'); + $allowed = ['none', 'open', 'closed', 'all']; $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); return $this->get($this->getPath($id) . '/' . implode(',', $filters)); diff --git a/lib/Trello/Api/Checklist/Items.php b/lib/Trello/Api/Checklist/Items.php index 61666f7..dd28709 100644 --- a/lib/Trello/Api/Checklist/Items.php +++ b/lib/Trello/Api/Checklist/Items.php @@ -14,13 +14,13 @@ class Items extends AbstractApi { protected $path = 'checklists/#id#/checkItems'; - public static $fields = array( + public static $fields = [ 'name', 'nameData', 'type', 'pos', 'state', - ); + ]; /** * Get items related to a given checklist @@ -31,7 +31,7 @@ class Items extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -47,7 +47,7 @@ public function all($id, array $params = array()) * * @return array */ - public function create($id, $name, $checked = false, array $data = array()) + public function create($id, $name, $checked = false, array $data = []) { $data['checked'] = $checked; $data['name'] = $name; @@ -71,7 +71,7 @@ public function create($id, $name, $checked = false, array $data = array()) */ public function update($id, $itemId, array $data) { - $this->validateRequiredParameters(array('name', 'state'), $data); + $this->validateRequiredParameters(['name', 'state'], $data); $this->remove($id, $itemId); diff --git a/lib/Trello/Api/Member.php b/lib/Trello/Api/Member.php index 04ae359..3476346 100644 --- a/lib/Trello/Api/Member.php +++ b/lib/Trello/Api/Member.php @@ -32,7 +32,7 @@ class Member extends AbstractApi * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-field * @var array */ - public static $fields = array( + public static $fields = [ 'avatarHash', 'bio', 'bioData', @@ -59,7 +59,7 @@ class Member extends AbstractApi 'trophies', 'uploadedAvatarHash', 'premiumFeatures' - ); + ]; /** * Find a member by id or username @@ -70,7 +70,7 @@ class Member extends AbstractApi * * @return array list info */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } @@ -85,7 +85,7 @@ public function show($id, array $params = array()) * * @return array list info */ - public function update($id, array $params = array()) + public function update($id, array $params = []) { return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } @@ -99,7 +99,7 @@ public function update($id, array $params = array()) * * @return array */ - public function getDeltas($id, array $params = array()) + public function getDeltas($id, array $params = []) { return $this->get($this->path . '/' . rawurlencode($id) . '/deltas', $params); } @@ -115,7 +115,7 @@ public function getDeltas($id, array $params = array()) */ public function setAvatarSource($id, $avatarSource) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/avatarSource', array('value' => $avatarSource)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/avatarSource', ['value' => $avatarSource]); } /** @@ -129,7 +129,7 @@ public function setAvatarSource($id, $avatarSource) */ public function setBio($id, $bio) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/bio', array('value' => $bio)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/bio', ['value' => $bio]); } /** @@ -143,7 +143,7 @@ public function setBio($id, $bio) */ public function setFullName($id, $fullName) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/fullName', array('value' => $fullName)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/fullName', ['value' => $fullName]); } /** @@ -157,7 +157,7 @@ public function setFullName($id, $fullName) */ public function setInitials($id, $initials) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/initials', array('value' => $initials)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/initials', ['value' => $initials]); } /** @@ -171,7 +171,7 @@ public function setInitials($id, $initials) */ public function setUsername($id, $username) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/username', array('value' => $username)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/username', ['value' => $username]); } /** @@ -184,7 +184,7 @@ public function setUsername($id, $username) */ public function setAvatar($id, $file) { - return $this->post($this->getPath() . '/' . rawurlencode($id) . '/avatar', array('file' => $file)); + return $this->post($this->getPath() . '/' . rawurlencode($id) . '/avatar', ['file' => $file]); } /** diff --git a/lib/Trello/Api/Member/Actions.php b/lib/Trello/Api/Member/Actions.php index 3777b33..7adce33 100644 --- a/lib/Trello/Api/Member/Actions.php +++ b/lib/Trello/Api/Member/Actions.php @@ -23,7 +23,7 @@ class Actions extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } diff --git a/lib/Trello/Api/Member/Boards.php b/lib/Trello/Api/Member/Boards.php index 4cf9fb3..b7bffa2 100644 --- a/lib/Trello/Api/Member/Boards.php +++ b/lib/Trello/Api/Member/Boards.php @@ -26,7 +26,7 @@ class Boards extends AbstractApi * * @return array */ - public function all($id = "me", array $params = array()) + public function all($id = "me", array $params = []) { return $this->get($this->getPath($id), $params); } @@ -42,7 +42,7 @@ public function all($id = "me", array $params = array()) */ public function filter($id, $filter = 'all') { - $allowed = array('all', 'members', 'organization', 'public', 'open', 'closed', 'pinned', 'unpinned', 'starred'); + $allowed = ['all', 'members', 'organization', 'public', 'open', 'closed', 'pinned', 'unpinned', 'starred']; $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); return $this->get($this->getPath($id) . '/' . implode(',', $filters)); @@ -57,7 +57,7 @@ public function filter($id, $filter = 'all') * * @return array */ - public function invitedTo($id, array $params = array()) + public function invitedTo($id, array $params = []) { return $this->get($this->getPath($id) . 'Invited', $params); } @@ -88,7 +88,7 @@ public function invitedToField($id, $field) */ public function pin($id, $boardId) { - return $this->post('members/' . rawurlencode($id) . '/idBoardsPinned', array('value' => $boardId)); + return $this->post('members/' . rawurlencode($id) . '/idBoardsPinned', ['value' => $boardId]); } /** diff --git a/lib/Trello/Api/Member/Cards.php b/lib/Trello/Api/Member/Cards.php index 1734b82..71565b7 100644 --- a/lib/Trello/Api/Member/Cards.php +++ b/lib/Trello/Api/Member/Cards.php @@ -23,7 +23,7 @@ class Cards extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -39,7 +39,7 @@ public function all($id, array $params = array()) */ public function filter($id, $filter = 'all') { - $allowed = array('none', 'visible', 'open', 'closed', 'all'); + $allowed = ['none', 'visible', 'open', 'closed', 'all']; $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); return $this->get($this->getPath($id) . '/' . implode(',', $filters)); diff --git a/lib/Trello/Api/Member/Notifications.php b/lib/Trello/Api/Member/Notifications.php index 7f70439..575c04d 100644 --- a/lib/Trello/Api/Member/Notifications.php +++ b/lib/Trello/Api/Member/Notifications.php @@ -24,7 +24,7 @@ class Notifications extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } diff --git a/lib/Trello/Api/Member/Organizations.php b/lib/Trello/Api/Member/Organizations.php index 7c29676..4029209 100644 --- a/lib/Trello/Api/Member/Organizations.php +++ b/lib/Trello/Api/Member/Organizations.php @@ -24,7 +24,7 @@ class Organizations extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -40,7 +40,7 @@ public function all($id, array $params = array()) */ public function filter($id, $filter = 'all') { - $allowed = array('all', 'none', 'members', 'public'); + $allowed = ['all', 'none', 'members', 'public']; $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); return $this->get($this->getPath($id) . '/' . implode(',', $filters)); @@ -55,7 +55,7 @@ public function filter($id, $filter = 'all') * * @return array */ - public function invitedTo($id, array $params = array()) + public function invitedTo($id, array $params = []) { return $this->get($this->getPath($id) . 'Invited', $params); } diff --git a/lib/Trello/Api/Notification.php b/lib/Trello/Api/Notification.php index 6e34634..b52306a 100644 --- a/lib/Trello/Api/Notification.php +++ b/lib/Trello/Api/Notification.php @@ -23,13 +23,13 @@ class Notification extends AbstractApi * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-field * @var array */ - public static $fields = array( + public static $fields = [ 'unread', 'type', 'date', 'data', 'idMemberCreator', - ); + ]; /** * Find a notification by id @@ -40,7 +40,7 @@ class Notification extends AbstractApi * * @return array */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } @@ -70,7 +70,7 @@ public function update($id, array $data) */ public function setUnread($id, $status) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/unread', array('value' => $status)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/unread', ['value' => $status]); } /** @@ -93,7 +93,7 @@ public function setAllRead() * * @return array */ - public function getEntities($id, array $params = array()) + public function getEntities($id, array $params = []) { return $this->get($this->path . '/' . rawurlencode($id) . '/entities', $params); } @@ -107,7 +107,7 @@ public function getEntities($id, array $params = array()) * * @return array */ - public function getBoard($id, array $params = array()) + public function getBoard($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/board', $params); } @@ -139,7 +139,7 @@ public function getBoardField($id, $field) * * @return array */ - public function getList($id, array $params = array()) + public function getList($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/list', $params); } @@ -171,7 +171,7 @@ public function getListField($id, $field) * * @return array */ - public function getCard($id, array $params = array()) + public function getCard($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/card', $params); } @@ -203,7 +203,7 @@ public function getCardField($id, $field) * * @return array */ - public function getMember($id, array $params = array()) + public function getMember($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/member', $params); } @@ -235,7 +235,7 @@ public function getMemberField($id, $field) * * @return array */ - public function getCreator($id, array $params = array()) + public function getCreator($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/memberCreator', $params); } @@ -267,7 +267,7 @@ public function getCreatorField($id, $field) * * @return array */ - public function getOrganization($id, array $params = array()) + public function getOrganization($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/organization', $params); } diff --git a/lib/Trello/Api/Organization.php b/lib/Trello/Api/Organization.php index f99498d..5fb2d3d 100644 --- a/lib/Trello/Api/Organization.php +++ b/lib/Trello/Api/Organization.php @@ -21,7 +21,7 @@ class Organization extends AbstractApi * @link https://trello.com/docs/api/organization/#get-1-organizations-idorg-or-name-field * @var array */ - public static $fields = array( + public static $fields = [ 'name', 'displayName', 'desc', @@ -38,7 +38,7 @@ class Organization extends AbstractApi 'website', 'logoHash', 'premiumFeatures' - ); + ]; /** * Find an organization by id @@ -49,7 +49,7 @@ class Organization extends AbstractApi * * @return array */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } diff --git a/lib/Trello/Api/Token.php b/lib/Trello/Api/Token.php index fdb0123..7036f54 100644 --- a/lib/Trello/Api/Token.php +++ b/lib/Trello/Api/Token.php @@ -21,13 +21,13 @@ class Token extends AbstractApi * @link https://trello.com/docs/api/token/#get-1-tokens-token-field * @var array */ - public static $fields = array( + public static $fields = [ 'identifier', 'idMember', 'dateCreated', 'dateExpires', 'permissions' - ); + ]; /** * Find a token by id @@ -38,7 +38,7 @@ class Token extends AbstractApi * * @return array */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } @@ -65,7 +65,7 @@ public function remove($id) * * @return array */ - public function getMember($id, array $params = array()) + public function getMember($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id) . '/member', $params); } diff --git a/lib/Trello/Api/Token/Webhooks.php b/lib/Trello/Api/Token/Webhooks.php index bcf918e..b12f724 100644 --- a/lib/Trello/Api/Token/Webhooks.php +++ b/lib/Trello/Api/Token/Webhooks.php @@ -23,7 +23,7 @@ class Webhooks extends AbstractApi * * @return array */ - public function all($id, array $params = array()) + public function all($id, array $params = []) { return $this->get($this->getPath($id), $params); } @@ -53,7 +53,7 @@ public function show($id, $webhookId) */ public function create($id, array $params) { - $this->validateRequiredParameters(array('callbackURL', 'idModel'), $params); + $this->validateRequiredParameters(['callbackURL', 'idModel'], $params); return $this->post($this->getPath($id), $params); } @@ -69,7 +69,7 @@ public function create($id, array $params) */ public function update($id, array $params) { - $this->validateRequiredParameters(array('callbackURL', 'idModel'), $params); + $this->validateRequiredParameters(['callbackURL', 'idModel'], $params); return $this->put($this->getPath($id), $params); } diff --git a/lib/Trello/Api/Webhook.php b/lib/Trello/Api/Webhook.php index da2a05c..0abf018 100644 --- a/lib/Trello/Api/Webhook.php +++ b/lib/Trello/Api/Webhook.php @@ -22,12 +22,12 @@ class Webhook extends AbstractApi * @link https://trello.com/docs/api/webhook/#get-1-webhooks-idwebhook-field * @var array */ - public static $fields = array( + public static $fields = [ 'description', 'idModel', 'callbackURL', 'active', - ); + ]; /** * Find a webhook by id @@ -38,7 +38,7 @@ class Webhook extends AbstractApi * * @return array */ - public function show($id, array $params = array()) + public function show($id, array $params = []) { return $this->get($this->getPath() . '/' . rawurlencode($id), $params); } @@ -51,9 +51,9 @@ public function show($id, array $params = array()) * * @return array */ - public function create(array $params = array()) + public function create(array $params = []) { - $this->validateRequiredParameters(array('callbackURL', 'idModel'), $params); + $this->validateRequiredParameters(['callbackURL', 'idModel'], $params); return $this->post($this->getPath(), $params); } @@ -67,9 +67,9 @@ public function create(array $params = array()) * * @return array */ - public function update($id, array $params = array()) + public function update($id, array $params = []) { - $this->validateRequiredParameters(array('callbackURL', 'idModel'), $params); + $this->validateRequiredParameters(['callbackURL', 'idModel'], $params); return $this->put($this->getPath() . '/' . rawurlencode($id), $params); } @@ -98,7 +98,7 @@ public function remove($id) */ public function setCallbackUrl($id, $url) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/callbackUrl', array('value' => $url)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/callbackUrl', ['value' => $url]); } /** @@ -112,7 +112,7 @@ public function setCallbackUrl($id, $url) */ public function setDescription($id, $description) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/description', array('value' => $description)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/description', ['value' => $description]); } /** @@ -126,7 +126,7 @@ public function setDescription($id, $description) */ public function setModel($id, $modelId) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idModel', array('value' => $modelId)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/idModel', ['value' => $modelId]); } /** @@ -140,6 +140,6 @@ public function setModel($id, $modelId) */ public function setActive($id, $active) { - return $this->put($this->getPath() . '/' . rawurlencode($id) . '/active', array('value' => $active)); + return $this->put($this->getPath() . '/' . rawurlencode($id) . '/active', ['value' => $active]); } } diff --git a/lib/Trello/Client.php b/lib/Trello/Client.php index 257c776..6fca2aa 100644 --- a/lib/Trello/Client.php +++ b/lib/Trello/Client.php @@ -59,14 +59,14 @@ class Client implements ClientInterface /** * @var array */ - private $options = array( + private $options = [ 'base_url' => 'https://api.trello.com/', 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', 'timeout' => 10, 'api_limit' => 5000, 'api_version' => 1, 'cache_dir' => null, - ); + ]; /** * The Buzz instance used to communicate with Trello @@ -159,12 +159,12 @@ public function authenticate($tokenOrLogin, $password = null, $authMethod = null throw new InvalidArgumentException('You need to specify authentication method!'); } - if (null === $authMethod && in_array($password, array( + if (null === $authMethod && in_array($password, [ self::AUTH_URL_TOKEN, self::AUTH_URL_CLIENT_ID, self::AUTH_HTTP_PASSWORD, self::AUTH_HTTP_TOKEN - ))) { + ])) { $authMethod = $password; $password = null; } @@ -265,7 +265,7 @@ public function setOption($name, $value) */ public function getSupportedApiVersions() { - return array(1); + return [1]; } /** diff --git a/lib/Trello/Events.php b/lib/Trello/Events.php index eeab203..20cee53 100644 --- a/lib/Trello/Events.php +++ b/lib/Trello/Events.php @@ -368,7 +368,7 @@ final class Events public static function all() { - return array( + return [ self::BOARD_CREATE, self::BOARD_UPDATE, self::BOARD_COPY, @@ -422,6 +422,6 @@ public static function all() self::MEMBER_UPDATE, self::POWERUP_ENABLE, self::POWERUP_DISABLE, - ); + ]; } } diff --git a/lib/Trello/Exception/MissingArgumentException.php b/lib/Trello/Exception/MissingArgumentException.php index b278419..990b9a7 100644 --- a/lib/Trello/Exception/MissingArgumentException.php +++ b/lib/Trello/Exception/MissingArgumentException.php @@ -15,7 +15,7 @@ class MissingArgumentException extends ErrorException public function __construct($required, $code = 0, $previous = null) { if (is_string($required)) { - $required = array($required); + $required = [$required]; } parent::__construct(sprintf('One or more of required ("%s") parameters are missing!', implode('", "', $required)), $code, $previous); diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index 730d5f0..cad6776 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -14,19 +14,19 @@ class HttpClient implements HttpClientInterface { - protected $options = array( + protected $options = [ 'base_url' => 'https://api.trello.com/', 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', 'timeout' => 10, 'api_version' => 1, - ); + ]; /** * @var ClientInterface */ protected $client; - protected $headers = array(); + protected $headers = []; private $lastResponse; private $lastRequest; @@ -35,13 +35,13 @@ class HttpClient implements HttpClientInterface * @param array $options * @param ClientInterface $client */ - public function __construct(array $options = array(), ClientInterface $client = null) + public function __construct(array $options = [], ClientInterface $client = null) { $this->options = array_merge($this->options, $options); $client = $client ?: new GuzzleClient($this->options); $this->client = $client; - $this->addListener('request.error', array(new ErrorListener(), 'onRequestError')); + $this->addListener('request.error', [new ErrorListener(), 'onRequestError']); $this->clearHeaders(); } @@ -66,10 +66,10 @@ public function setHeaders(array $headers) */ public function clearHeaders() { - $this->headers = array( + $this->headers = [ 'Accept' => sprintf('application/vnd.orcid.%s+json', $this->options['api_version']), 'User-Agent' => sprintf('%s', $this->options['user_agent']), - ); + ]; } /** @@ -89,7 +89,7 @@ public function addSubscriber(EventSubscriberInterface $subscriber) /** * {@inheritDoc} */ - public function get($path, array $parameters = array(), array $headers = array()) + public function get($path, array $parameters = [], array $headers = []) { return $this->request($path, $parameters, 'GET', $headers); } @@ -97,7 +97,7 @@ public function get($path, array $parameters = array(), array $headers = array() /** * {@inheritDoc} */ - public function post($path, $body = null, array $headers = array()) + public function post($path, $body = null, array $headers = []) { if (!isset($headers['Content-Type'])) { $headers['Content-Type'] = 'application/x-www-form-urlencoded'; @@ -109,7 +109,7 @@ public function post($path, $body = null, array $headers = array()) /** * {@inheritDoc} */ - public function patch($path, $body = null, array $headers = array()) + public function patch($path, $body = null, array $headers = []) { if (!isset($headers['Content-Type'])) { $headers['Content-Type'] = 'application/x-www-form-urlencoded'; @@ -121,7 +121,7 @@ public function patch($path, $body = null, array $headers = array()) /** * {@inheritDoc} */ - public function delete($path, $body = null, array $headers = array()) + public function delete($path, $body = null, array $headers = []) { return $this->request($path, $body, 'DELETE', $headers); } @@ -129,7 +129,7 @@ public function delete($path, $body = null, array $headers = array()) /** * {@inheritDoc} */ - public function put($path, $body, array $headers = array()) + public function put($path, $body, array $headers = []) { if (!isset($headers['Content-Type'])) { $headers['Content-Type'] = 'application/x-www-form-urlencoded'; @@ -141,7 +141,7 @@ public function put($path, $body, array $headers = array()) /** * {@inheritDoc} */ - public function request($path, $body = null, $httpMethod = 'GET', array $headers = array(), array $options = array()) + public function request($path, $body = null, $httpMethod = 'GET', array $headers = [], array $options = []) { $request = $this->createRequest($httpMethod, $path, $body, $headers, $options); @@ -164,10 +164,10 @@ public function request($path, $body = null, $httpMethod = 'GET', array $headers */ public function authenticate($tokenOrLogin, $password, $method) { - $this->addListener('request.before_send', array( + $this->addListener('request.before_send', [ new AuthListener($tokenOrLogin, $password, $method), 'onRequestBeforeSend', - )); + ]); } /** @@ -192,7 +192,7 @@ public function getLastResponse() * * @return Request|\GuzzleHttp\Message\RequestInterface */ - protected function createRequest($httpMethod, $path, $body = null, array $headers = array(), array $options = array()) + protected function createRequest($httpMethod, $path, $body = null, array $headers = [], array $options = []) { $path = $this->options['api_version'] . '/' . $path; diff --git a/lib/Trello/HttpClient/HttpClientInterface.php b/lib/Trello/HttpClient/HttpClientInterface.php index d7b8dcb..9cd2310 100644 --- a/lib/Trello/HttpClient/HttpClientInterface.php +++ b/lib/Trello/HttpClient/HttpClientInterface.php @@ -16,7 +16,7 @@ interface HttpClientInterface * * @return Response */ - public function get($path, array $parameters = array(), array $headers = array()); + public function get($path, array $parameters = [], array $headers = []); /** * Send a POST request @@ -27,7 +27,7 @@ public function get($path, array $parameters = array(), array $headers = array() * * @return Response */ - public function post($path, $body = null, array $headers = array()); + public function post($path, $body = null, array $headers = []); /** * Send a PATCH request @@ -39,7 +39,7 @@ public function post($path, $body = null, array $headers = array()); * @return Response * @internal param array $parameters Request body */ - public function patch($path, $body = null, array $headers = array()); + public function patch($path, $body = null, array $headers = []); /** * Send a PUT request @@ -50,7 +50,7 @@ public function patch($path, $body = null, array $headers = array()); * * @return Response */ - public function put($path, $body, array $headers = array()); + public function put($path, $body, array $headers = []); /** * Send a DELETE request @@ -61,7 +61,7 @@ public function put($path, $body, array $headers = array()); * * @return Response */ - public function delete($path, $body = null, array $headers = array()); + public function delete($path, $body = null, array $headers = []); /** * Send a request to the server, receive a response, @@ -74,7 +74,7 @@ public function delete($path, $body = null, array $headers = array()); * * @return Response */ - public function request($path, $body, $httpMethod = 'GET', array $headers = array()); + public function request($path, $body, $httpMethod = 'GET', array $headers = []); /** * Change an option value. diff --git a/lib/Trello/HttpClient/Listener/AuthListener.php b/lib/Trello/HttpClient/Listener/AuthListener.php index 93d252a..3da1af8 100644 --- a/lib/Trello/HttpClient/Listener/AuthListener.php +++ b/lib/Trello/HttpClient/Listener/AuthListener.php @@ -49,10 +49,10 @@ public function onRequestBeforeSend(Event $event) case Client::AUTH_URL_CLIENT_ID: $url = $event['request']->getUrl(); - $parameters = array( + $parameters = [ 'key' => $this->tokenOrLogin, 'token' => $this->password, - ); + ]; $url .= (false === strpos($url, '?') ? '?' : '&'); $url .= utf8_encode(http_build_query($parameters, '', '&')); @@ -64,7 +64,7 @@ public function onRequestBeforeSend(Event $event) $url = $event['request']->getUrl(); $url .= (false === strpos($url, '?') ? '?' : '&'); $url .= utf8_encode(http_build_query( - array('token' => $this->tokenOrLogin, 'key' => $this->password), + ['token' => $this->tokenOrLogin, 'key' => $this->password], '', '&' )); diff --git a/lib/Trello/HttpClient/Listener/ErrorListener.php b/lib/Trello/HttpClient/Listener/ErrorListener.php index 9982aec..2074759 100644 --- a/lib/Trello/HttpClient/Listener/ErrorListener.php +++ b/lib/Trello/HttpClient/Listener/ErrorListener.php @@ -44,7 +44,7 @@ public function onRequestError(Event $event) } if (422 == $response->getStatusCode() && isset($content['errors'])) { - $errors = array(); + $errors = []; foreach ($content['errors'] as $error) { switch ($error['code']) { case 'missing': diff --git a/lib/Trello/Model/AbstractObject.php b/lib/Trello/Model/AbstractObject.php index 0d7ed7f..83ab1e2 100644 --- a/lib/Trello/Model/AbstractObject.php +++ b/lib/Trello/Model/AbstractObject.php @@ -37,7 +37,7 @@ abstract class AbstractObject * * @var array */ - protected $loadParams = array('fields' => 'all'); + protected $loadParams = ['fields' => 'all']; /** * @var string diff --git a/lib/Trello/Model/Board.php b/lib/Trello/Model/Board.php index 0553bbc..22809ac 100644 --- a/lib/Trello/Model/Board.php +++ b/lib/Trello/Model/Board.php @@ -11,7 +11,7 @@ class Board extends AbstractObject implements BoardInterface { protected $apiName = 'board'; - protected $loadParams = array( + protected $loadParams = [ 'fields' => 'all', 'organization' => true, 'organization_memberships' => 'all', @@ -19,7 +19,7 @@ class Board extends AbstractObject implements BoardInterface 'membersInvited' => 'all', 'memberships' => 'all', 'lists' => 'all', - ); + ]; /** * {@inheritdoc} @@ -128,7 +128,7 @@ public function getOrganization() */ public function getLists() { - $lists = array(); + $lists = []; foreach ($this->data['lists'] as $data) { $lists[$data['id']] = new Cardlist($this->client, $data['id']); diff --git a/lib/Trello/Model/Card.php b/lib/Trello/Model/Card.php index 101d3a7..ffd783f 100644 --- a/lib/Trello/Model/Card.php +++ b/lib/Trello/Model/Card.php @@ -13,7 +13,7 @@ class Card extends AbstractObject implements CardInterface { protected $apiName = 'card'; - protected $loadParams = array( + protected $loadParams = [ 'fields' => 'all', 'board' => true, 'list' => true, @@ -24,11 +24,11 @@ class Card extends AbstractObject implements CardInterface 'checklists' => 'all', 'checkItemStates' => true, 'actions' => Events::CARD_COMMENT, - ); + ]; - protected $newChecklists = array(); - protected $newComments = array(); - protected $commentsToBeRemoved = array(); + protected $newChecklists = []; + protected $newComments = []; + protected $commentsToBeRemoved = []; /** * {@inheritdoc} @@ -327,7 +327,7 @@ public function getChecklistIds() */ public function setChecklists(array $checklists) { - $ids = array(); + $ids = []; foreach ($checklists as $checklist) { $ids[] = $checklist->getId(); @@ -341,7 +341,7 @@ public function setChecklists(array $checklists) */ public function getChecklists() { - $checklists = array(); + $checklists = []; foreach ($this->getChecklistIds() as $id) { $checklists[] = new Checklist($this->client, $id); @@ -523,7 +523,7 @@ public function removeMember(MemberInterface $member) */ public function setMembers(array $members) { - $ids = array(); + $ids = []; foreach ($members as $member) { $ids[] = $member->getId(); @@ -537,7 +537,7 @@ public function setMembers(array $members) */ public function getMembers() { - $members = array(); + $members = []; foreach ($this->getMemberIds() as $id) { $members[] = new Member($this->client, $id); @@ -617,7 +617,7 @@ public function removeMemberVoted(MemberInterface $member) */ public function setMembersVoted(array $members) { - $ids = array(); + $ids = []; foreach ($members as $member) { $ids[] = $member->getId(); @@ -631,7 +631,7 @@ public function setMembersVoted(array $members) */ public function getMembersVoted() { - $members = array(); + $members = []; foreach ($this->getMembersVotedIds() as $id) { $members[] = new Member($this->client, $id); @@ -725,7 +725,7 @@ public function addLabel($color) )); } - $this->data['labels'][] = array('color' => $color); + $this->data['labels'][] = ['color' => $color]; return $this; } @@ -781,7 +781,7 @@ public function getDateOfLastActivity() /** * {@inheritdoc} */ - public function getActions($params = array()) + public function getActions($params = []) { return $this->api->actions()->all($this->id, $params); } diff --git a/lib/Trello/Model/Cardlist.php b/lib/Trello/Model/Cardlist.php index ba18090..5c824cd 100644 --- a/lib/Trello/Model/Cardlist.php +++ b/lib/Trello/Model/Cardlist.php @@ -9,10 +9,10 @@ class Cardlist extends AbstractObject implements CardlistInterface { protected $apiName = 'list'; - protected $loadParams = array( + protected $loadParams = [ 'cards' => 'all', 'fields' => 'all', - ); + ]; /** * {@inheritdoc} @@ -125,7 +125,7 @@ public function isSubscribed() */ public function getCards() { - $cards = array(); + $cards = []; foreach ($this->data['cards'] as $card) { $cards[] = new Card($this->client, $card['id']); diff --git a/lib/Trello/Model/Checklist.php b/lib/Trello/Model/Checklist.php index ec2d37c..bd591a9 100644 --- a/lib/Trello/Model/Checklist.php +++ b/lib/Trello/Model/Checklist.php @@ -12,20 +12,20 @@ class Checklist extends AbstractObject implements ChecklistInterface { protected $apiName = 'checklist'; - protected $loadParams = array( + protected $loadParams = [ 'fields' => 'all', 'checkItems' => 'all', 'checkItem_fields' => 'all', - ); + ]; - protected $itemsToBeRemoved = array(); + protected $itemsToBeRemoved = []; public function __construct(ClientInterface $client, $id = null) { - $this->data = array( + $this->data = [ 'name' => null, - 'checkItems' => array(), - ); + 'checkItems' => [], + ]; parent::__construct($client, $id); } @@ -205,11 +205,11 @@ public function setItem($nameOrId, $checked = null, $position = null) $this->data['checkItems'][$key]['position'] = $position; } } else { - $this->data['checkItems'][] = array( + $this->data['checkItems'][] = [ 'name' => $nameOrId, 'state' => $checked, 'position' => $position, - ); + ]; } return $this; @@ -242,7 +242,7 @@ public function isItemChecked($nameOrId) protected function postRefresh() { foreach ($this->data['checkItems'] as $key => $item) { - $this->data['checkItems'][$key]['state'] = in_array($item['state'], array(true, 'complete', 'true')); + $this->data['checkItems'][$key]['state'] = in_array($item['state'], [true, 'complete', 'true']); } } diff --git a/lib/Trello/Model/Member.php b/lib/Trello/Model/Member.php index 59c0d9a..bbbd505 100644 --- a/lib/Trello/Model/Member.php +++ b/lib/Trello/Model/Member.php @@ -11,9 +11,9 @@ class Member extends AbstractObject implements MemberInterface { protected $apiName = 'member'; - protected $loadParams = array( + protected $loadParams = [ 'fields' => 'all', - ); + ]; /** * {@inheritdoc} @@ -136,7 +136,7 @@ public function getInitials() */ public function setMemberType($memberType) { - if (!in_array($memberType, array('admin', 'normal', 'observer'))) { + if (!in_array($memberType, ['admin', 'normal', 'observer'])) { throw new InvalidArgumentException(sprintf( 'The member type %s does not exist.', $memberType @@ -305,7 +305,7 @@ public function getBoardIds() */ public function getBoards() { - $boards = array(); + $boards = []; foreach ($this->data['idBoards'] as $boardId) { $boards[] = new Board($this->client, $boardId); @@ -337,7 +337,7 @@ public function getPinnedBoardIds() */ public function getPinnedBoards() { - $boards = array(); + $boards = []; foreach ($this->data['idBoardsPinned'] as $boardId) { $boards[] = new Board($this->client, $boardId); @@ -369,7 +369,7 @@ public function getOrganizationIds() */ public function getOrganizations() { - $organizations = array(); + $organizations = []; foreach ($this->data['idOrganizations'] as $organizationId) { $organizations[] = new Organization($this->client, $organizationId); diff --git a/lib/Trello/Model/Organization.php b/lib/Trello/Model/Organization.php index ab2ce48..b0d7f2a 100644 --- a/lib/Trello/Model/Organization.php +++ b/lib/Trello/Model/Organization.php @@ -9,11 +9,11 @@ class Organization extends AbstractObject implements OrganizationInterface { protected $apiName = 'organization'; - protected $loadParams = array( + protected $loadParams = [ 'fields' => 'all', 'members' => 'all', 'membersInvited' => 'all', - ); + ]; /** * {@inheritdoc} @@ -110,7 +110,7 @@ public function getBoardIds() */ public function getBoards() { - $boards = array(); + $boards = []; foreach ($this->data['idBoards'] as $boardId) { $boards[] = new Board($this->client, $boardId); diff --git a/lib/Trello/Model/Token.php b/lib/Trello/Model/Token.php index a4dd2f9..b5e8745 100644 --- a/lib/Trello/Model/Token.php +++ b/lib/Trello/Model/Token.php @@ -9,10 +9,10 @@ class Token extends AbstractObject implements TokenInterface { protected $apiName = 'token'; - protected $loadParams = array( + protected $loadParams = [ 'fields' => 'all', 'webhooks' => true, - ); + ]; /** * {@inheritdoc} @@ -67,7 +67,7 @@ public function getPermissions() */ public function getWebhooks() { - $webhooks = array(); + $webhooks = []; foreach ($this->data['webhooks'] as $webhook) { $webhooks[] = new Webhook($this->client, $webhook['id']); diff --git a/test/Trello/Tests/Unit/Api/AbstractApiTest.php b/test/Trello/Tests/Unit/Api/AbstractApiTest.php index 5351bd2..0285b37 100644 --- a/test/Trello/Tests/Unit/Api/AbstractApiTest.php +++ b/test/Trello/Tests/Unit/Api/AbstractApiTest.php @@ -11,20 +11,20 @@ class AbstractApiTest extends \PHPUnit_Framework_TestCase */ public function shouldPassGETRequestToClient() { - $expectedArray = array('value'); + $expectedArray = ['value']; $httpClient = $this->getHttpMock(); $httpClient ->expects($this->any()) ->method('get') - ->with('/path', array('param1' => 'param1value'), array('header1' => 'header1value')) + ->with('/path', ['param1' => 'param1value'], ['header1' => 'header1value']) ->will($this->returnValue($expectedArray)); $client = $this->getClientMock(); $client->setHttpClient($httpClient); $api = $this->getAbstractApiObject($client); - $this->assertEquals($expectedArray, $api->get('/path', array('param1' => 'param1value'), array('header1' => 'header1value'))); + $this->assertEquals($expectedArray, $api->get('/path', ['param1' => 'param1value'], ['header1' => 'header1value'])); } /** @@ -32,20 +32,20 @@ public function shouldPassGETRequestToClient() */ public function shouldPassPOSTRequestToClient() { - $expectedArray = array('value'); + $expectedArray = ['value']; $httpClient = $this->getHttpMock(); $httpClient ->expects($this->once()) ->method('post') - ->with('/path', array('param1' => 'param1value'), array('option1' => 'option1value')) + ->with('/path', ['param1' => 'param1value'], ['option1' => 'option1value']) ->will($this->returnValue($expectedArray)); $client = $this->getClientMock(); $client->setHttpClient($httpClient); $api = $this->getAbstractApiObject($client); - $this->assertEquals($expectedArray, $api->post('/path', array('param1' => 'param1value'), array('option1' => 'option1value'))); + $this->assertEquals($expectedArray, $api->post('/path', ['param1' => 'param1value'], ['option1' => 'option1value'])); } /** @@ -53,20 +53,20 @@ public function shouldPassPOSTRequestToClient() */ public function shouldPassPATCHRequestToClient() { - $expectedArray = array('value'); + $expectedArray = ['value']; $httpClient = $this->getHttpMock(); $httpClient ->expects($this->once()) ->method('patch') - ->with('/path', array('param1' => 'param1value'), array('option1' => 'option1value')) + ->with('/path', ['param1' => 'param1value'], ['option1' => 'option1value']) ->will($this->returnValue($expectedArray)); $client = $this->getClientMock(); $client->setHttpClient($httpClient); $api = $this->getAbstractApiObject($client); - $this->assertEquals($expectedArray, $api->patch('/path', array('param1' => 'param1value'), array('option1' => 'option1value'))); + $this->assertEquals($expectedArray, $api->patch('/path', ['param1' => 'param1value'], ['option1' => 'option1value'])); } /** @@ -74,20 +74,20 @@ public function shouldPassPATCHRequestToClient() */ public function shouldPassPUTRequestToClient() { - $expectedArray = array('value'); + $expectedArray = ['value']; $httpClient = $this->getHttpMock(); $httpClient ->expects($this->once()) ->method('put') - ->with('/path', array('param1' => 'param1value'), array('option1' => 'option1value')) + ->with('/path', ['param1' => 'param1value'], ['option1' => 'option1value']) ->will($this->returnValue($expectedArray)); $client = $this->getClientMock(); $client->setHttpClient($httpClient); $api = $this->getAbstractApiObject($client); - $this->assertEquals($expectedArray, $api->put('/path', array('param1' => 'param1value'), array('option1' => 'option1value'))); + $this->assertEquals($expectedArray, $api->put('/path', ['param1' => 'param1value'], ['option1' => 'option1value'])); } /** @@ -95,20 +95,20 @@ public function shouldPassPUTRequestToClient() */ public function shouldPassDELETERequestToClient() { - $expectedArray = array('value'); + $expectedArray = ['value']; $httpClient = $this->getHttpMock(); $httpClient ->expects($this->once()) ->method('delete') - ->with('/path', array('param1' => 'param1value'), array('option1' => 'option1value')) + ->with('/path', ['param1' => 'param1value'], ['option1' => 'option1value']) ->will($this->returnValue($expectedArray)); $client = $this->getClientMock(); $client->setHttpClient($httpClient); $api = $this->getAbstractApiObject($client); - $this->assertEquals($expectedArray, $api->delete('/path', array('param1' => 'param1value'), array('option1' => 'option1value'))); + $this->assertEquals($expectedArray, $api->delete('/path', ['param1' => 'param1value'], ['option1' => 'option1value'])); } protected function getAbstractApiObject($client) @@ -130,17 +130,17 @@ protected function getClientMock() protected function getHttpMock() { return $this->getMockBuilder('Trello\HttpClient\HttpClient') - ->setConstructorArgs(array( - array(), + ->setConstructorArgs([ + [], $this->getHttpClientMock() - )) + ]) ->getMock(); } protected function getHttpClientMock() { $mock = $this->getMockBuilder('GuzzleHttp\Client') - ->setMethods(array('send')) + ->setMethods(['send']) ->getMock(); $mock->expects($this->any()) ->method('send'); @@ -154,7 +154,7 @@ class AbstractApiTestInstance extends AbstractApi /** * {@inheritDoc} */ - public function get($path, array $parameters = array(), $requestHeaders = array()) + public function get($path, array $parameters = [], $requestHeaders = []) { return $this->client->getHttpClient()->get($path, $parameters, $requestHeaders); } @@ -162,7 +162,7 @@ public function get($path, array $parameters = array(), $requestHeaders = array( /** * {@inheritDoc} */ - public function post($path, array $parameters = array(), $requestHeaders = array()) + public function post($path, array $parameters = [], $requestHeaders = []) { return $this->client->getHttpClient()->post($path, $parameters, $requestHeaders); } @@ -170,7 +170,7 @@ public function post($path, array $parameters = array(), $requestHeaders = array /** * {@inheritDoc} */ - public function postRaw($path, $body, $requestHeaders = array()) + public function postRaw($path, $body, $requestHeaders = []) { return $this->client->getHttpClient()->post($path, $body, $requestHeaders); } @@ -178,7 +178,7 @@ public function postRaw($path, $body, $requestHeaders = array()) /** * {@inheritDoc} */ - public function patch($path, array $parameters = array(), $requestHeaders = array()) + public function patch($path, array $parameters = [], $requestHeaders = []) { return $this->client->getHttpClient()->patch($path, $parameters, $requestHeaders); } @@ -186,7 +186,7 @@ public function patch($path, array $parameters = array(), $requestHeaders = arra /** * {@inheritDoc} */ - public function put($path, array $parameters = array(), $requestHeaders = array()) + public function put($path, array $parameters = [], $requestHeaders = []) { return $this->client->getHttpClient()->put($path, $parameters, $requestHeaders); } @@ -194,7 +194,7 @@ public function put($path, array $parameters = array(), $requestHeaders = array( /** * {@inheritDoc} */ - public function delete($path, array $parameters = array(), $requestHeaders = array()) + public function delete($path, array $parameters = [], $requestHeaders = []) { return $this->client->getHttpClient()->delete($path, $parameters, $requestHeaders); } @@ -205,7 +205,7 @@ class ExposedAbstractApiTestInstance extends AbstractApi /** * {@inheritDoc} */ - public function get($path, array $parameters = array(), $requestHeaders = array()) + public function get($path, array $parameters = [], $requestHeaders = []) { return parent::get($path, $parameters, $requestHeaders); } diff --git a/test/Trello/Tests/Unit/Api/ActionTest.php b/test/Trello/Tests/Unit/Api/ActionTest.php index c57a802..1de8342 100644 --- a/test/Trello/Tests/Unit/Api/ActionTest.php +++ b/test/Trello/Tests/Unit/Api/ActionTest.php @@ -14,12 +14,12 @@ class ActionTest extends TestCase */ public function shouldShowAction() { - $expectedArray = array('id' => $this->fakeId); + $expectedArray = ['id' => $this->fakeId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeId) + ->with($this->apiPath . '/' . $this->fakeId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($this->fakeId)); @@ -30,12 +30,12 @@ public function shouldShowAction() */ public function shouldUpdateAction() { - $expectedArray = array('id' => $this->fakeId); + $expectedArray = ['id' => $this->fakeId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeId) + ->with($this->apiPath . '/' . $this->fakeId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update($this->fakeId, $expectedArray)); @@ -49,7 +49,7 @@ public function shouldRemoveAction() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->apiPath.'/'.$this->fakeId) + ->with($this->apiPath . '/' . $this->fakeId) ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->remove($this->fakeId)); @@ -65,7 +65,7 @@ public function shouldSetText() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeId.'/text') + ->with($this->apiPath . '/' . $this->fakeId . '/text') ->will($this->returnValue($text)); $this->assertEquals($text, $api->setText($this->fakeId, $text)); @@ -79,7 +79,7 @@ public function shouldGetBoard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/board') + ->with($this->apiPath . '/' . $this->fakeParentId . '/board') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoard($this->fakeParentId)); @@ -93,7 +93,7 @@ public function shouldGetBoardField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/board/name') + ->with($this->apiPath . '/' . $this->fakeParentId . '/board/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoardField($this->fakeParentId, 'name')); @@ -120,7 +120,7 @@ public function shouldGetList() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/list') + ->with($this->apiPath . '/' . $this->fakeParentId . '/list') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getList($this->fakeParentId)); @@ -134,7 +134,7 @@ public function shouldGetListField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/list/name') + ->with($this->apiPath . '/' . $this->fakeParentId . '/list/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getListField($this->fakeParentId, 'name')); @@ -161,7 +161,7 @@ public function shouldGetCard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/card') + ->with($this->apiPath . '/' . $this->fakeParentId . '/card') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getCard($this->fakeParentId)); @@ -175,7 +175,7 @@ public function shouldGetCardField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/card/name') + ->with($this->apiPath . '/' . $this->fakeParentId . '/card/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getCardField($this->fakeParentId, 'name')); @@ -202,7 +202,7 @@ public function shouldGetMember() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/member') + ->with($this->apiPath . '/' . $this->fakeParentId . '/member') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getMember($this->fakeParentId)); @@ -216,7 +216,7 @@ public function shouldGetMemberField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/member/bio') + ->with($this->apiPath . '/' . $this->fakeParentId . '/member/bio') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getMemberField($this->fakeParentId, 'bio')); @@ -243,7 +243,7 @@ public function shouldGetCreator() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/memberCreator') + ->with($this->apiPath . '/' . $this->fakeParentId . '/memberCreator') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getCreator($this->fakeParentId)); @@ -257,7 +257,7 @@ public function shouldGetCreatorField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/memberCreator/bio') + ->with($this->apiPath . '/' . $this->fakeParentId . '/memberCreator/bio') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getCreatorField($this->fakeParentId, 'bio')); @@ -284,7 +284,7 @@ public function shouldGetOrganization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/organization') + ->with($this->apiPath . '/' . $this->fakeParentId . '/organization') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getOrganization($this->fakeParentId)); @@ -298,7 +298,7 @@ public function shouldGetOrganizationField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/organization/name') + ->with($this->apiPath . '/' . $this->fakeParentId . '/organization/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getOrganizationField($this->fakeParentId, 'name')); diff --git a/test/Trello/Tests/Unit/Api/Board/CardlistsTest.php b/test/Trello/Tests/Unit/Api/Board/CardlistsTest.php index e779810..41f13d9 100644 --- a/test/Trello/Tests/Unit/Api/Board/CardlistsTest.php +++ b/test/Trello/Tests/Unit/Api/Board/CardlistsTest.php @@ -35,7 +35,7 @@ public function shouldFilterCardlistsWithDefaultFilter() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$defaultFilter) + ->with($this->getPath() . '/' . $defaultFilter) ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId)); @@ -51,7 +51,7 @@ public function shouldFilterCardlistsWithStringArgument() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open') + ->with($this->getPath() . '/open') ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId, $filter)); @@ -62,12 +62,12 @@ public function shouldFilterCardlistsWithStringArgument() */ public function shouldFilterCardlistsWithArrayArgument() { - $filter = array('open','closed'); + $filter = ['open', 'closed']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open,closed') + ->with($this->getPath() . '/open,closed') ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId, $filter)); @@ -78,7 +78,7 @@ public function shouldFilterCardlistsWithArrayArgument() */ public function shouldCreateCardlist() { - $data = array('name' => 'Test list'); + $data = ['name' => 'Test list']; $api = $this->getApiMock(); $api->expects($this->once()) @@ -95,7 +95,7 @@ public function shouldCreateCardlist() */ public function shouldNotCreateCardlistWithoutName() { - $data = array('desc' => 'Test description'); + $data = ['desc' => 'Test description']; $api = $this->getApiMock(); $api->expects($this->never()) diff --git a/test/Trello/Tests/Unit/Api/Board/CardsTest.php b/test/Trello/Tests/Unit/Api/Board/CardsTest.php index 4f63177..9de9461 100644 --- a/test/Trello/Tests/Unit/Api/Board/CardsTest.php +++ b/test/Trello/Tests/Unit/Api/Board/CardsTest.php @@ -35,7 +35,7 @@ public function shouldFilterCardsWithDefaultFilter() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$defaultFilter) + ->with($this->getPath() . '/' . $defaultFilter) ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId)); @@ -51,7 +51,7 @@ public function shouldFilterCardsWithStringArgument() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open') + ->with($this->getPath() . '/open') ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId, $filter)); @@ -62,12 +62,12 @@ public function shouldFilterCardsWithStringArgument() */ public function shouldFilterCardsWithArrayArgument() { - $filter = array('open','closed'); + $filter = ['open', 'closed']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open,closed') + ->with($this->getPath() . '/open,closed') ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId, $filter)); @@ -81,7 +81,7 @@ public function shouldShowCard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->show($this->fakeParentId, $this->fakeId)); diff --git a/test/Trello/Tests/Unit/Api/Board/ChecklistsTest.php b/test/Trello/Tests/Unit/Api/Board/ChecklistsTest.php index 0066fd1..f457be2 100644 --- a/test/Trello/Tests/Unit/Api/Board/ChecklistsTest.php +++ b/test/Trello/Tests/Unit/Api/Board/ChecklistsTest.php @@ -30,7 +30,7 @@ public function shouldGetAllChecklists() */ public function shouldCreateChecklist() { - $data = array('name' => 'Test Checklist'); + $data = ['name' => 'Test Checklist']; $api = $this->getApiMock(); $api->expects($this->once()) @@ -47,7 +47,7 @@ public function shouldCreateChecklist() */ public function shouldNotCreateChecklistWithoutName() { - $data = array(); + $data = []; $api = $this->getApiMock(); $api->expects($this->never()) diff --git a/test/Trello/Tests/Unit/Api/Board/LabelsTest.php b/test/Trello/Tests/Unit/Api/Board/LabelsTest.php index 443b94b..de19514 100644 --- a/test/Trello/Tests/Unit/Api/Board/LabelsTest.php +++ b/test/Trello/Tests/Unit/Api/Board/LabelsTest.php @@ -35,7 +35,7 @@ public function shouldShowALabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$color) + ->with($this->getPath() . '/' . $color) ->will($this->returnValue($color)); $this->assertEquals($color, $api->show($this->fakeParentId, $color)); @@ -67,7 +67,7 @@ public function shouldSetLabelName() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('boards/'.$this->fakeParentId.'/labelNames/'.$color) + ->with('boards/' . $this->fakeParentId . '/labelNames/' . $color) ->will($this->returnValue($name)); $this->assertEquals($name, $api->setName($this->fakeParentId, $color, $name)); diff --git a/test/Trello/Tests/Unit/Api/Board/MembersTest.php b/test/Trello/Tests/Unit/Api/Board/MembersTest.php index cf7ff02..05a87c1 100644 --- a/test/Trello/Tests/Unit/Api/Board/MembersTest.php +++ b/test/Trello/Tests/Unit/Api/Board/MembersTest.php @@ -33,7 +33,7 @@ public function shouldRemoveMember() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->remove($this->fakeParentId, $this->fakeId)); @@ -74,7 +74,7 @@ public function shouldGetMemberCards() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$this->fakeId.'/cards') + ->with($this->getPath() . '/' . $this->fakeId . '/cards') ->will($this->returnValue(true)); $this->assertEquals(true, $api->cards($this->fakeParentId, $this->fakeId)); @@ -90,7 +90,7 @@ public function shouldFilterMembersWithDefaultFilter() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$defaultFilter) + ->with($this->getPath() . '/' . $defaultFilter) ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId)); @@ -106,7 +106,7 @@ public function shouldFilterMembersWithStringArgument() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/admins') + ->with($this->getPath() . '/admins') ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId, $filter)); @@ -117,12 +117,12 @@ public function shouldFilterMembersWithStringArgument() */ public function shouldFilterMembersWithArrayArgument() { - $filter = array('admins','owners'); + $filter = ['admins', 'owners']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/admins,owners') + ->with($this->getPath() . '/admins,owners') ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId, $filter)); @@ -136,7 +136,7 @@ public function shouldGetInvitedMembers() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'Invited') + ->with($this->getPath() . 'Invited') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getInvitedMembers($this->fakeParentId)); @@ -150,7 +150,7 @@ public function shouldGetInvitedMembersField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'Invited/bio') + ->with($this->getPath() . 'Invited/bio') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getInvitedMembersField($this->fakeParentId, 'bio')); @@ -177,7 +177,7 @@ public function shouldSetRole() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->setRole($this->fakeParentId, $this->fakeId, 'normal')); diff --git a/test/Trello/Tests/Unit/Api/Board/MyPreferencesTest.php b/test/Trello/Tests/Unit/Api/Board/MyPreferencesTest.php index 353b533..18d637f 100644 --- a/test/Trello/Tests/Unit/Api/Board/MyPreferencesTest.php +++ b/test/Trello/Tests/Unit/Api/Board/MyPreferencesTest.php @@ -13,7 +13,7 @@ class MyPreferencesTest extends TestCase /** * @test - */ + */ public function notImplementedYet() { $this->markTestSkipped( diff --git a/test/Trello/Tests/Unit/Api/Board/PowerUpsTest.php b/test/Trello/Tests/Unit/Api/Board/PowerUpsTest.php index 5a03830..4d91168 100644 --- a/test/Trello/Tests/Unit/Api/Board/PowerUpsTest.php +++ b/test/Trello/Tests/Unit/Api/Board/PowerUpsTest.php @@ -13,14 +13,14 @@ class PowerUpsTest extends TestCase /** * @test - */ + */ public function notImplementedYet() { $this->markTestSkipped( sprintf('The "%s" API is not implemented yet.', $this->getApiClass()) ); } - + protected function getApiClass() { return 'Trello\Api\Board\PowerUps'; diff --git a/test/Trello/Tests/Unit/Api/Board/PreferencesTest.php b/test/Trello/Tests/Unit/Api/Board/PreferencesTest.php index 148f814..72aee20 100644 --- a/test/Trello/Tests/Unit/Api/Board/PreferencesTest.php +++ b/test/Trello/Tests/Unit/Api/Board/PreferencesTest.php @@ -13,7 +13,7 @@ class PreferencesTest extends TestCase /** * @test - */ + */ public function notImplementedYet() { $this->markTestSkipped( diff --git a/test/Trello/Tests/Unit/Api/BoardTest.php b/test/Trello/Tests/Unit/Api/BoardTest.php index 6587014..0f4d314 100644 --- a/test/Trello/Tests/Unit/Api/BoardTest.php +++ b/test/Trello/Tests/Unit/Api/BoardTest.php @@ -15,12 +15,12 @@ class BoardTest extends TestCase */ public function shouldShowBoard() { - $expectedArray = array('id' => $this->fakeBoardId); + $expectedArray = ['id' => $this->fakeBoardId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeBoardId) + ->with($this->apiPath . '/' . $this->fakeBoardId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($this->fakeBoardId)); @@ -31,7 +31,7 @@ public function shouldShowBoard() */ public function shouldCreateBoard() { - $expectedArray = array('name' => 'Test Board'); + $expectedArray = ['name' => 'Test Board']; $api = $this->getApiMock(); $api->expects($this->once()) @@ -48,7 +48,7 @@ public function shouldCreateBoard() */ public function shouldNotCreateBoardWithoutName() { - $data = array('desc' => 'Test Board Description'); + $data = ['desc' => 'Test Board Description']; $api = $this->getApiMock(); $api->expects($this->never()) @@ -62,12 +62,12 @@ public function shouldNotCreateBoardWithoutName() */ public function shouldUpdateBoard() { - $expectedArray = array('name' => 'Test Board'); + $expectedArray = ['name' => 'Test Board']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeBoardId) + ->with($this->apiPath . '/' . $this->fakeBoardId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update($this->fakeBoardId, $expectedArray)); @@ -83,7 +83,7 @@ public function shouldGetField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/desc') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/desc') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getField($this->fakeBoardId, $field)); @@ -112,7 +112,7 @@ public function shouldSetName() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/name') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/name') ->will($this->returnValue($name)); $this->assertEquals($name, $api->setName($this->fakeBoardId, $name)); @@ -128,7 +128,7 @@ public function shouldSetDescription() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/desc') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/desc') ->will($this->returnValue($description)); $this->assertEquals($description, $api->setDescription($this->fakeBoardId, $description)); @@ -144,7 +144,7 @@ public function shouldSetClosed() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/closed') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/closed') ->will($this->returnValue($closed)); $this->assertEquals($closed, $api->setClosed($this->fakeBoardId, $closed)); @@ -160,7 +160,7 @@ public function shouldSetSubscribed() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/subscribed') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/subscribed') ->will($this->returnValue($subscribed)); $this->assertEquals($subscribed, $api->setSubscribed($this->fakeBoardId, $subscribed)); @@ -174,7 +174,7 @@ public function shouldSetViewed() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/markAsViewed') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/markAsViewed') ->will($this->returnValue(true)); $this->assertEquals(true, $api->setViewed($this->fakeBoardId)); @@ -190,7 +190,7 @@ public function shouldSetOrganization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/idOrganization/'.$orgId) + ->with($this->apiPath . '/' . $this->fakeBoardId . '/idOrganization/' . $orgId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->setOrganization($this->fakeBoardId, $orgId)); @@ -204,7 +204,7 @@ public function shouldGetOrganization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/organization') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/organization') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getOrganization($this->fakeBoardId)); @@ -218,7 +218,7 @@ public function shouldGetOrganizationField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/organization/name') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/organization/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getOrganizationField($this->fakeBoardId, 'name')); @@ -245,7 +245,7 @@ public function shouldGetDeltas() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/deltas') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/deltas') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getDeltas($this->fakeBoardId)); @@ -259,7 +259,7 @@ public function shouldGetStars() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeBoardId.'/boardStars') + ->with($this->apiPath . '/' . $this->fakeBoardId . '/boardStars') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getStars($this->fakeBoardId)); diff --git a/test/Trello/Tests/Unit/Api/Card/ActionsTest.php b/test/Trello/Tests/Unit/Api/Card/ActionsTest.php index 8509625..8efa470 100644 --- a/test/Trello/Tests/Unit/Api/Card/ActionsTest.php +++ b/test/Trello/Tests/Unit/Api/Card/ActionsTest.php @@ -35,7 +35,7 @@ public function shouldAddComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with($this->getPath().'/comments') + ->with($this->getPath() . '/comments') ->will($this->returnValue(true)); $this->assertEquals(true, $api->addComment($this->fakeParentId, $text)); @@ -49,7 +49,7 @@ public function shouldRemoveComment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/comments/'.$this->fakeId) + ->with($this->getPath() . '/comments/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->removeComment($this->fakeParentId, $this->fakeId)); diff --git a/test/Trello/Tests/Unit/Api/Card/AttachmentsTest.php b/test/Trello/Tests/Unit/Api/Card/AttachmentsTest.php index c8e55f8..d5b4d55 100644 --- a/test/Trello/Tests/Unit/Api/Card/AttachmentsTest.php +++ b/test/Trello/Tests/Unit/Api/Card/AttachmentsTest.php @@ -33,7 +33,7 @@ public function shouldShowAttachment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->show($this->fakeParentId, $this->fakeId)); @@ -45,7 +45,7 @@ public function shouldShowAttachment() */ public function shouldCreateAttachment() { - $data = array('url' => 'http://www.test.com/image.jpg'); + $data = ['url' => 'http://www.test.com/image.jpg']; $api = $this->getApiMock(); $api->expects($this->once()) @@ -62,7 +62,7 @@ public function shouldCreateAttachment() */ public function shouldNotCreateAttachmentWhenParamsIncomplete() { - $data = array(); + $data = []; $api = $this->getApiMock(); $api->expects($this->never()) @@ -79,7 +79,7 @@ public function shouldRemoveAttachment() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->remove($this->fakeParentId, $this->fakeId)); @@ -93,7 +93,7 @@ public function shouldSetAsCover() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('cards/'.$this->fakeParentId.'/idAttachmentCover') + ->with('cards/' . $this->fakeParentId . '/idAttachmentCover') ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->setAsCover($this->fakeParentId, $this->fakeId)); diff --git a/test/Trello/Tests/Unit/Api/Card/ChecklistsTest.php b/test/Trello/Tests/Unit/Api/Card/ChecklistsTest.php index 4516ae2..6b089ec 100644 --- a/test/Trello/Tests/Unit/Api/Card/ChecklistsTest.php +++ b/test/Trello/Tests/Unit/Api/Card/ChecklistsTest.php @@ -19,7 +19,7 @@ public function shouldGetAllChecklists() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('cards/'.$this->fakeParentId.'/checklists') + ->with('cards/' . $this->fakeParentId . '/checklists') ->will($this->returnValue(true)); $this->assertEquals(true, $api->all($this->fakeParentId)); @@ -30,7 +30,7 @@ public function shouldGetAllChecklists() */ public function shouldCreateChecklist() { - $data = array('name' => 'Test checklist'); + $data = ['name' => 'Test checklist']; $api = $this->getApiMock(); $api->expects($this->once()) @@ -47,7 +47,7 @@ public function shouldCreateChecklist() */ public function shouldNotCreateChecklistWithoutNameSourceChecklistIdOrValue() { - $data = array(); + $data = []; $api = $this->getApiMock(); $api->expects($this->never()) @@ -64,7 +64,7 @@ public function shouldRemoveChecklist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->remove($this->fakeParentId, $this->fakeId)); @@ -78,7 +78,7 @@ public function shouldGetItemStates() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('cards/'.$this->fakeParentId.'/checkItemStates') + ->with('cards/' . $this->fakeParentId . '/checkItemStates') ->will($this->returnValue(true)); $this->assertEquals(true, $api->itemStates($this->fakeParentId)); @@ -89,12 +89,12 @@ public function shouldGetItemStates() */ public function shouldUpdateItem() { - $item = array('name' => 'Test', 'state' => true); + $item = ['name' => 'Test', 'state' => true]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->getPath().'/'.$this->fakeId('checklist').'/checkItem/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId('checklist') . '/checkItem/' . $this->fakeId) ->will($this->returnValue($item)); $this->assertEquals($item, $api->updateItem($this->fakeParentId, $this->fakeId('checklist'), $this->fakeId, $item)); @@ -105,12 +105,12 @@ public function shouldUpdateItem() */ public function shouldCreateItem() { - $item = array('name' => 'Test', 'state' => true); + $item = ['name' => 'Test', 'state' => true]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with($this->getPath().'/'.$this->fakeId('checklist').'/checkItem') + ->with($this->getPath() . '/' . $this->fakeId('checklist') . '/checkItem') ->will($this->returnValue($item)); $this->assertEquals($item, $api->createItem($this->fakeParentId, $this->fakeId('checklist'), $item)); @@ -124,7 +124,7 @@ public function shouldRemoveItem() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$this->fakeId('checklist').'/checkItem/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId('checklist') . '/checkItem/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->removeItem($this->fakeParentId, $this->fakeId('checklist'), $this->fakeId)); @@ -138,7 +138,7 @@ public function shouldConvertItemToCard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with($this->getPath().'/'.$this->fakeId('checklist').'/checkItem/'.$this->fakeId.'/convertToCard') + ->with($this->getPath() . '/' . $this->fakeId('checklist') . '/checkItem/' . $this->fakeId . '/convertToCard') ->will($this->returnValue(true)); $this->assertEquals(true, $api->convertItemToCard($this->fakeParentId, $this->fakeId('checklist'), $this->fakeId)); diff --git a/test/Trello/Tests/Unit/Api/Card/LabelsTest.php b/test/Trello/Tests/Unit/Api/Card/LabelsTest.php index 5fc8882..1491733 100644 --- a/test/Trello/Tests/Unit/Api/Card/LabelsTest.php +++ b/test/Trello/Tests/Unit/Api/Card/LabelsTest.php @@ -16,7 +16,7 @@ class LabelsTest extends TestCase */ public function shouldSetLabels() { - $labels = array('green', 'purple'); + $labels = ['green', 'purple']; $api = $this->getApiMock(); $api->expects($this->once()) @@ -33,7 +33,7 @@ public function shouldSetLabels() */ public function shouldNotSetUnexistingLabels() { - $labels = array('unexisting', 'purple'); + $labels = ['unexisting', 'purple']; $api = $this->getApiMock(); $api->expects($this->never()) @@ -52,7 +52,7 @@ public function shouldRemoveALabel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$label) + ->with($this->getPath() . '/' . $label) ->will($this->returnValue($label)); $this->assertEquals($label, $api->remove($this->fakeParentId, $label)); diff --git a/test/Trello/Tests/Unit/Api/Card/MembersTest.php b/test/Trello/Tests/Unit/Api/Card/MembersTest.php index 84a5d5e..dbca2b1 100644 --- a/test/Trello/Tests/Unit/Api/Card/MembersTest.php +++ b/test/Trello/Tests/Unit/Api/Card/MembersTest.php @@ -30,11 +30,11 @@ public function shouldGetAllMembers() */ public function shouldSetMembers() { - $data = array( + $data = [ $this->fakeId('member1'), $this->fakeId('member2'), $this->fakeId('member3') - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) @@ -51,7 +51,7 @@ public function shouldSetMembers() */ public function shouldNotSetMembersWithEmptyArray() { - $data = array(); + $data = []; $api = $this->getApiMock(); $api->expects($this->never()) @@ -82,7 +82,7 @@ public function shouldRemoveMember() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->remove($this->fakeParentId, $this->fakeId)); @@ -96,7 +96,7 @@ public function shouldAddVote() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with($this->getPath().'/membersVoted') + ->with($this->getPath() . '/membersVoted') ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->addVote($this->fakeParentId, $this->fakeId)); @@ -110,7 +110,7 @@ public function shouldRemoveVote() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/membersVoted/'.$this->fakeId) + ->with($this->getPath() . '/membersVoted/' . $this->fakeId) ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->removeVote($this->fakeParentId, $this->fakeId)); diff --git a/test/Trello/Tests/Unit/Api/Card/StickersTest.php b/test/Trello/Tests/Unit/Api/Card/StickersTest.php index 3ce3059..7094f7d 100644 --- a/test/Trello/Tests/Unit/Api/Card/StickersTest.php +++ b/test/Trello/Tests/Unit/Api/Card/StickersTest.php @@ -33,7 +33,7 @@ public function shouldShowSticker() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->show($this->fakeParentId, $this->fakeId)); @@ -44,12 +44,12 @@ public function shouldShowSticker() */ public function shouldCreateSticker() { - $data = array( - 'image' => 'http://www.test.com/fake-image-url.jpg', - 'top' => 0, - 'left' => 0, + $data = [ + 'image' => 'http://www.test.com/fake-image-url.jpg', + 'top' => 0, + 'left' => 0, 'zIndex' => 1, - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) @@ -66,11 +66,11 @@ public function shouldCreateSticker() */ public function shouldNotCreateStickerWhenParamsIncomplete() { - $data = array( - 'top' => 0, - 'left' => 0, + $data = [ + 'top' => 0, + 'left' => 0, 'zIndex' => 1, - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -84,16 +84,16 @@ public function shouldNotCreateStickerWhenParamsIncomplete() */ public function shouldUpdateSticker() { - $data = array( - 'top' => 2, - 'left' => 2, + $data = [ + 'top' => 2, + 'left' => 2, 'zIndex' => 2, - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue($data)); $this->assertEquals($data, $api->update($this->fakeParentId, $this->fakeId, $data)); @@ -105,7 +105,7 @@ public function shouldUpdateSticker() */ public function shouldNotUpdateStickerWithoutAtLeastOneAllowedParam() { - $data = array(); + $data = []; $api = $this->getApiMock(); $api->expects($this->never()) @@ -122,7 +122,7 @@ public function shouldRemoveSticker() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->remove($this->fakeParentId, $this->fakeId)); diff --git a/test/Trello/Tests/Unit/Api/CardTest.php b/test/Trello/Tests/Unit/Api/CardTest.php index 9c6f46d..3df5e6b 100644 --- a/test/Trello/Tests/Unit/Api/CardTest.php +++ b/test/Trello/Tests/Unit/Api/CardTest.php @@ -15,12 +15,12 @@ class CardTest extends TestCase */ public function shouldShowCard() { - $expectedArray = array('id' => $this->fakeCardId); + $expectedArray = ['id' => $this->fakeCardId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeCardId) + ->with($this->apiPath . '/' . $this->fakeCardId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($this->fakeCardId)); @@ -31,10 +31,10 @@ public function shouldShowCard() */ public function shouldCreateCard() { - $expectedArray = array( + $expectedArray = [ 'name' => 'Test Card', 'idList' => $this->fakeId('list') - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) @@ -51,10 +51,10 @@ public function shouldCreateCard() */ public function shouldNotCreateCardWithoutName() { - $data = array( + $data = [ 'idList' => $this->fakeId('list'), - 'desc' => 'Test Card Description' - ); + 'desc' => 'Test Card Description' + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -69,10 +69,10 @@ public function shouldNotCreateCardWithoutName() */ public function shouldNotCreateCardWithoutListId() { - $data = array( - 'name' => 'Test Card', - 'desc' => 'Test Card Description' - ); + $data = [ + 'name' => 'Test Card', + 'desc' => 'Test Card Description' + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -86,12 +86,12 @@ public function shouldNotCreateCardWithoutListId() */ public function shouldUpdateCard() { - $expectedArray = array('name' => 'Test Card'); + $expectedArray = ['name' => 'Test Card']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeCardId) + ->with($this->apiPath . '/' . $this->fakeCardId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update($this->fakeCardId, $expectedArray)); @@ -107,7 +107,7 @@ public function shouldGetField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeCardId.'/desc') + ->with($this->apiPath . '/' . $this->fakeCardId . '/desc') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getField($this->fakeCardId, $field)); @@ -136,7 +136,7 @@ public function shouldSetName() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeCardId.'/name') + ->with($this->apiPath . '/' . $this->fakeCardId . '/name') ->will($this->returnValue($name)); $this->assertEquals($name, $api->setName($this->fakeCardId, $name)); @@ -152,7 +152,7 @@ public function shouldSetDescription() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeCardId.'/desc') + ->with($this->apiPath . '/' . $this->fakeCardId . '/desc') ->will($this->returnValue($description)); $this->assertEquals($description, $api->setDescription($this->fakeCardId, $description)); @@ -168,7 +168,7 @@ public function shouldSetClosed() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeCardId.'/closed') + ->with($this->apiPath . '/' . $this->fakeCardId . '/closed') ->will($this->returnValue($closed)); $this->assertEquals($closed, $api->setClosed($this->fakeCardId, $closed)); @@ -184,7 +184,7 @@ public function shouldSetSubscribed() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeCardId.'/subscribed') + ->with($this->apiPath . '/' . $this->fakeCardId . '/subscribed') ->will($this->returnValue($subscribed)); $this->assertEquals($subscribed, $api->setSubscribed($this->fakeCardId, $subscribed)); @@ -200,7 +200,7 @@ public function shouldSetPosition() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeCardId.'/pos') + ->with($this->apiPath . '/' . $this->fakeCardId . '/pos') ->will($this->returnValue($position)); $this->assertEquals($position, $api->setPosition($this->fakeCardId, $position)); @@ -216,7 +216,7 @@ public function shouldSetDueDate() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeCardId.'/due') + ->with($this->apiPath . '/' . $this->fakeCardId . '/due') ->will($this->returnValue($date)); $this->assertEquals($date, $api->setDueDate($this->fakeCardId, $date)); @@ -232,7 +232,7 @@ public function shouldSetList() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeCardId.'/idList') + ->with($this->apiPath . '/' . $this->fakeCardId . '/idList') ->will($this->returnValue(true)); $this->assertEquals(true, $api->setList($this->fakeCardId, $lisId)); @@ -246,7 +246,7 @@ public function shouldGetList() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeCardId.'/list') + ->with($this->apiPath . '/' . $this->fakeCardId . '/list') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getList($this->fakeCardId)); @@ -260,7 +260,7 @@ public function shouldGetListField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeCardId.'/list/name') + ->with($this->apiPath . '/' . $this->fakeCardId . '/list/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getListField($this->fakeCardId, 'name')); @@ -289,7 +289,7 @@ public function shouldSetBoard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeCardId.'/idBoard') + ->with($this->apiPath . '/' . $this->fakeCardId . '/idBoard') ->will($this->returnValue(true)); $this->assertEquals(true, $api->setBoard($this->fakeCardId, $lisId)); @@ -303,7 +303,7 @@ public function shouldGetBoard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeCardId.'/board') + ->with($this->apiPath . '/' . $this->fakeCardId . '/board') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoard($this->fakeCardId)); @@ -317,7 +317,7 @@ public function shouldGetBoardField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeCardId.'/board/name') + ->with($this->apiPath . '/' . $this->fakeCardId . '/board/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoardField($this->fakeCardId, 'name')); diff --git a/test/Trello/Tests/Unit/Api/Cardlist/CardsTest.php b/test/Trello/Tests/Unit/Api/Cardlist/CardsTest.php index 11bf281..dc064f1 100644 --- a/test/Trello/Tests/Unit/Api/Cardlist/CardsTest.php +++ b/test/Trello/Tests/Unit/Api/Cardlist/CardsTest.php @@ -35,7 +35,7 @@ public function shouldFilterCardsWithDefaultFilter() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$defaultFilter) + ->with($this->getPath() . '/' . $defaultFilter) ->will($this->returnValue($defaultFilter)); $this->assertEquals($defaultFilter, $api->filter($this->fakeParentId)); @@ -51,7 +51,7 @@ public function shouldFilterCardsWithStringArgument() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open') + ->with($this->getPath() . '/open') ->will($this->returnValue($filter)); $this->assertEquals($filter, $api->filter($this->fakeParentId, $filter)); @@ -62,12 +62,12 @@ public function shouldFilterCardsWithStringArgument() */ public function shouldFilterCardsWithArrayArgument() { - $filter = array('open','closed'); + $filter = ['open', 'closed']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open,closed') + ->with($this->getPath() . '/open,closed') ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->filter($this->fakeParentId, $filter)); @@ -97,7 +97,7 @@ public function shouldArchiveAllCards() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('lists/'.$this->fakeId.'/archiveAllCards') + ->with('lists/' . $this->fakeId . '/archiveAllCards') ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->archiveAll($this->fakeId)); @@ -114,7 +114,7 @@ public function shouldMoveAllCards() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('lists/'.$this->fakeId.'/moveAllCards') + ->with('lists/' . $this->fakeId . '/moveAllCards') ->will($this->returnValue($destId)); $this->assertEquals($destId, $api->moveAll($this->fakeId, $boardId, $destId)); diff --git a/test/Trello/Tests/Unit/Api/CardlistTest.php b/test/Trello/Tests/Unit/Api/CardlistTest.php index b1b4cf3..d612d6b 100644 --- a/test/Trello/Tests/Unit/Api/CardlistTest.php +++ b/test/Trello/Tests/Unit/Api/CardlistTest.php @@ -15,12 +15,12 @@ class CardlistTest extends TestCase */ public function shouldShowList() { - $expectedArray = array('id' => $this->fakeListId); + $expectedArray = ['id' => $this->fakeListId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('lists/'.$this->fakeListId) + ->with('lists/' . $this->fakeListId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($this->fakeListId)); @@ -31,10 +31,10 @@ public function shouldShowList() */ public function shouldCreateList() { - $expectedArray = array( + $expectedArray = [ 'name' => 'Test List', 'idBoard' => $this->fakeId('board'), - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) @@ -51,9 +51,9 @@ public function shouldCreateList() */ public function shouldNotCreateListWithoutName() { - $data = array( + $data = [ 'idBoard' => $this->fakeId('board'), - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -68,9 +68,9 @@ public function shouldNotCreateListWithoutName() */ public function shouldNotCreateListWithoutBoardId() { - $data = array( - 'name' => 'Test List', - ); + $data = [ + 'name' => 'Test List', + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -84,12 +84,12 @@ public function shouldNotCreateListWithoutBoardId() */ public function shouldUpdateList() { - $expectedArray = array('name' => 'Test List'); + $expectedArray = ['name' => 'Test List']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeListId) + ->with($this->apiPath . '/' . $this->fakeListId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update($this->fakeListId, $expectedArray)); @@ -105,7 +105,7 @@ public function shouldSetBoard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeId.'/idBoard') + ->with($this->apiPath . '/' . $this->fakeId . '/idBoard') ->will($this->returnValue(true)); $this->assertEquals(true, $api->setBoard($this->fakeId, $lisId)); @@ -119,7 +119,7 @@ public function shouldGetBoard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeListId.'/board') + ->with($this->apiPath . '/' . $this->fakeListId . '/board') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoard($this->fakeListId)); @@ -133,7 +133,7 @@ public function shouldGetBoardField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeListId.'/board/name') + ->with($this->apiPath . '/' . $this->fakeListId . '/board/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoardField($this->fakeListId, 'name')); @@ -162,7 +162,7 @@ public function shouldSetName() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeListId.'/name') + ->with($this->apiPath . '/' . $this->fakeListId . '/name') ->will($this->returnValue($name)); $this->assertEquals($name, $api->setName($this->fakeListId, $name)); @@ -178,7 +178,7 @@ public function shouldSetPosition() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeListId.'/pos') + ->with($this->apiPath . '/' . $this->fakeListId . '/pos') ->will($this->returnValue($position)); $this->assertEquals($position, $api->setPosition($this->fakeListId, $position)); @@ -194,7 +194,7 @@ public function shouldSetClosed() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeListId.'/closed') + ->with($this->apiPath . '/' . $this->fakeListId . '/closed') ->will($this->returnValue($closed)); $this->assertEquals($closed, $api->setClosed($this->fakeListId, $closed)); @@ -210,7 +210,7 @@ public function shouldSetSubscribed() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeListId.'/subscribed') + ->with($this->apiPath . '/' . $this->fakeListId . '/subscribed') ->will($this->returnValue($subscribed)); $this->assertEquals($subscribed, $api->setSubscribed($this->fakeListId, $subscribed)); diff --git a/test/Trello/Tests/Unit/Api/Checklist/CardsTest.php b/test/Trello/Tests/Unit/Api/Checklist/CardsTest.php index 80475a9..c5f1910 100644 --- a/test/Trello/Tests/Unit/Api/Checklist/CardsTest.php +++ b/test/Trello/Tests/Unit/Api/Checklist/CardsTest.php @@ -35,7 +35,7 @@ public function shouldFilterCardsWithDefaultFilter() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$defaultFilter) + ->with($this->getPath() . '/' . $defaultFilter) ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId)); @@ -51,7 +51,7 @@ public function shouldFilterCardsWithStringArgument() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open') + ->with($this->getPath() . '/open') ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId, $filter)); @@ -62,12 +62,12 @@ public function shouldFilterCardsWithStringArgument() */ public function shouldFilterCardsWithArrayArgument() { - $filter = array('open','closed'); + $filter = ['open', 'closed']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open,closed') + ->with($this->getPath() . '/open,closed') ->will($this->returnValue(true)); $this->assertEquals(true, $api->filter($this->fakeParentId, $filter)); diff --git a/test/Trello/Tests/Unit/Api/Checklist/ItemsTest.php b/test/Trello/Tests/Unit/Api/Checklist/ItemsTest.php index 04bdc1a..b17da91 100644 --- a/test/Trello/Tests/Unit/Api/Checklist/ItemsTest.php +++ b/test/Trello/Tests/Unit/Api/Checklist/ItemsTest.php @@ -30,12 +30,12 @@ public function shouldGetAllItems() */ public function shouldUpdateItem() { - $expectedArray = array('name' => 'Test item', 'state' => 'complete'); + $expectedArray = ['name' => 'Test item', 'state' => 'complete']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$this->fakeId); + ->with($this->getPath() . '/' . $this->fakeId); $api->expects($this->once()) ->method('post') ->with($this->getPath()) @@ -52,7 +52,7 @@ public function shouldRemoveItem() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue($this->fakeId)); $this->assertEquals($this->fakeId, $api->remove($this->fakeParentId, $this->fakeId)); diff --git a/test/Trello/Tests/Unit/Api/ChecklistTest.php b/test/Trello/Tests/Unit/Api/ChecklistTest.php index e8a6140..6540f9d 100644 --- a/test/Trello/Tests/Unit/Api/ChecklistTest.php +++ b/test/Trello/Tests/Unit/Api/ChecklistTest.php @@ -15,12 +15,12 @@ class ChecklistTest extends TestCase */ public function shouldShowChecklist() { - $expectedArray = array('id' => $this->fakeChecklistId); + $expectedArray = ['id' => $this->fakeChecklistId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeChecklistId) + ->with($this->apiPath . '/' . $this->fakeChecklistId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($this->fakeChecklistId)); @@ -31,10 +31,10 @@ public function shouldShowChecklist() */ public function shouldCreateChecklist() { - $expectedArray = array( + $expectedArray = [ 'name' => 'Test Checklist', 'idCard' => $this->fakeId('list'), - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) @@ -51,9 +51,9 @@ public function shouldCreateChecklist() */ public function shouldNotCreateChecklistWithoutName() { - $data = array( + $data = [ 'idCard' => $this->fakeId('list'), - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -68,9 +68,9 @@ public function shouldNotCreateChecklistWithoutName() */ public function shouldNotCreateChecklistWithoutCardId() { - $data = array( - 'name' => 'Test Checklist', - ); + $data = [ + 'name' => 'Test Checklist', + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -84,12 +84,12 @@ public function shouldNotCreateChecklistWithoutCardId() */ public function shouldUpdateChecklist() { - $expectedArray = array('name' => 'Test Checklist'); + $expectedArray = ['name' => 'Test Checklist']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeChecklistId) + ->with($this->apiPath . '/' . $this->fakeChecklistId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update($this->fakeChecklistId, $expectedArray)); @@ -103,7 +103,7 @@ public function shouldRemoveChecklist() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->apiPath.'/'.$this->fakeChecklistId) + ->with($this->apiPath . '/' . $this->fakeChecklistId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->remove($this->fakeChecklistId)); @@ -119,7 +119,7 @@ public function shouldGetField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeChecklistId.'/name') + ->with($this->apiPath . '/' . $this->fakeChecklistId . '/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getField($this->fakeChecklistId, $field)); @@ -133,7 +133,7 @@ public function shouldGetBoard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeChecklistId.'/board') + ->with($this->apiPath . '/' . $this->fakeChecklistId . '/board') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoard($this->fakeChecklistId)); @@ -147,7 +147,7 @@ public function shouldGetBoardField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeChecklistId.'/board/name') + ->with($this->apiPath . '/' . $this->fakeChecklistId . '/board/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoardField($this->fakeChecklistId, 'name')); @@ -176,7 +176,7 @@ public function shouldSetCard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeChecklistId.'/idCard') + ->with($this->apiPath . '/' . $this->fakeChecklistId . '/idCard') ->will($this->returnValue($card)); $this->assertEquals($card, $api->setCard($this->fakeChecklistId, $card)); @@ -192,7 +192,7 @@ public function shouldSetName() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeChecklistId.'/name') + ->with($this->apiPath . '/' . $this->fakeChecklistId . '/name') ->will($this->returnValue($name)); $this->assertEquals($name, $api->setName($this->fakeChecklistId, $name)); @@ -208,7 +208,7 @@ public function shouldSetPosition() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeChecklistId.'/pos') + ->with($this->apiPath . '/' . $this->fakeChecklistId . '/pos') ->will($this->returnValue($position)); $this->assertEquals($position, $api->setPosition($this->fakeChecklistId, $position)); diff --git a/test/Trello/Tests/Unit/Api/Member/BoardsTest.php b/test/Trello/Tests/Unit/Api/Member/BoardsTest.php index 7b43c66..032cc27 100644 --- a/test/Trello/Tests/Unit/Api/Member/BoardsTest.php +++ b/test/Trello/Tests/Unit/Api/Member/BoardsTest.php @@ -35,7 +35,7 @@ public function shouldFilterBoardsWithDefaultFilter() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$defaultFilter) + ->with($this->getPath() . '/' . $defaultFilter) ->will($this->returnValue($defaultFilter)); $this->assertEquals($defaultFilter, $api->filter($this->fakeParentId)); @@ -51,7 +51,7 @@ public function shouldFilterBoardsWithStringArgument() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open') + ->with($this->getPath() . '/open') ->will($this->returnValue($filter)); $this->assertEquals($filter, $api->filter($this->fakeParentId, $filter)); @@ -62,12 +62,12 @@ public function shouldFilterBoardsWithStringArgument() */ public function shouldFilterBoardsWithArrayArgument() { - $filter = array('open','closed'); + $filter = ['open', 'closed']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open,closed') + ->with($this->getPath() . '/open,closed') ->will($this->returnValue($filter)); $this->assertEquals($filter, $api->filter($this->fakeParentId, $filter)); @@ -81,7 +81,7 @@ public function shouldGetInvitedTo() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'Invited') + ->with($this->getPath() . 'Invited') ->will($this->returnValue(true)); $this->assertEquals(true, $api->invitedTo($this->fakeParentId)); @@ -95,7 +95,7 @@ public function shouldGetInvitedToField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'Invited/name') + ->with($this->getPath() . 'Invited/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->invitedToField($this->fakeParentId, 'name')); @@ -122,7 +122,7 @@ public function shouldPinBoard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('members/'.$this->fakeParentId.'/idBoardsPinned') + ->with('members/' . $this->fakeParentId . '/idBoardsPinned') ->will($this->returnValue(true)); $this->assertEquals(true, $api->pin($this->fakeParentId, $this->fakeId)); @@ -136,7 +136,7 @@ public function shouldUnpinBoard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with('members/'.$this->fakeParentId.'/idBoardsPinned/'.$this->fakeId) + ->with('members/' . $this->fakeParentId . '/idBoardsPinned/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->unpin($this->fakeParentId, $this->fakeId)); diff --git a/test/Trello/Tests/Unit/Api/Member/CardsTest.php b/test/Trello/Tests/Unit/Api/Member/CardsTest.php index d4df88f..b643256 100644 --- a/test/Trello/Tests/Unit/Api/Member/CardsTest.php +++ b/test/Trello/Tests/Unit/Api/Member/CardsTest.php @@ -35,7 +35,7 @@ public function shouldFilterCardsWithDefaultFilter() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$defaultFilter) + ->with($this->getPath() . '/' . $defaultFilter) ->will($this->returnValue($defaultFilter)); $this->assertEquals($defaultFilter, $api->filter($this->fakeParentId)); @@ -51,7 +51,7 @@ public function shouldFilterCardsWithStringArgument() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open') + ->with($this->getPath() . '/open') ->will($this->returnValue($filter)); $this->assertEquals($filter, $api->filter($this->fakeParentId, $filter)); @@ -62,12 +62,12 @@ public function shouldFilterCardsWithStringArgument() */ public function shouldFilterCardsWithArrayArgument() { - $filter = array('open','closed'); + $filter = ['open', 'closed']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/open,closed') + ->with($this->getPath() . '/open,closed') ->will($this->returnValue($filter)); $this->assertEquals($filter, $api->filter($this->fakeParentId, $filter)); diff --git a/test/Trello/Tests/Unit/Api/Member/NotificationsTest.php b/test/Trello/Tests/Unit/Api/Member/NotificationsTest.php index 3936f38..9357587 100644 --- a/test/Trello/Tests/Unit/Api/Member/NotificationsTest.php +++ b/test/Trello/Tests/Unit/Api/Member/NotificationsTest.php @@ -35,7 +35,7 @@ public function shouldFilterNotificationsWithDefaultFilter() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$defaultFilter) + ->with($this->getPath() . '/' . $defaultFilter) ->will($this->returnValue($defaultFilter)); $this->assertEquals($defaultFilter, $api->filter($this->fakeParentId)); @@ -51,7 +51,7 @@ public function shouldFilterNotificationsWithStringArgument() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/createCard') + ->with($this->getPath() . '/createCard') ->will($this->returnValue($filter)); $this->assertEquals($filter, $api->filter($this->fakeParentId, $filter)); @@ -62,12 +62,12 @@ public function shouldFilterNotificationsWithStringArgument() */ public function shouldFilterNotificationsWithArrayArgument() { - $filter = array('createCard','updateCard'); + $filter = ['createCard', 'updateCard']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/createCard,updateCard') + ->with($this->getPath() . '/createCard,updateCard') ->will($this->returnValue($filter)); $this->assertEquals($filter, $api->filter($this->fakeParentId, $filter)); diff --git a/test/Trello/Tests/Unit/Api/Member/OrganizationsTest.php b/test/Trello/Tests/Unit/Api/Member/OrganizationsTest.php index d809569..8650f77 100644 --- a/test/Trello/Tests/Unit/Api/Member/OrganizationsTest.php +++ b/test/Trello/Tests/Unit/Api/Member/OrganizationsTest.php @@ -35,7 +35,7 @@ public function shouldFilterOrganizationsWithDefaultFilter() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$defaultFilter) + ->with($this->getPath() . '/' . $defaultFilter) ->will($this->returnValue($defaultFilter)); $this->assertEquals($defaultFilter, $api->filter($this->fakeParentId)); @@ -51,7 +51,7 @@ public function shouldFilterOrganizationsWithStringArgument() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/members') + ->with($this->getPath() . '/members') ->will($this->returnValue($filter)); $this->assertEquals($filter, $api->filter($this->fakeParentId, $filter)); @@ -62,12 +62,12 @@ public function shouldFilterOrganizationsWithStringArgument() */ public function shouldFilterOrganizationsWithArrayArgument() { - $filter = array('members','public'); + $filter = ['members', 'public']; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/members,public') + ->with($this->getPath() . '/members,public') ->will($this->returnValue($filter)); $this->assertEquals($filter, $api->filter($this->fakeParentId, $filter)); @@ -81,7 +81,7 @@ public function shouldGetOrganizationsAMemberIsInvitedTo() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'Invited') + ->with($this->getPath() . 'Invited') ->will($this->returnValue($this->fakeParentId)); $this->assertEquals($this->fakeParentId, $api->invitedTo($this->fakeParentId)); @@ -97,7 +97,7 @@ public function shouldGetFieldOfAnOrganizationAMemberIsInvitedTo() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'Invited/desc') + ->with($this->getPath() . 'Invited/desc') ->will($this->returnValue($field)); $this->assertEquals($field, $api->invitedToField($this->fakeParentId, $field)); diff --git a/test/Trello/Tests/Unit/Api/MemberTest.php b/test/Trello/Tests/Unit/Api/MemberTest.php index 2014016..efc8c9d 100644 --- a/test/Trello/Tests/Unit/Api/MemberTest.php +++ b/test/Trello/Tests/Unit/Api/MemberTest.php @@ -15,12 +15,12 @@ class MemberTest extends TestCase */ public function shouldShowMember() { - $expectedArray = array('id' => $this->fakeMemberId); + $expectedArray = ['id' => $this->fakeMemberId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeMemberId) + ->with($this->apiPath . '/' . $this->fakeMemberId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($this->fakeMemberId)); @@ -31,12 +31,12 @@ public function shouldShowMember() */ public function shouldUpdateMember() { - $expectedArray = array('id' => $this->fakeMemberId); + $expectedArray = ['id' => $this->fakeMemberId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeMemberId) + ->with($this->apiPath . '/' . $this->fakeMemberId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update($this->fakeMemberId, $expectedArray)); @@ -47,12 +47,12 @@ public function shouldUpdateMember() */ public function shouldGetDeltas() { - $expectedArray = array('id' => $this->fakeMemberId); + $expectedArray = ['id' => $this->fakeMemberId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeMemberId.'/deltas') + ->with($this->apiPath . '/' . $this->fakeMemberId . '/deltas') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->getDeltas($this->fakeMemberId)); @@ -68,7 +68,7 @@ public function shouldSetUsername() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeMemberId.'/username') + ->with($this->apiPath . '/' . $this->fakeMemberId . '/username') ->will($this->returnValue($username)); $this->assertEquals($username, $api->setUsername($this->fakeMemberId, $username)); @@ -84,7 +84,7 @@ public function shouldSetBio() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeMemberId.'/bio') + ->with($this->apiPath . '/' . $this->fakeMemberId . '/bio') ->will($this->returnValue($bio)); $this->assertEquals($bio, $api->setBio($this->fakeMemberId, $bio)); @@ -100,7 +100,7 @@ public function shouldSetAvatar() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with($this->apiPath.'/'.$this->fakeMemberId.'/avatar') + ->with($this->apiPath . '/' . $this->fakeMemberId . '/avatar') ->will($this->returnValue($avatar)); $this->assertEquals($avatar, $api->setAvatar($this->fakeMemberId, $avatar)); @@ -116,7 +116,7 @@ public function shouldSetAvatarSource() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeMemberId.'/avatarSource') + ->with($this->apiPath . '/' . $this->fakeMemberId . '/avatarSource') ->will($this->returnValue($avatarSource)); $this->assertEquals($avatarSource, $api->setAvatarSource($this->fakeMemberId, $avatarSource)); @@ -132,7 +132,7 @@ public function shouldSetInitials() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeMemberId.'/initials') + ->with($this->apiPath . '/' . $this->fakeMemberId . '/initials') ->will($this->returnValue($initials)); $this->assertEquals($initials, $api->setInitials($this->fakeMemberId, $initials)); @@ -148,7 +148,7 @@ public function shouldSetFullName() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeMemberId.'/fullName') + ->with($this->apiPath . '/' . $this->fakeMemberId . '/fullName') ->will($this->returnValue($fullName)); $this->assertEquals($fullName, $api->setFullName($this->fakeMemberId, $fullName)); diff --git a/test/Trello/Tests/Unit/Api/NotificationTest.php b/test/Trello/Tests/Unit/Api/NotificationTest.php index e75161b..60af896 100644 --- a/test/Trello/Tests/Unit/Api/NotificationTest.php +++ b/test/Trello/Tests/Unit/Api/NotificationTest.php @@ -14,12 +14,12 @@ class NotificationTest extends TestCase */ public function shouldShowNotification() { - $expectedArray = array('id' => $this->fakeId); + $expectedArray = ['id' => $this->fakeId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('notifications/'.$this->fakeId) + ->with('notifications/' . $this->fakeId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($this->fakeId)); @@ -30,12 +30,12 @@ public function shouldShowNotification() */ public function shouldUpdateNotification() { - $expectedArray = array('id' => $this->fakeId); + $expectedArray = ['id' => $this->fakeId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('notifications/'.$this->fakeId) + ->with('notifications/' . $this->fakeId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update($this->fakeId, $expectedArray)); @@ -46,12 +46,12 @@ public function shouldUpdateNotification() */ public function shouldSetUnread() { - $expectedArray = array('id' => $this->fakeId); + $expectedArray = ['id' => $this->fakeId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with('notifications/'.$this->fakeId.'/unread') + ->with('notifications/' . $this->fakeId . '/unread') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->setUnread($this->fakeId, true)); @@ -62,7 +62,7 @@ public function shouldSetUnread() */ public function shouldSetAllRead() { - $expectedArray = array(); + $expectedArray = []; $api = $this->getApiMock(); $api->expects($this->once()) @@ -78,12 +78,12 @@ public function shouldSetAllRead() */ public function shouldGetEntities() { - $expectedArray = array(); + $expectedArray = []; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('notifications/'.$this->fakeId.'/entities') + ->with('notifications/' . $this->fakeId . '/entities') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->getEntities($this->fakeId)); @@ -97,7 +97,7 @@ public function shouldGetBoard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/board') + ->with($this->apiPath . '/' . $this->fakeParentId . '/board') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoard($this->fakeParentId)); @@ -111,7 +111,7 @@ public function shouldGetBoardField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/board/name') + ->with($this->apiPath . '/' . $this->fakeParentId . '/board/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getBoardField($this->fakeParentId, 'name')); @@ -138,7 +138,7 @@ public function shouldGetList() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/list') + ->with($this->apiPath . '/' . $this->fakeParentId . '/list') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getList($this->fakeParentId)); @@ -152,7 +152,7 @@ public function shouldGetListField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/list/name') + ->with($this->apiPath . '/' . $this->fakeParentId . '/list/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getListField($this->fakeParentId, 'name')); @@ -179,7 +179,7 @@ public function shouldGetCard() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/card') + ->with($this->apiPath . '/' . $this->fakeParentId . '/card') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getCard($this->fakeParentId)); @@ -193,7 +193,7 @@ public function shouldGetCardField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/card/name') + ->with($this->apiPath . '/' . $this->fakeParentId . '/card/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getCardField($this->fakeParentId, 'name')); @@ -220,7 +220,7 @@ public function shouldGetMember() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/member') + ->with($this->apiPath . '/' . $this->fakeParentId . '/member') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getMember($this->fakeParentId)); @@ -234,7 +234,7 @@ public function shouldGetMemberField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/member/bio') + ->with($this->apiPath . '/' . $this->fakeParentId . '/member/bio') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getMemberField($this->fakeParentId, 'bio')); @@ -261,7 +261,7 @@ public function shouldGetCreator() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/memberCreator') + ->with($this->apiPath . '/' . $this->fakeParentId . '/memberCreator') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getCreator($this->fakeParentId)); @@ -275,7 +275,7 @@ public function shouldGetCreatorField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/memberCreator/bio') + ->with($this->apiPath . '/' . $this->fakeParentId . '/memberCreator/bio') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getCreatorField($this->fakeParentId, 'bio')); @@ -302,7 +302,7 @@ public function shouldGetOrganization() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/organization') + ->with($this->apiPath . '/' . $this->fakeParentId . '/organization') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getOrganization($this->fakeParentId)); @@ -316,7 +316,7 @@ public function shouldGetOrganizationField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeParentId.'/organization/name') + ->with($this->apiPath . '/' . $this->fakeParentId . '/organization/name') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getOrganizationField($this->fakeParentId, 'name')); diff --git a/test/Trello/Tests/Unit/Api/OrganizationTest.php b/test/Trello/Tests/Unit/Api/OrganizationTest.php index 59f1346..f1adfbf 100644 --- a/test/Trello/Tests/Unit/Api/OrganizationTest.php +++ b/test/Trello/Tests/Unit/Api/OrganizationTest.php @@ -12,7 +12,7 @@ class OrganizationTest extends TestCase */ public function shouldShowOrganization() { - $expectedArray = array('id' => '54744b094fef0c7d704ca379'); + $expectedArray = ['id' => '54744b094fef0c7d704ca379']; $api = $this->getApiMock(); $api->expects($this->once()) diff --git a/test/Trello/Tests/Unit/Api/TestCase.php b/test/Trello/Tests/Unit/Api/TestCase.php index a8d4f58..edcdd19 100644 --- a/test/Trello/Tests/Unit/Api/TestCase.php +++ b/test/Trello/Tests/Unit/Api/TestCase.php @@ -22,24 +22,24 @@ protected function getPath() protected function getApiMock() { $httpClient = $this->getMockBuilder('GuzzleHttp\Client') - ->setMethods(array('send')) + ->setMethods(['send']) ->getMock(); $httpClient->expects($this->any()) ->method('send'); $mock = $this->getMockBuilder('Trello\HttpClient\HttpClient') - ->setConstructorArgs(array( - array(), + ->setConstructorArgs([ + [], $httpClient - )) + ]) ->getMock(); $client = new \Trello\Client($mock); $client->setHttpClient($mock); return $this->getMockBuilder($this->getApiClass()) - ->setMethods(array('get', 'post', 'postRaw', 'patch', 'delete', 'put', 'head')) - ->setConstructorArgs(array($client)) + ->setMethods(['get', 'post', 'postRaw', 'patch', 'delete', 'put', 'head']) + ->setConstructorArgs([$client]) ->getMock(); } } diff --git a/test/Trello/Tests/Unit/Api/Token/WebhooksTest.php b/test/Trello/Tests/Unit/Api/Token/WebhooksTest.php index d491d95..d4c9ee1 100644 --- a/test/Trello/Tests/Unit/Api/Token/WebhooksTest.php +++ b/test/Trello/Tests/Unit/Api/Token/WebhooksTest.php @@ -16,10 +16,10 @@ class WebhooksTest extends TestCase */ public function shouldCreateWebhook() { - $expectedArray = array( + $expectedArray = [ 'callbackURL' => 'http://www.callback.com/', 'idModel' => $this->fakeId('board') - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) @@ -36,9 +36,9 @@ public function shouldCreateWebhook() */ public function shouldNotCreateWebhookWithoutCallbackUrl() { - $data = array( + $data = [ 'idModel' => $this->fakeId('board') - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -53,9 +53,9 @@ public function shouldNotCreateWebhookWithoutCallbackUrl() */ public function shouldNotCreateWebhookWithoutModelId() { - $data = array( + $data = [ 'callbackUrl' => 'http://www.callback.com/' - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -69,10 +69,10 @@ public function shouldNotCreateWebhookWithoutModelId() */ public function shouldUpdateWebhook() { - $expectedArray = array( + $expectedArray = [ 'callbackURL' => 'http://www.callback.com/', 'idModel' => $this->fakeId('board') - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) @@ -89,9 +89,9 @@ public function shouldUpdateWebhook() */ public function shouldNotUpdateWebhookWithoutCallbackUrl() { - $data = array( + $data = [ 'idModel' => $this->fakeId('board') - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -106,9 +106,9 @@ public function shouldNotUpdateWebhookWithoutCallbackUrl() */ public function shouldNotUpdateWebhookWithoutModelId() { - $data = array( + $data = [ 'callbackUrl' => 'http://www.callback.com/' - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -125,7 +125,7 @@ public function shouldRemoveWebhook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->remove($this->fakeParentId, $this->fakeId)); @@ -153,7 +153,7 @@ public function shouldShowWebhook() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->getPath().'/'.$this->fakeId) + ->with($this->getPath() . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->show($this->fakeParentId, $this->fakeId)); diff --git a/test/Trello/Tests/Unit/Api/TokenTest.php b/test/Trello/Tests/Unit/Api/TokenTest.php index 4721536..4591be9 100644 --- a/test/Trello/Tests/Unit/Api/TokenTest.php +++ b/test/Trello/Tests/Unit/Api/TokenTest.php @@ -15,12 +15,12 @@ class TokenTest extends TestCase */ public function shouldShowToken() { - $expectedArray = array('id' => $this->fakeId); + $expectedArray = ['id' => $this->fakeId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeId) + ->with($this->apiPath . '/' . $this->fakeId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($this->fakeId)); @@ -34,7 +34,7 @@ public function shouldRemoveToken() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->apiPath.'/'.$this->fakeId) + ->with($this->apiPath . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->remove($this->fakeId)); @@ -48,7 +48,7 @@ public function shouldGetMember() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeId.'/member') + ->with($this->apiPath . '/' . $this->fakeId . '/member') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getMember($this->fakeId)); @@ -62,7 +62,7 @@ public function shouldGetMemberField() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeId.'/member/fullName') + ->with($this->apiPath . '/' . $this->fakeId . '/member/fullName') ->will($this->returnValue(true)); $this->assertEquals(true, $api->getMemberField($this->fakeId, 'fullName')); diff --git a/test/Trello/Tests/Unit/Api/WebhookTest.php b/test/Trello/Tests/Unit/Api/WebhookTest.php index 25df533..3ef5c49 100644 --- a/test/Trello/Tests/Unit/Api/WebhookTest.php +++ b/test/Trello/Tests/Unit/Api/WebhookTest.php @@ -15,12 +15,12 @@ class WebhookTest extends TestCase */ public function shouldShowWebhook() { - $expectedArray = array('id' => $this->fakeId); + $expectedArray = ['id' => $this->fakeId]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with($this->apiPath.'/'.$this->fakeId) + ->with($this->apiPath . '/' . $this->fakeId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->show($this->fakeId)); @@ -34,7 +34,7 @@ public function shouldRemoveToken() $api = $this->getApiMock(); $api->expects($this->once()) ->method('delete') - ->with($this->apiPath.'/'.$this->fakeId) + ->with($this->apiPath . '/' . $this->fakeId) ->will($this->returnValue(true)); $this->assertEquals(true, $api->remove($this->fakeId)); @@ -50,7 +50,7 @@ public function shouldSetDescription() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeId.'/description') + ->with($this->apiPath . '/' . $this->fakeId . '/description') ->will($this->returnValue($description)); $this->assertEquals($description, $api->setDescription($this->fakeId, $description)); @@ -66,7 +66,7 @@ public function shouldSetCallbackUrl() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeId.'/callbackUrl') + ->with($this->apiPath . '/' . $this->fakeId . '/callbackUrl') ->will($this->returnValue($description)); $this->assertEquals($description, $api->setCallbackUrl($this->fakeId, $description)); @@ -82,7 +82,7 @@ public function shouldSetModel() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeId.'/idModel') + ->with($this->apiPath . '/' . $this->fakeId . '/idModel') ->will($this->returnValue($modelId)); $this->assertEquals($modelId, $api->setModel($this->fakeId, $modelId)); @@ -98,7 +98,7 @@ public function shouldSetActive() $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeId.'/active') + ->with($this->apiPath . '/' . $this->fakeId . '/active') ->will($this->returnValue($status)); $this->assertEquals($status, $api->setActive($this->fakeId, $status)); @@ -109,10 +109,10 @@ public function shouldSetActive() */ public function shouldCreateWebhook() { - $expectedArray = array( + $expectedArray = [ 'callbackURL' => 'http://www.callback.com/', 'idModel' => $this->fakeId('board') - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) @@ -129,9 +129,9 @@ public function shouldCreateWebhook() */ public function shouldNotCreateWebhookWithoutCallbackUrl() { - $data = array( + $data = [ 'idModel' => $this->fakeId('board') - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -146,9 +146,9 @@ public function shouldNotCreateWebhookWithoutCallbackUrl() */ public function shouldNotCreateWebhookWithoutModelId() { - $data = array( + $data = [ 'callbackUrl' => 'http://www.callback.com/' - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -162,15 +162,15 @@ public function shouldNotCreateWebhookWithoutModelId() */ public function shouldUpdateWebhook() { - $expectedArray = array( + $expectedArray = [ 'callbackURL' => 'http://www.callback.com/', 'idModel' => $this->fakeId('board') - ); + ]; $api = $this->getApiMock(); $api->expects($this->once()) ->method('put') - ->with($this->apiPath.'/'.$this->fakeId) + ->with($this->apiPath . '/' . $this->fakeId) ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->update($this->fakeId, $expectedArray)); @@ -182,9 +182,9 @@ public function shouldUpdateWebhook() */ public function shouldNotUpdateWebhookWithoutCallbackUrl() { - $data = array( + $data = [ 'idModel' => $this->fakeId('board') - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) @@ -199,9 +199,9 @@ public function shouldNotUpdateWebhookWithoutCallbackUrl() */ public function shouldNotUpdateWebhookWithoutModelId() { - $data = array( + $data = [ 'callbackUrl' => 'http://www.callback.com/' - ); + ]; $api = $this->getApiMock(); $api->expects($this->never()) diff --git a/test/Trello/Tests/Unit/ClientTest.php b/test/Trello/Tests/Unit/ClientTest.php index 5f3d6a6..5f809a0 100644 --- a/test/Trello/Tests/Unit/ClientTest.php +++ b/test/Trello/Tests/Unit/ClientTest.php @@ -1,4 +1,5 @@ getHttpClientMock(array('addListener')); + $httpClient = $this->getHttpClientMock(['addListener']); $client = new Client($httpClient); $client->authenticate('login', null, null); } @@ -87,7 +88,7 @@ public function shouldThrowExceptionWhenAuthenticatingWithoutMethodSet() */ public function shouldClearHeadersLazy() { - $httpClient = $this->getHttpClientMock(array('clearHeaders')); + $httpClient = $this->getHttpClientMock(['clearHeaders']); $httpClient->expects($this->once())->method('clearHeaders'); $client = new Client($httpClient); $client->clearHeaders(); @@ -98,7 +99,7 @@ public function shouldClearHeadersLazy() */ public function shouldSetHeadersLaizly() { - $headers = array('header1', 'header2'); + $headers = ['header1', 'header2']; $httpClient = $this->getHttpClientMock(); $httpClient->expects($this->once())->method('setHeaders')->with($headers); $client = new Client($httpClient); @@ -147,34 +148,34 @@ public function shouldNotGetMagicApiInstance() public function getApiClassesProvider() { - return array( - array('action', 'Trello\Api\Action'), - array('actions', 'Trello\Api\Action'), - array('board', 'Trello\Api\Board'), - array('boards', 'Trello\Api\Board'), - array('card', 'Trello\Api\Card'), - array('cards', 'Trello\Api\Card'), - array('checklist', 'Trello\Api\Checklist'), - array('checklists', 'Trello\Api\Checklist'), - array('list', 'Trello\Api\Cardlist'), - array('lists', 'Trello\Api\Cardlist'), - array('member', 'Trello\Api\Member'), - array('members', 'Trello\Api\Member'), - array('notification', 'Trello\Api\Notification'), - array('notifications', 'Trello\Api\Notification'), - array('organization', 'Trello\Api\Organization'), - array('organizations', 'Trello\Api\Organization'), - array('token', 'Trello\Api\Token'), - array('tokens', 'Trello\Api\Token'), - array('webhook', 'Trello\Api\Webhook'), - array('webhooks', 'Trello\Api\Webhook'), - ); + return [ + ['action', 'Trello\Api\Action'], + ['actions', 'Trello\Api\Action'], + ['board', 'Trello\Api\Board'], + ['boards', 'Trello\Api\Board'], + ['card', 'Trello\Api\Card'], + ['cards', 'Trello\Api\Card'], + ['checklist', 'Trello\Api\Checklist'], + ['checklists', 'Trello\Api\Checklist'], + ['list', 'Trello\Api\Cardlist'], + ['lists', 'Trello\Api\Cardlist'], + ['member', 'Trello\Api\Member'], + ['members', 'Trello\Api\Member'], + ['notification', 'Trello\Api\Notification'], + ['notifications', 'Trello\Api\Notification'], + ['organization', 'Trello\Api\Organization'], + ['organizations', 'Trello\Api\Organization'], + ['token', 'Trello\Api\Token'], + ['tokens', 'Trello\Api\Token'], + ['webhook', 'Trello\Api\Webhook'], + ['webhooks', 'Trello\Api\Webhook'], + ]; } - public function getHttpClientMock(array $methods = array()) + public function getHttpClientMock(array $methods = []) { $methods = array_merge( - array('get', 'post', 'patch', 'put', 'delete', 'request', 'setOption', 'setHeaders', 'authenticate'), + ['get', 'post', 'patch', 'put', 'delete', 'request', 'setOption', 'setHeaders', 'authenticate'], $methods ); diff --git a/test/Trello/Tests/Unit/HttpClient/HttpClientTest.php b/test/Trello/Tests/Unit/HttpClient/HttpClientTest.php index 13c650c..45a7bcc 100644 --- a/test/Trello/Tests/Unit/HttpClient/HttpClientTest.php +++ b/test/Trello/Tests/Unit/HttpClient/HttpClientTest.php @@ -14,9 +14,9 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase */ public function shouldBeAbleToPassOptionsToConstructor() { - $httpClient = new TestHttpClient(array( + $httpClient = new TestHttpClient([ 'timeout' => 33, - ), $this->getBrowserMock()); + ], $this->getBrowserMock()); $this->assertEquals(33, $httpClient->getOption('timeout')); $this->assertEquals(1, $httpClient->getOption('api_version')); @@ -27,7 +27,7 @@ public function shouldBeAbleToPassOptionsToConstructor() */ public function shouldBeAbleToSetOption() { - $httpClient = new TestHttpClient(array(), $this->getBrowserMock()); + $httpClient = new TestHttpClient([], $this->getBrowserMock()); $httpClient->setOption('timeout', 666); $this->assertEquals(666, $httpClient->getOption('timeout')); @@ -43,7 +43,7 @@ public function shouldAuthenticateUsingAllGivenParameters($login, $password, $me $listeners = $client->getEventDispatcher()->getListeners('request.before_send'); $this->assertCount(1, $listeners); - $httpClient = new TestHttpClient(array(), $client); + $httpClient = new TestHttpClient([], $client); $httpClient->authenticate($login, $password, $method); $listeners = $client->getEventDispatcher()->getListeners('request.before_send'); @@ -55,12 +55,12 @@ public function shouldAuthenticateUsingAllGivenParameters($login, $password, $me public function getAuthenticationFullData() { - return array( - array('login', 'password', Client::AUTH_HTTP_PASSWORD), - array('token', null, Client::AUTH_HTTP_TOKEN), - array('token', null, Client::AUTH_URL_TOKEN), - array('client_id', 'client_secret', Client::AUTH_URL_CLIENT_ID), - ); + return [ + ['login', 'password', Client::AUTH_HTTP_PASSWORD], + ['token', null, Client::AUTH_HTTP_TOKEN], + ['token', null, Client::AUTH_URL_TOKEN], + ['client_id', 'client_secret', Client::AUTH_URL_CLIENT_ID], + ]; } /** @@ -68,13 +68,13 @@ public function getAuthenticationFullData() */ public function shouldDoGETRequest() { - $path = '/some/path'; - $parameters = array('a' => 'b'); - $headers = array('c' => 'd'); + $path = '/some/path'; + $parameters = ['a' => 'b']; + $headers = ['c' => 'd']; $client = $this->getBrowserMock(); - $httpClient = new HttpClient(array(), $client); + $httpClient = new HttpClient([], $client); $httpClient->get($path, $parameters, $headers); } @@ -117,13 +117,13 @@ public function shouldDoGETRequest() */ public function shouldDoPATCHRequest() { - $path = '/some/path'; - $body = 'a = b'; - $headers = array('c' => 'd'); + $path = '/some/path'; + $body = 'a = b'; + $headers = ['c' => 'd']; $client = $this->getBrowserMock(); - $httpClient = new HttpClient(array(), $client); + $httpClient = new HttpClient([], $client); $httpClient->patch($path, $body, $headers); } @@ -132,13 +132,13 @@ public function shouldDoPATCHRequest() */ public function shouldDoDELETERequest() { - $path = '/some/path'; - $body = 'a = b'; - $headers = array('c' => 'd'); + $path = '/some/path'; + $body = 'a = b'; + $headers = ['c' => 'd']; $client = $this->getBrowserMock(); - $httpClient = new HttpClient(array(), $client); + $httpClient = new HttpClient([], $client); $httpClient->delete($path, $body, $headers); } @@ -147,12 +147,12 @@ public function shouldDoDELETERequest() */ public function shouldDoPUTRequest() { - $path = '/some/path'; - $headers = array('c' => 'd'); + $path = '/some/path'; + $headers = ['c' => 'd']; $client = $this->getBrowserMock(); - $httpClient = new HttpClient(array(), $client); + $httpClient = new HttpClient([], $client); $httpClient->put($path, $headers); } @@ -161,13 +161,13 @@ public function shouldDoPUTRequest() */ public function shouldDoCustomRequest() { - $path = '/some/path'; - $body = 'a = b'; - $options = array('c' => 'd'); + $path = '/some/path'; + $body = 'a = b'; + $options = ['c' => 'd']; $client = $this->getBrowserMock(); - $httpClient = new HttpClient(array(), $client); + $httpClient = new HttpClient([], $client); $httpClient->request($path, $body, 'HEAD', $options); } @@ -176,13 +176,13 @@ public function shouldDoCustomRequest() */ public function shouldAllowToReturnRawContent() { - $path = '/some/path'; - $parameters = array('a = b'); - $headers = array('c' => 'd'); + $path = '/some/path'; + $parameters = ['a = b']; + $headers = ['c' => 'd']; $message = $this->getMockBuilder('GuzzleHttp\Message\Response') - ->setConstructorArgs(array(200)) - ->setMethods(array('getBody')) + ->setConstructorArgs([200]) + ->setMethods(['getBody']) ->getMock(); $message->expects($this->once()) ->method('getBody') @@ -193,22 +193,22 @@ public function shouldAllowToReturnRawContent() ->method('send') ->will($this->returnValue($message)); - $httpClient = new TestHttpClient(array(), $client); + $httpClient = new TestHttpClient([], $client); $response = $httpClient->get($path, $parameters, $headers); $this->assertEquals("Just raw context", $response->getBody()); $this->assertInstanceOf('GuzzleHttp\Message\MessageInterface', $response); } - protected function getBrowserMock(array $methods = array()) + protected function getBrowserMock(array $methods = []) { - $mockMethods = array('send', 'createRequest') + $methods; - $mock = $this->getMockBuilder( 'GuzzleHttp\Client') + $mockMethods = ['send', 'createRequest'] + $methods; + $mock = $this->getMockBuilder('GuzzleHttp\Client') ->setMethods($mockMethods) ->getMock(); $requestMock = $this->getMockBuilder('GuzzleHttp\Message\Request') - ->setConstructorArgs(array('GET', 'some')) + ->setConstructorArgs(['GET', 'some']) ->getMock(); $mock->expects($this->any()) @@ -226,7 +226,7 @@ public function getOption($name, $default = null) return isset($this->options[$name]) ? $this->options[$name] : $default; } - public function request($path, $body, $httpMethod = 'GET', array $headers = array(), array $options = array()) + public function request($path, $body, $httpMethod = 'GET', array $headers = [], array $options = []) { $request = $this->client->createRequest($httpMethod, $path); diff --git a/test/Trello/Tests/Unit/HttpClient/Listener/AuthListenerTest.php b/test/Trello/Tests/Unit/HttpClient/Listener/AuthListenerTest.php index 2aeafac..c1a3136 100644 --- a/test/Trello/Tests/Unit/HttpClient/Listener/AuthListenerTest.php +++ b/test/Trello/Tests/Unit/HttpClient/Listener/AuthListenerTest.php @@ -1,4 +1,5 @@ getMockBuilder('GuzzleHttp\Message\RequestInterface') ->getMock(); $request->expects($this->once()) @@ -120,6 +121,7 @@ private function getEventMock($request = null) ->method('offsetGet') ->will($this->returnValue($request)); } + return $mock; } } diff --git a/test/Trello/Tests/Unit/HttpClient/Listener/ErrorListenerTest.php b/test/Trello/Tests/Unit/HttpClient/Listener/ErrorListenerTest.php index bb5210c..726e44b 100644 --- a/test/Trello/Tests/Unit/HttpClient/Listener/ErrorListenerTest.php +++ b/test/Trello/Tests/Unit/HttpClient/Listener/ErrorListenerTest.php @@ -1,4 +1,5 @@ createResponseMock( self::RESPONSE_IS_CLIENT_ERROR, 404, - json_encode(array('message' => 'test')) + json_encode(['message' => 'test']) ); $listener = new ErrorListener; @@ -79,7 +80,7 @@ public function shouldNotPassWhen400IsSent() $response = $this->createResponseMock( self::RESPONSE_IS_CLIENT_ERROR, 400, - json_encode(array('message' => 'test')) + json_encode(['message' => 'test']) ); $listener = new ErrorListener; @@ -93,17 +94,17 @@ public function shouldNotPassWhen400IsSent() */ public function shouldNotPassWhen422IsSentWithErrorCode($errorCode) { - $content = json_encode(array( + $content = json_encode([ 'message' => 'Validation Failed', - 'errors' => array( - array( - 'code' => $errorCode, - 'field' => 'test', - 'value' => 'wrong', + 'errors' => [ + [ + 'code' => $errorCode, + 'field' => 'test', + 'value' => 'wrong', 'resource' => 'fake' - ) - ) - )); + ] + ] + ]); $response = $this->createResponseMock( self::RESPONSE_IS_CLIENT_ERROR, 422, @@ -116,12 +117,12 @@ public function shouldNotPassWhen422IsSentWithErrorCode($errorCode) public function getErrorCodesProvider() { - return array( - array('missing'), - array('missing_field'), - array('invalid'), - array('already_exists'), - ); + return [ + ['missing'], + ['missing_field'], + ['invalid'], + ['already_exists'], + ]; } private function getEventMock($response) @@ -137,6 +138,7 @@ private function getEventMock($response) $mock->expects($this->any()) ->method('offsetGet') ->will($this->returnValue($request)); + return $mock; } @@ -144,7 +146,8 @@ private function createResponseMock( $isClientError, $httpStatusCode, $responseBody = '' - ) { + ) + { $mock = $this->getMockBuilder('GuzzleHttp\Message\Response') ->disableOriginalConstructor() ->getMock(); From cc6c133ea52b87ee939a489356a8f672c3b49ddf Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 03:45:36 +0100 Subject: [PATCH 13/18] v1.0.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c20584..1310e81 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Uses [Trello API v1](https://trello.com/docs/index.html). The object API is very The recommended way is using [composer](http://getcomposer.org): ```bash -$ composer require matteocacciola/php-trello-api:@dev +$ composer require matteocacciola/php-trello-api ``` However, `php-trello-api` follows the PSR-0 naming conventions, which means you can easily integrate `php-trello-api` class loading in your own autoloader. From 2a5ee9cee151d9b41a0ffc88051d5e1bfbd226bf Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Wed, 9 Dec 2020 03:48:28 +0100 Subject: [PATCH 14/18] v1.0.1 --- lib/Trello/Client.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Trello/Client.php b/lib/Trello/Client.php index 6fca2aa..c2fc59c 100644 --- a/lib/Trello/Client.php +++ b/lib/Trello/Client.php @@ -159,12 +159,13 @@ public function authenticate($tokenOrLogin, $password = null, $authMethod = null throw new InvalidArgumentException('You need to specify authentication method!'); } - if (null === $authMethod && in_array($password, [ - self::AUTH_URL_TOKEN, - self::AUTH_URL_CLIENT_ID, - self::AUTH_HTTP_PASSWORD, - self::AUTH_HTTP_TOKEN - ])) { + $valid = [ + self::AUTH_URL_TOKEN, + self::AUTH_URL_CLIENT_ID, + self::AUTH_HTTP_PASSWORD, + self::AUTH_HTTP_TOKEN + ]; + if (null === $authMethod && in_array($password, $valid)) { $authMethod = $password; $password = null; } From 8fb91f0d8330633e6fd0f8ecf303ab2ce5dd0f9c Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Mon, 14 Dec 2020 02:29:01 +0100 Subject: [PATCH 15/18] refactored the event emitters --- lib/Trello/HttpClient/HttpClient.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index cad6776..e91de07 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -41,7 +41,7 @@ public function __construct(array $options = [], ClientInterface $client = null) $client = $client ?: new GuzzleClient($this->options); $this->client = $client; - $this->addListener('request.error', [new ErrorListener(), 'onRequestError']); + $this->addListener('error', [new ErrorListener(), 'onRequestError']); $this->clearHeaders(); } @@ -164,7 +164,7 @@ public function request($path, $body = null, $httpMethod = 'GET', array $headers */ public function authenticate($tokenOrLogin, $password, $method) { - $this->addListener('request.before_send', [ + $this->addListener('beforeSend', [ new AuthListener($tokenOrLogin, $password, $method), 'onRequestBeforeSend', ]); From 5915e5222d011f733a340db1ad4b4364bd4596f5 Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Mon, 14 Dec 2020 02:30:54 +0100 Subject: [PATCH 16/18] minor changes --- lib/Trello/ClientInterface.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Trello/ClientInterface.php b/lib/Trello/ClientInterface.php index 5d2bfb6..9b1dc42 100644 --- a/lib/Trello/ClientInterface.php +++ b/lib/Trello/ClientInterface.php @@ -2,7 +2,10 @@ namespace Trello; +/** + * Interface ClientInterface + * @package Trello + */ interface ClientInterface { - } From 9ff1045bdfa7c99c3ceebb24d840611f0c382fd9 Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Mon, 14 Dec 2020 03:27:06 +0100 Subject: [PATCH 17/18] now GuzzleHttp perfectly works --- lib/Trello/HttpClient/HttpClient.php | 18 ++-- .../HttpClient/Subscriber/AuthSubscriber.php | 99 +++++++++++++++++++ .../HttpClient/Subscriber/ErrorSubscriber.php | 91 +++++++++++++++++ 3 files changed, 199 insertions(+), 9 deletions(-) create mode 100644 lib/Trello/HttpClient/Subscriber/AuthSubscriber.php create mode 100644 lib/Trello/HttpClient/Subscriber/ErrorSubscriber.php diff --git a/lib/Trello/HttpClient/HttpClient.php b/lib/Trello/HttpClient/HttpClient.php index e91de07..fc4e65c 100644 --- a/lib/Trello/HttpClient/HttpClient.php +++ b/lib/Trello/HttpClient/HttpClient.php @@ -4,13 +4,13 @@ use GuzzleHttp\Client as GuzzleClient; use GuzzleHttp\ClientInterface; +use GuzzleHttp\Event\SubscriberInterface; use GuzzleHttp\Message\Request; use GuzzleHttp\Message\Response; use Trello\Exception\ErrorException; use Trello\Exception\RuntimeException; -use Trello\HttpClient\Listener\AuthListener; -use Trello\HttpClient\Listener\ErrorListener; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Trello\HttpClient\Subscriber\AuthSubscriber; +use Trello\HttpClient\Subscriber\ErrorSubscriber; class HttpClient implements HttpClientInterface { @@ -41,7 +41,7 @@ public function __construct(array $options = [], ClientInterface $client = null) $client = $client ?: new GuzzleClient($this->options); $this->client = $client; - $this->addListener('error', [new ErrorListener(), 'onRequestError']); + $this->addSubscriber(new ErrorSubscriber()); $this->clearHeaders(); } @@ -81,7 +81,10 @@ public function addListener($eventName, $listener) $this->client->getEmitter()->on($eventName, $listener); } - public function addSubscriber(EventSubscriberInterface $subscriber) + /** + * @param SubscriberInterface $subscriber + */ + public function addSubscriber(SubscriberInterface $subscriber) { $this->client->getEmitter()->attach($subscriber); } @@ -164,10 +167,7 @@ public function request($path, $body = null, $httpMethod = 'GET', array $headers */ public function authenticate($tokenOrLogin, $password, $method) { - $this->addListener('beforeSend', [ - new AuthListener($tokenOrLogin, $password, $method), - 'onRequestBeforeSend', - ]); + $this->addSubscriber(new AuthSubscriber($tokenOrLogin, $password, $method)); } /** diff --git a/lib/Trello/HttpClient/Subscriber/AuthSubscriber.php b/lib/Trello/HttpClient/Subscriber/AuthSubscriber.php new file mode 100644 index 0000000..1ba71a1 --- /dev/null +++ b/lib/Trello/HttpClient/Subscriber/AuthSubscriber.php @@ -0,0 +1,99 @@ +tokenOrLogin = $tokenOrLogin; + $this->password = $password ?: null; + $this->method = $method; + } + + /** + * @inheritDoc + */ + public function getEvents() + { + return [ + 'before' => ['onRequestBeforeSend'] /** @see AuthSubscriber::onRequestBeforeSend() */ + ]; + } + + /** + * @param BeforeEvent $event + */ + public function onRequestBeforeSend(BeforeEvent $event) + { + $request = $event->getRequest(); + + // Skip by default + if (null === $this->method) { + return; + } + + switch ($this->method) { + case Client::AUTH_HTTP_PASSWORD: + $request->setHeader( + 'Authorization', + sprintf('Basic %s', base64_encode($this->tokenOrLogin . ':' . $this->password)) + ); + break; + + case Client::AUTH_HTTP_TOKEN: + $request->setHeader( + 'Authorization', + sprintf('token %s', $this->tokenOrLogin) + ); + break; + + case Client::AUTH_URL_CLIENT_ID: + $url = $request->getUrl(); + + $parameters = [ + 'key' => $this->tokenOrLogin, + 'token' => $this->password, + ]; + + $url .= (false === strpos($url, '?') ? '?' : '&'); + $url .= utf8_encode(http_build_query($parameters, '', '&')); + + $request->setUrl($url); + break; + + case Client::AUTH_URL_TOKEN: + $url = $request->getUrl(); + $url .= (false === strpos($url, '?') ? '?' : '&'); + $url .= utf8_encode(http_build_query( + ['token' => $this->tokenOrLogin, 'key' => $this->password], + '', + '&' + )); + + $request->setUrl($url); + break; + + default: + throw new RuntimeException(sprintf('%s not yet implemented', $this->method)); + } + } +} diff --git a/lib/Trello/HttpClient/Subscriber/ErrorSubscriber.php b/lib/Trello/HttpClient/Subscriber/ErrorSubscriber.php new file mode 100644 index 0000000..31027e6 --- /dev/null +++ b/lib/Trello/HttpClient/Subscriber/ErrorSubscriber.php @@ -0,0 +1,91 @@ + ['onRequestError'] /** @see ErrorSubscriber::onRequestError() */ + ]; + } + + /** + * @param ErrorEvent $event + * + * @throws ErrorException + * @throws ValidationFailedException + */ + public function onRequestError(ErrorEvent $event) + { + /** @var Response $response */ + $response = $event->getResponse(); + + switch ($response->getStatusCode()) { + case 429: + throw new ApiLimitExceedException('Wait a second.', 429); + break; + } + + $content = ResponseMediator::getContent($response); + if (is_array($content) && isset($content['message'])) { + if (400 == $response->getStatusCode()) { + throw new ErrorException($content['message'], 400); + } + + if (401 == $response->getStatusCode()) { + throw new PermissionDeniedException($content['message'], 401); + } + + if (422 == $response->getStatusCode() && isset($content['errors'])) { + $errors = []; + foreach ($content['errors'] as $error) { + switch ($error['code']) { + case 'missing': + $errors[] = sprintf('The %s %s does not exist, for resource "%s"', $error['field'], $error['value'], $error['resource']); + break; + + case 'missing_field': + $errors[] = sprintf('Field "%s" is missing, for resource "%s"', $error['field'], $error['resource']); + break; + + case 'invalid': + $errors[] = sprintf('Field "%s" is invalid, for resource "%s"', $error['field'], $error['resource']); + break; + + case 'already_exists': + $errors[] = sprintf('Field "%s" already exists, for resource "%s"', $error['field'], $error['resource']); + break; + + default: + $errors[] = $error['message']; + break; + + } + } + + throw new ValidationFailedException('Validation Failed: ' . implode(', ', $errors), 422); + } + } + + throw new RuntimeException(isset($content['message']) ? $content['message'] : $content, $response->getStatusCode()); + } +} From 696a9b7cd572df69960004db85df53cc9e3dc302 Mon Sep 17 00:00:00 2001 From: Matteo Cacciola Date: Mon, 14 Dec 2020 03:29:34 +0100 Subject: [PATCH 18/18] minor changes to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1310e81..62975b3 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Uses [Trello API v1](https://trello.com/docs/index.html). The object API is very ## Requirements * PHP >= 7.4 with [cURL](http://php.net/manual/en/book.curl.php) extension, -* [Guzzle](https://github.com/guzzle/guzzle) library, +* [Guzzle](https://github.com/guzzle/guzzle) 5.3 library, * (optional) [PHPUnit](https://phpunit.de) to run tests. ## Installation