ProjectAnalyzer

in package

Analyzes a Project Descriptor and collects key information.

This class can be used by external tools to analyze the Project Descriptor and collect key information from it such as the total number of elements per type of Descriptor, the number of top level namespaces or the number of parent classes that could not be interpreted by the Compiler passes.

Properties

protected$elementCount  : int                

protected$fileCount  : int                

protected$topLevelNamespaceCount  : int                

protected$unresolvedParentClassesCount  : int                

protected$descriptorCountByType  : int[]                

Methods

Analyzes the given project descriptor and populates this object's properties.

publicanalyze(ProjectDescriptor $projectDescriptor) : void

Parameters

$projectDescriptor : ProjectDescriptor

Returns a textual report of the findings of this class.

public__toString() : string

Returns

string

Increments the counter for element's class in the class counters.

protectedaddElementToCounter(array $classCounters, DescriptorAbstract $element) : array

Parameters

$classCounters : array
$element : DescriptorAbstract

Returns

array
phpstan-param

array<class-string, int> $classCounters

phpstan-return

array<class-string, int>

Checks whether the given element is a class and if its parent could not be resolved; increment the counter.

protectedincrementUnresolvedParentCounter(DescriptorAbstract $element) : void

Parameters

$element : DescriptorAbstract

Returns all elements from the project descriptor.

protectedfindAllElements(ProjectDescriptor $projectDescriptor) : \phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\DescriptorAbstract>

Parameters

$projectDescriptor : ProjectDescriptor

Returns

\phpDocumentor\Descriptor\Collection<\phpDocumentor\Descriptor\DescriptorAbstract>