Conditions | 7 |
Paths | 18 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 6 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function interpret(string $input): void |
||
31 | { |
||
32 | $item = null; |
||
33 | $input = explode(" ", $input); |
||
34 | |||
35 | foreach ($input as $value) { |
||
36 | if (is_numeric($value)) { |
||
37 | $item = $this->registry[$value - 1]; |
||
38 | } |
||
39 | } |
||
40 | |||
41 | if ($item instanceof ItemInterface) { |
||
42 | foreach ($input as $value) { |
||
43 | if ($value === "album") { |
||
44 | printf("%s ", $item->getName()); |
||
|
|||
45 | } |
||
46 | |||
47 | if ($value === "author") { |
||
48 | printf("%s", $item->getAuthor()); |
||
49 | } |
||
50 | } |
||
51 | |||
52 | printf("%s", PHP_EOL); |
||
53 | } else { |
||
54 | throw new \InvalidArgumentException('Missing id'); |
||
55 | } |
||
58 |