getAttribute('startLine'); if ($startLineOfNode !== $this->currentLineNumber) { $this->currentLineNumber = $startLineOfNode; $this->numberOfEffectiveCodeLines++; // Class statements may contain the @extensionScannerIgnoreFile statements if ($node instanceof Class_) { $comments = $node->getAttribute('comments'); if (!empty($comments)) { foreach ($comments as $comment) { if (str_contains($comment->getText(), '@extensionScannerIgnoreFile')) { $this->isCurrentFileIgnored = true; break; } } } } // First node of line may contain the @extensionScannerIgnoreLine comment $comments = $node->getAttribute('comments'); if (!empty($comments)) { foreach ($comments as $comment) { if (str_contains($comment->getText(), '@extensionScannerIgnoreLine')) { $this->numberOfIgnoreLines++; break; } } } } return null; } /** * True if a @extensionScannerIgnoreFile has been found. * Called externally *after* traversing * * @return bool */ public function isFileIgnored() { return $this->isCurrentFileIgnored; } /** * Number of "effective" code lines: No comments, no empty lines, * but "class" statements, "function" statements, "use xy", etc. * Called externally *after* traversing * * @return int */ public function getNumberOfEffectiveCodeLines() { return $this->numberOfEffectiveCodeLines; } /** * Returns number of found @extensionScannerIgnoreLine comments * Called externally *after* traversing * * @return int */ public function getNumberOfIgnoredLines() { return $this->numberOfIgnoreLines; } }