1 | <?php |
||
21 | class FileResult |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $path; |
||
28 | |||
29 | /** |
||
30 | * @var \cloak\analyzer\result\LineResult[] |
||
31 | */ |
||
32 | private $resultLines; |
||
33 | |||
34 | |||
35 | /** |
||
36 | * @param string $path |
||
37 | * @param array $resultLines |
||
38 | * @throws \cloak\analyzer\result\FileNotFoundException |
||
39 | */ |
||
40 | public function __construct($path, array $resultLines = []) |
||
41 | { |
||
42 | $absolutePath = PathFactory::instance()->create($path); |
||
43 | $filePath = $absolutePath->normalize()->string(); |
||
44 | |||
45 | if (file_exists($filePath) === false) { |
||
46 | throw new FileNotFoundException("'$path' file does not exist"); |
||
47 | } |
||
48 | |||
49 | $this->path = $filePath; |
||
50 | $this->resultLines = $this->createLineResults($resultLines); |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return string |
||
55 | */ |
||
56 | public function getPath() |
||
60 | |||
61 | /** |
||
62 | * @return \cloak\analyzer\result\LineResult[] |
||
63 | */ |
||
64 | public function getLineResults() |
||
68 | |||
69 | /** |
||
70 | * @param string $path |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function matchPath($path) |
||
80 | |||
81 | /** |
||
82 | * @param array $paths |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function matchPaths(array $paths) |
||
96 | |||
97 | /** |
||
98 | * @param array<integer, integer> $resultLines |
||
99 | * @return \cloak\analyzer\result\LineResult[] |
||
100 | */ |
||
101 | private function createLineResults(array $resultLines) |
||
111 | |||
112 | } |
||
113 |