1 | <?php |
||
21 | final class PDependAdapter extends AbstractASTVisitor implements CodeAwareGenerator, CodeMinerInterface |
||
22 | { |
||
23 | /** @var ClassLevelAnalyzer[] */ |
||
24 | private $analyzers; |
||
25 | |||
26 | /** @var ASTArtifactList */ |
||
27 | private $artifacts; |
||
28 | |||
29 | /** @var array ['filePath' => ['metricA' => value, 'metricB' => value, ...]] */ |
||
30 | private $sourceFileMetricsList = []; |
||
31 | |||
32 | /** @var FileSystemInterface */ |
||
33 | private $fileSystem; |
||
34 | |||
35 | /** @var Engine */ |
||
36 | private $pdepend; |
||
37 | |||
38 | /** @var string[] */ |
||
39 | private static $unsupportedTokenList = ['class(', 'yield']; |
||
40 | |||
41 | 1 | public function __construct(Engine $pdepend = null, FileSystemInterface $fileSystem = null) |
|
46 | |||
47 | /** |
||
48 | * @param string[] $filePathList |
||
49 | */ |
||
50 | 1 | public function mine(array $filePathList, string $basePath = ''): array |
|
74 | |||
75 | /** |
||
76 | * Sets the context code nodes. |
||
77 | * |
||
78 | * @codeCoverageIgnore |
||
79 | */ |
||
80 | public function setArtifacts(ASTArtifactList $artifacts) |
||
84 | |||
85 | /** |
||
86 | * Adds an analyzer to log. If this logger accepts the given analyzer it |
||
87 | * with return <b>true</b>, otherwise the return value is <b>false</b>. |
||
88 | * |
||
89 | * @codeCoverageIgnore |
||
90 | * |
||
91 | * @return boolean |
||
92 | */ |
||
93 | public function log(Analyzer $analyzer) |
||
99 | |||
100 | /** |
||
101 | * Closes the logger process and writes the output file. |
||
102 | * |
||
103 | * @codeCoverageIgnore |
||
104 | */ |
||
105 | public function close() |
||
111 | |||
112 | /** |
||
113 | * Returns an <b>array</b> with accepted analyzer types. These types can be |
||
114 | * concrete analyzer classes or one of the descriptive analyzer interfaces. |
||
115 | * |
||
116 | * @codeCoverageIgnore |
||
117 | * |
||
118 | * @return string[] |
||
119 | */ |
||
120 | public function getAcceptedAnalyzers() |
||
136 | |||
137 | /** |
||
138 | * Visits a class node. |
||
139 | * |
||
140 | * @codeCoverageIgnore |
||
141 | */ |
||
142 | public function visitClass(ASTClass $node) |
||
148 | |||
149 | /** |
||
150 | * Visits an interface node. |
||
151 | * |
||
152 | * @codeCoverageIgnore |
||
153 | */ |
||
154 | public function visitInterface(ASTInterface $node) |
||
160 | |||
161 | /** |
||
162 | * @codeCoverageIgnore |
||
163 | */ |
||
164 | private function visitFile(AbstractASTClassOrInterface $node) |
||
172 | |||
173 | /** |
||
174 | * Collects the collected metrics for the given node and adds them to the <b>$node</b>. |
||
175 | * |
||
176 | * @codeCoverageIgnore |
||
177 | */ |
||
178 | private function collectMetrics(ASTArtifact $node) |
||
188 | |||
189 | /** |
||
190 | * This method returns true if the given file contains a token that is not currently supported by pdepend |
||
191 | */ |
||
192 | 1 | private function fileCanNotBeHandledByPdepend(string $filePath): bool |
|
207 | |||
208 | 1 | private function removeBasePathFromBeginningOfAllPaths(string $basePath, array $sourceFileMetricsList) |
|
217 | } |
||
218 |