Skip to content

Commit

Permalink
lower complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Sep 8, 2023
1 parent 8b306d2 commit 8b86f82
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/Collectors/PublicClassMethodCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,7 @@ public function processNode(Node $node, Scope $scope): ?array
return null;
}

// skip acceptance tests, codeception
if (str_ends_with($classReflection->getName(), 'Cest')) {
return null;
}

if ($this->methodTypeDetector->isTestMethod($node, $scope)) {
return null;
}

if ($this->methodTypeDetector->isTraitMethod($node, $scope)) {
if ($this->shouldSkip($classReflection, $node, $scope)) {
return null;
}

Expand Down Expand Up @@ -104,4 +95,18 @@ public function processNode(Node $node, Scope $scope): ?array

return [$classReflection->getName(), $methodName, $node->getLine()];
}

private function shouldSkip(ClassReflection $classReflection, ClassMethod $classMethod, Scope $scope): bool
{
// skip acceptance tests, codeception
if (str_ends_with($classReflection->getName(), 'Cest')) {
return true;
}

if ($this->methodTypeDetector->isTestMethod($classMethod, $scope)) {
return true;
}

return $this->methodTypeDetector->isTraitMethod($classMethod, $scope);
}
}

0 comments on commit 8b86f82

Please sign in to comment.