| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 124 | public function withRepository(Repository $repository): void |
|
| 19 | { |
||
| 20 | 124 | if ($repository === $this->repository) { |
|
| 21 | 1 | return; |
|
| 22 | } |
||
| 23 | |||
| 24 | 124 | if (null !== $this->repository) { |
|
| 25 | 1 | throw new LogicException( |
|
| 26 | 1 | sprintf('This instance of %s already contains a repository', get_class($this)), |
|
| 27 | 1 | ); |
|
| 28 | } |
||
| 29 | |||
| 30 | 124 | $this->repository = $repository; |
|
| 31 | } |
||
| 44 |