| Total Complexity | 8 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class Registry implements RegistryInterface |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var LoaderInterface |
||
| 17 | */ |
||
| 18 | private $loader; |
||
| 19 | /** |
||
| 20 | * @var EntityInterface[] |
||
| 21 | */ |
||
| 22 | private $registry = []; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param LoaderInterface $loader |
||
| 26 | */ |
||
| 27 | public function __construct(LoaderInterface $loader) |
||
| 28 | { |
||
| 29 | $this->loader = $loader; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function get(string $name): EntityInterface |
||
| 33 | { |
||
| 34 | $entity = $this->find($name); |
||
| 35 | if ($entity) { |
||
| 36 | return $entity; |
||
| 37 | } |
||
| 38 | throw new BadMethodCallException("Can't get entity for class `$name`"); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function find(string $name, ContextInterface $context = null): ?EntityInterface |
||
| 52 | } |
||
| 53 | |||
| 54 | public function exists(string $name): bool |
||
| 57 | } |
||
| 58 | } |
||
| 59 |