Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 02413f3

Browse files
Upgrade to Symfony 5.x (cdaguerre#82)
* Guzzle 7 * Guzzle 7 * Revert "Guzzle 7" This reverts commit 7ea092e * Revert "Guzzle 7" This reverts commit f1b2cd9 * Revert "Revert "Guzzle 7"" This reverts commit 2c79b42 * Revert "Revert "Guzzle 7"" This reverts commit ac07e58 * Guzzle 5.3 * Solving some problems * Solving some problems * changes in http request * v1 * v1.0.1 * v1.0.1 * v1.0.1
1 parent 579530b commit 02413f3

File tree

92 files changed

+1307
-1292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1307
-1292
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ composer.lock
33
composer.phar
44
build/*
55
vendor/*
6+
*.idea/

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
PHP Trello API v1 client
1+
PHP Trello API v2 client
22
========================
33

44
[![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)
55
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/cdaguerre/php-trello-api/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/cdaguerre/php-trello-api/?branch=master)
66
[![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/)
77
[![Packagist](https://img.shields.io/packagist/dt/cdaguerre/php-trello-api.svg?style=flat-square)](https://packagist.org/packages/cdaguerre/php-trello-api)
88

9-
A simple Object Oriented wrapper for the Trello API, written in PHP5.
9+
A simple Object Oriented wrapper for the Trello API, written in PHP7.4.
1010

1111
Uses [Trello API v1](https://trello.com/docs/index.html). The object API is very similar to the RESTful API.
1212

@@ -15,10 +15,11 @@ Uses [Trello API v1](https://trello.com/docs/index.html). The object API is very
1515
* Follows PSR-0 conventions and coding standards: autoload friendly
1616
* Light and fast thanks to lazy loading of API classes
1717
* Extensively tested
18+
* Ready for Symfony 5
1819

1920
## Requirements
2021

21-
* PHP >= 5.3.2 with [cURL](http://php.net/manual/en/book.curl.php) extension,
22+
* PHP >= 7.4 with [cURL](http://php.net/manual/en/book.curl.php) extension,
2223
* [Guzzle](https://github.com/guzzle/guzzle) library,
2324
* (optional) [PHPUnit](https://phpunit.de) to run tests.
2425

@@ -27,7 +28,7 @@ Uses [Trello API v1](https://trello.com/docs/index.html). The object API is very
2728
The recommended way is using [composer](http://getcomposer.org):
2829

2930
```bash
30-
$ composer require cdaguerre/php-trello-api:@dev
31+
$ composer require matteocacciola/php-trello-api
3132
```
3233
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.
3334

@@ -107,5 +108,6 @@ Feel free to make any comments, file issues or make pull requests.
107108

108109
## Credits
109110

111+
- Forked by [cdaguerre/php-trello-api](https://github.com/cdaguerre/php-trello-api)
110112
- Largely inspired by the excellent [php-github-api](https://github.com/KnpLabs/php-github-api) developed by the guys at [KnpLabs](http://knplabs.fr)
111113
- Thanks to Trello for the API and documentation.

composer.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
{
2-
"name": "cdaguerre/php-trello-api",
2+
"name": "matteocacciola/php-trello-api",
33
"type": "library",
4-
"description": "Trello API v1 client",
5-
"homepage": "https://github.com/cdaguerre/php-trello-api",
4+
"description": "Trello API v2 client",
5+
"homepage": "https://github.com/matteocacciola/php-trello-api",
66
"keywords": ["trello"],
77
"license": "MIT",
88
"authors": [
99
{
1010
"name": "Christian Daguerre",
1111
"email": "[email protected]"
12+
},
13+
{
14+
"name": "Matteo Cacciola",
15+
"email": "[email protected]"
1216
}
1317
],
1418
"require": {
15-
"php": ">=5.3",
16-
"guzzlehttp/guzzle": "~3.7"
19+
"php": ">=7.4",
20+
"guzzlehttp/guzzle": "~5.3"
1721
},
1822
"require-dev": {
1923
"phpunit/phpunit": "^4.8"

lib/Trello/Api/AbstractApi.php

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function __construct(Client $client)
4848
* Catches any undefined "get{$field}" calls, and passes them
4949
* to the getField() if the $field is in the $this->fields property
5050
*
51-
* @param string $method called method
52-
* @param array $arguments array of arguments passed to called method
51+
* @param string $method called method
52+
* @param array $arguments array of arguments passed to called method
5353
*
5454
* @return array
5555
*
@@ -85,7 +85,7 @@ public function getFields()
8585
/**
8686
* Get a field value by field name
8787
*
88-
* @param string $id the board's id
88+
* @param string $id the board's id
8989
* @param string $field the field
9090
*
9191
* @return mixed field value
@@ -98,21 +98,21 @@ public function getField($id, $field)
9898
throw new InvalidArgumentException(sprintf('There is no field named %s.', $field));
9999
}
100100

101-
$response = $this->get($this->path.'/'.rawurlencode($id).'/'.rawurlencode($field));
101+
$response = $this->get($this->path . '/' . rawurlencode($id) . '/' . rawurlencode($field));
102102

103103
return isset($response['_value']) ? $response['_value'] : $response;
104104
}
105105

106106
/**
107107
* Send a GET request with query parameters.
108108
*
109-
* @param string $path Request path.
110-
* @param array $parameters GET parameters.
111-
* @param array $requestHeaders Request Headers.
109+
* @param string $path Request path.
110+
* @param array $parameters GET parameters.
111+
* @param array $requestHeaders Request Headers.
112112
*
113-
* @return \Guzzle\Http\EntityBodyInterface|mixed|string
113+
* @return mixed
114114
*/
115-
protected function get($path, array $parameters = array(), $requestHeaders = array())
115+
protected function get($path, array $parameters = [], $requestHeaders = [])
116116
{
117117
$response = $this->client->getHttpClient()->get($path, $parameters, $requestHeaders);
118118

@@ -122,31 +122,31 @@ protected function get($path, array $parameters = array(), $requestHeaders = arr
122122
/**
123123
* Send a HEAD request with query parameters
124124
*
125-
* @param string $path Request path.
126-
* @param array $parameters HEAD parameters.
127-
* @param array $requestHeaders Request headers.
125+
* @param string $path Request path.
126+
* @param array $parameters HEAD parameters.
127+
* @param array $requestHeaders Request headers.
128128
*
129-
* @return \Guzzle\Http\Message\Response
129+
* @return \GuzzleHttp\Message\Response
130130
*/
131-
protected function head($path, array $parameters = array(), $requestHeaders = array())
131+
protected function head($path, array $parameters = [], $requestHeaders = [])
132132
{
133-
$response = $this->client->getHttpClient()->request($path, null, 'HEAD', $requestHeaders, array(
133+
$response = $this->client->getHttpClient()->request($path, null, 'HEAD', $requestHeaders, [
134134
'query' => $parameters,
135-
));
135+
]);
136136

137137
return $response;
138138
}
139139

140140
/**
141141
* Send a POST request with JSON-encoded parameters.
142142
*
143-
* @param string $path Request path.
144-
* @param array $parameters POST parameters to be JSON encoded.
145-
* @param array $requestHeaders Request headers.
143+
* @param string $path Request path.
144+
* @param array $parameters POST parameters to be JSON encoded.
145+
* @param array $requestHeaders Request headers.
146146
*
147147
* @return mixed
148148
*/
149-
protected function post($path, array $parameters = array(), $requestHeaders = array())
149+
protected function post($path, array $parameters = [], $requestHeaders = [])
150150
{
151151
return $this->postRaw(
152152
$path,
@@ -158,13 +158,13 @@ protected function post($path, array $parameters = array(), $requestHeaders = ar
158158
/**
159159
* Send a POST request with raw data.
160160
*
161-
* @param string $path Request path.
162-
* @param mixed $body Request body.
163-
* @param array $requestHeaders Request headers.
161+
* @param string $path Request path.
162+
* @param mixed $body Request body.
163+
* @param array $requestHeaders Request headers.
164164
*
165-
* @return \Guzzle\Http\EntityBodyInterface|mixed|string
165+
* @return mixed
166166
*/
167-
protected function postRaw($path, $body, $requestHeaders = array())
167+
protected function postRaw($path, $body, $requestHeaders = [])
168168
{
169169
$response = $this->client->getHttpClient()->post(
170170
$path,
@@ -178,13 +178,13 @@ protected function postRaw($path, $body, $requestHeaders = array())
178178
/**
179179
* Send a PATCH request with JSON-encoded parameters.
180180
*
181-
* @param string $path Request path.
182-
* @param array $parameters POST parameters to be JSON encoded.
183-
* @param array $requestHeaders Request headers.
181+
* @param string $path Request path.
182+
* @param array $parameters POST parameters to be JSON encoded.
183+
* @param array $requestHeaders Request headers.
184184
*
185185
* @return mixed
186186
*/
187-
protected function patch($path, array $parameters = array(), $requestHeaders = array())
187+
protected function patch($path, array $parameters = [], $requestHeaders = [])
188188
{
189189
$response = $this->client->getHttpClient()->patch(
190190
$path,
@@ -198,13 +198,13 @@ protected function patch($path, array $parameters = array(), $requestHeaders = a
198198
/**
199199
* Send a PUT request with JSON-encoded parameters.
200200
*
201-
* @param string $path Request path.
202-
* @param array $parameters POST parameters to be JSON encoded.
203-
* @param array $requestHeaders Request headers.
201+
* @param string $path Request path.
202+
* @param array $parameters POST parameters to be JSON encoded.
203+
* @param array $requestHeaders Request headers.
204204
*
205205
* @return mixed
206206
*/
207-
protected function put($path, array $parameters = array(), $requestHeaders = array())
207+
protected function put($path, array $parameters = [], $requestHeaders = [])
208208
{
209209
foreach ($parameters as $name => $parameter) {
210210
if (is_bool($parameter)) {
@@ -224,13 +224,13 @@ protected function put($path, array $parameters = array(), $requestHeaders = arr
224224
/**
225225
* Send a DELETE request with JSON-encoded parameters.
226226
*
227-
* @param string $path Request path.
228-
* @param array $parameters POST parameters to be JSON encoded.
229-
* @param array $requestHeaders Request headers.
227+
* @param string $path Request path.
228+
* @param array $parameters POST parameters to be JSON encoded.
229+
* @param array $requestHeaders Request headers.
230230
*
231231
* @return mixed
232232
*/
233-
protected function delete($path, array $parameters = array(), $requestHeaders = array())
233+
protected function delete($path, array $parameters = [], $requestHeaders = [])
234234
{
235235
$response = $this->client->getHttpClient()->delete(
236236
$path,
@@ -258,7 +258,7 @@ protected function createParametersBody(array $parameters)
258258
if (is_bool($subParameter)) {
259259
$subParameter = $subParameter ? 'true' : 'false';
260260
}
261-
$parameters[$name.'/'.$subName] = $subParameter;
261+
$parameters[$name . '/' . $subName] = $subParameter;
262262
}
263263
unset($parameters[$name]);
264264
} elseif ($parameter instanceof DateTime) {
@@ -282,7 +282,7 @@ protected function getPath($id = null)
282282
* Validate parameters array
283283
*
284284
* @param string[] $required required properties (array keys)
285-
* @param array $params array to check for existence of the required keys
285+
* @param array $params array to check for existence of the required keys
286286
*
287287
* @throws MissingArgumentException if a required parameter is missing
288288
*/
@@ -299,8 +299,8 @@ protected function validateRequiredParameters(array $required, array $params)
299299
* Validate allowed parameters array
300300
* Checks whether the passed parameters are allowed
301301
*
302-
* @param string[] $allowed allowed properties
303-
* @param array|string $params array to check
302+
* @param string[] $allowed allowed properties
303+
* @param array|string $params array to check
304304
* @param string $paramName
305305
*
306306
* @return array array of validated parameters
@@ -310,7 +310,7 @@ protected function validateRequiredParameters(array $required, array $params)
310310
protected function validateAllowedParameters(array $allowed, $params, $paramName)
311311
{
312312
if (!is_array($params)) {
313-
$params = array($params);
313+
$params = [$params];
314314
}
315315

316316
foreach ($params as $param) {
@@ -332,7 +332,7 @@ protected function validateAllowedParameters(array $allowed, $params, $paramName
332332
* the keys in a given array
333333
*
334334
* @param string[] $atLeastOneOf allowed properties
335-
* @param array $params array to check
335+
* @param array $params array to check
336336
*
337337
* @return boolean
338338
*

0 commit comments

Comments
 (0)