for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cekta\DI\Provider;
use Cekta\DI\Provider\Exception\NotFound;
use Cekta\DI\ProviderInterface;
class KeyValue implements ProviderInterface
{
/**
* @var array
*/
private $values;
public function __construct(array $values)
$this->values = $values;
}
public function provide(string $id)
if (!$this->canProvide($id)) {
throw new NotFound($id);
return $this->values[$id];
public function canProvide(string $id): bool
return array_key_exists($id, $this->values);