Passed
Push — master ( 8df548...375c2c )
by Korotkov
01:39
created

printResult()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Behavioral\Interpreter;
4
5
require_once "vendor/autoload.php";
6
7
$cardFile = new CardFile();
8
$cardFile->addAlbum(new Album("Korn", "Untouchables"));
9
$cardFile->addAlbum(new Album("Deftones", "Adrenaline"));
10
11
$interpreter = new Interpreter($cardFile);
12
13
try {
14
    printResult($interpreter->interpret("album 2"));
15
    printResult($interpreter->interpret("album author 2"));
16
    printResult($interpreter->interpret("album author 1"));
17
    printResult($interpreter->interpret("author 1"));
18
} catch (\Exception $e) {
19
    printf("%s", "Caught exception: " . $e->getMessage() . "\n");
20
}
21
22
function printResult(array $dataArray): void {
23
    foreach ($dataArray as $item) {
24
        print "$item ";
25
    }
26
27
    print "\n";
28
}
29