for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Thruster\Component\DataCacher;
use Thruster\Component\DataCacher\Exception\DataCacherNotFoundException;
/**
* Class DataCachers
*
* @package Thruster\Component\DataCacher
* @author Aurimas Niekis <[email protected]>
*/
class DataCachers
{
* @var DataCacher[]
protected $dataCachers;
public function __construct()
$this->dataCachers = [];
}
* @param string $cacherName
* @param DataCacher $dataCacher
* @return $this
public function addCacher(string $cacherName, DataCacher $dataCacher) : self
$this->dataCachers[$cacherName] = $dataCacher;
return $this;
* @return bool
public function hasCacher(string $cacherName) : bool
return array_key_exists($cacherName, $this->dataCachers);
* @return DataCacher
public function getCacher(string $cacherName) : DataCacher
if (false === $this->hasCacher($cacherName)) {
throw new DataCacherNotFoundException($cacherName);
return $this->dataCachers[$cacherName];
public function removeCacher(string $cacherName) : self
unset($this->dataCachers[$cacherName]);
* @return DataCacher[]
public function getCachers()
return $this->dataCachers;
* @param DataCacher[] $dataCachers
public function setCachers($dataCachers)
$this->dataCachers = $dataCachers;