Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
skie committed Apr 20, 2018
2 parents e5acb23 + 28db47d commit 2b13b14
Show file tree
Hide file tree
Showing 163 changed files with 1,271 additions and 694 deletions.
2 changes: 1 addition & 1 deletion .semver
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
:major: 5
:major: 6
:minor: 0
:patch: 0
:special: ''
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ The **CakePHP-API** Plugin allows to easily expose a versioned API in a few line
Versions and branches
---------------------

| CakePHP | CakeDC Users Plugin | Tag | Notes |
| CakePHP | CakeDC Api Plugin | Tag | Notes |
| :-------------: | :------------------------: | :--: | :---- |
| 3.5 | [5.x](https://github.com/cakedc/cakephp-api/tree/5.0.0) | 5.0.0 | stable |
| 3.4 | [4.x](https://github.com/cakedc/cakephp-api/tree/4.0.0) | 4.0.0 | stable |
| 3.3 | [3.x](https://github.com/cakedc/cakephp-api/tree/3.3) | 3.3 | stable |
| ^3.6 | [master](https://github.com/cakedc/cakephp-api/tree/master) | 6.0.0 | stable |
| ^3.6 | [develop](https://github.com/cakedc/cakephp-api/tree/develop) | - | unstable |
| 3.5 | [5.x](https://github.com/cakedc/cakephp-api/tree/5.0.0) | 5.0.0 | stable |
| 3.4 | [4.x](https://github.com/cakedc/cakephp-api/tree/4.0.0) | 4.0.0 | stable |
| 3.3 | [3.x](https://github.com/cakedc/cakephp-api/tree/3.3) | 3.3 | stable |

Documentation
-------------
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
},
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "^3.4",
"cakedc/users": "^5.0|^6.0"
"cakephp/cakephp": "^3.6",
"cakedc/users": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "<6.0"
Expand Down
67 changes: 67 additions & 0 deletions src/Collection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

namespace CakeDC\Api;

use ArrayIterator;
use Cake\Core\InstanceConfigTrait;
use Cake\Core\ObjectRegistry;
use IteratorAggregate;

abstract class Collection extends ObjectRegistry implements IteratorAggregate
{
use InstanceConfigTrait;

/**
* Config array.
*
* @var array
*/
protected $_defaultConfig = [];

/**
* Constructor
*
* @param array $config Configuration
*/
public function __construct(array $config = [])
{
$this->setConfig($config);

foreach ($config as $key => $value) {
if (is_int($key)) {
$this->load($value);
continue;
}
$this->load($key, $value);
}
}

/**
* Returns true if a collection is empty.
*
* @return bool
*/
public function isEmpty()
{
return empty($this->_loaded);
}

/**
* Returns iterator.
*
* @return \ArrayIterator
*/
public function getIterator()
{
return new ArrayIterator($this->_loaded);
}
}
6 changes: 3 additions & 3 deletions src/Controller/ApiController.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down Expand Up @@ -106,7 +106,7 @@ protected function _process($options = [])
'baseUrl' => Inflector::underscore($url),
];
$options += (new ConfigReader())->serviceOptions($service, $version);
$Service = ServiceRegistry::get($service, $options);
$Service = ServiceRegistry::getServiceLocator()->get($service, $options);
$result = $Service->dispatch();

return $Service->respond($result);
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/AppController.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down
4 changes: 2 additions & 2 deletions src/Exception/MethodNotAllowedException.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down
4 changes: 2 additions & 2 deletions src/Exception/ServiceException.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down
4 changes: 2 additions & 2 deletions src/Exception/UnauthenticatedException.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down
4 changes: 2 additions & 2 deletions src/Exception/UnauthorizedException.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down
4 changes: 2 additions & 2 deletions src/Exception/ValidationException.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down
6 changes: 3 additions & 3 deletions src/Middleware/ApiMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down Expand Up @@ -64,7 +64,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res

try {
$options += (new ConfigReader())->serviceOptions($service, $version);
$Service = ServiceRegistry::get($service, $options);
$Service = ServiceRegistry::getServiceLocator()->get($service, $options);
$result = $Service->dispatch();

$response = $Service->respond($result);
Expand Down
4 changes: 2 additions & 2 deletions src/Middleware/RequestHandlerMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down
4 changes: 2 additions & 2 deletions src/Model/Entity/EntityDescriptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down
4 changes: 2 additions & 2 deletions src/Model/Entity/EntityLabelsInterface.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down
4 changes: 2 additions & 2 deletions src/Routing/ApiRouter.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2016 - 2017, Cake Development Corporation (http://cakedc.com)
* @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

Expand Down

0 comments on commit 2b13b14

Please sign in to comment.