Conditions | 8 |
Paths | 19 |
Total Lines | 30 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
35 | public function interpret(string $input = null): void |
||
36 | { |
||
37 | if (!isset($input)) { |
||
38 | throw new \InvalidArgumentException(); |
||
39 | } |
||
40 | |||
41 | $item = null; |
||
42 | $input = explode(" ", $input); |
||
43 | |||
44 | foreach ($input as $value) { |
||
45 | if (is_numeric($value)) { |
||
46 | $item = $this->getDepository()->getItem($value - 1); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | if (!isset($item)) { |
||
51 | throw new \InvalidArgumentException(); |
||
52 | } |
||
53 | |||
54 | foreach ($input as $value) { |
||
55 | if ($value == "album") { |
||
56 | printf("%s ", $item->getName()); |
||
|
|||
57 | } |
||
58 | |||
59 | if ($value == "author") { |
||
60 | printf("%s", $item->getAuthor()); |
||
61 | } |
||
62 | } |
||
63 | |||
64 | printf("%s", PHP_EOL); |
||
65 | } |
||
75 |