@@ 26-33 (lines=8) @@ | ||
23 | * @param string $name |
|
24 | * @param RepositoryInterface $repository |
|
25 | */ |
|
26 | public function registerRepository(string $name, RepositoryInterface $repository) |
|
27 | { |
|
28 | if (isset($this->repositories[$name])) { |
|
29 | throw new \LogicException(sprintf('Links\' Repository "%s" is already registered.', $name)); |
|
30 | } |
|
31 | ||
32 | $this->repositories[$name] = $repository; |
|
33 | } |
|
34 | ||
35 | /** |
|
36 | * Get links' repository by name |
|
@@ 41-48 (lines=8) @@ | ||
38 | * @param string $name |
|
39 | * @return RepositoryInterface |
|
40 | */ |
|
41 | public function getRepository(string $name): RepositoryInterface |
|
42 | { |
|
43 | if (isset($this->repositories[$name])) { |
|
44 | return $this->repositories[$name]; |
|
45 | } |
|
46 | ||
47 | throw new \LogicException(sprintf('Unknown repository "%s"', $name)); |
|
48 | } |
|
49 | } |