1 | <?php |
||
24 | class FileAnalyser extends Analyser |
||
25 | { |
||
26 | /** |
||
27 | * The relative or absolute path to the file target of this analysis. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | private $filePath; |
||
32 | |||
33 | /** |
||
34 | * FileAnalyser constructor |
||
35 | * |
||
36 | * Validates the given file path and calls the parent's constructor. * |
||
37 | * |
||
38 | * @param string $file The code to analyse |
||
39 | * @param bool $registerNameResolver If set to true `PhpParser\NodeVisitor\NameResolver` will be added as the first |
||
40 | * visitor. This may negatively affect performance, some Visitors depend on resolved names, however. |
||
41 | * @see \Pvra\RequirementAnalyser::__construct() Base constructor |
||
42 | */ |
||
43 | 56 | public function __construct($file, $registerNameResolver = true) |
|
52 | |||
53 | /** |
||
54 | * Validate a given file path. |
||
55 | * |
||
56 | * @param string $file Path to the file |
||
57 | * @return bool Returns true if $file is a file and is readable. Returns fails otherwise. |
||
58 | */ |
||
59 | 56 | private function isFileValid($file) |
|
63 | |||
64 | /** |
||
65 | * @inheritdoc |
||
66 | */ |
||
67 | 46 | protected function createAnalysisTargetId() |
|
71 | |||
72 | /** |
||
73 | * @inheritdoc |
||
74 | */ |
||
75 | 44 | protected function parse() |
|
79 | } |
||
80 |