for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace micmania1\config;
class ConfigCollection implements ConfigCollectionInterface
{
/**
* Stores a list of key/value config.
*
* @var array
*/
protected $config = [];
* @var boolean
protected $trackMetadata = false;
public function __construct($trackMetadata = false)
$this->trackMetadata = $trackMetadata;
}
* {@inheritdoc}
public function set($key, ConfigItemInterface $item)
if(!$this->exists($key)) {
$this->config[$key] = $item;
// Get the existing item so we can set the new value on it
$existing = $this->config[$key];
// Ensure that that tracking is correct for items belonging to this collection
$existing->trackMetadata($this->trackMetadata);
$existing->set($item->getValue(), $item->getMetadata());
public function get($key)
return null;
return $this->config[$key];
public function exists($key)
return array_key_exists($key, $this->config);
public function delete($key)
if($this->exists($key)) {
unset($this->config[$key]);