for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?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);