Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.2098 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | public function createPlugin(array $config = []): Plugin |
||
26 | { |
||
27 | $journalServiceName = $config['journal'] ?? null; |
||
28 | 1 | ||
29 | if (! \is_string($journalServiceName)) { |
||
30 | 1 | throw new InvalidArgumentException('Invalid "journal" parameter'); |
|
31 | } |
||
32 | 1 | ||
33 | $journal = $this->container->get($journalServiceName); |
||
34 | |||
35 | if (! $journal instanceof Journal) { |
||
36 | 1 | throw new InvalidArgumentException('Invalid "journal" service'); |
|
37 | } |
||
38 | 1 | ||
39 | return new HistoryPlugin($journal); |
||
40 | } |
||
42 |