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.
Table of Contents
- $descriptorCountByType : array<string|int, int>
- $elementCount : int
- $fileCount : int
- $topLevelNamespaceCount : int
- $unresolvedParentClassesCount : int
- __toString() : string
- Returns a textual report of the findings of this class.
- analyze() : void
- Analyzes the given project descriptor and populates this object's properties.
- addElementToCounter() : array<string, int>
- Increments the counter for element's class in the class counters.
- findAllElements() : Collection<string|int, DescriptorAbstract>
- Returns all elements from the project descriptor.
- incrementUnresolvedParentCounter() : void
- Checks whether the given element is a class and if its parent could not be resolved; increment the counter.
Properties
$descriptorCountByType
protected
array<string|int, int>
$descriptorCountByType
= []
$elementCount
protected
int
$elementCount
= 0
$fileCount
protected
int
$fileCount
= 0
$topLevelNamespaceCount
protected
int
$topLevelNamespaceCount
= 0
$unresolvedParentClassesCount
protected
int
$unresolvedParentClassesCount
= 0
Methods
__toString()
Returns a textual report of the findings of this class.
public
__toString() : string
Return values
string —analyze()
Analyzes the given project descriptor and populates this object's properties.
public
analyze(ProjectDescriptor $projectDescriptor) : void
Parameters
- $projectDescriptor : ProjectDescriptor
Return values
void —addElementToCounter()
Increments the counter for element's class in the class counters.
protected
addElementToCounter(array<string, int> $classCounters, DescriptorAbstract $element) : array<string, int>
Parameters
- $classCounters : array<string, int>
- $element : DescriptorAbstract
Tags
Return values
array<string, int> —findAllElements()
Returns all elements from the project descriptor.
protected
findAllElements(ProjectDescriptor $projectDescriptor) : Collection<string|int, DescriptorAbstract>
Parameters
- $projectDescriptor : ProjectDescriptor
Return values
Collection<string|int, DescriptorAbstract> —incrementUnresolvedParentCounter()
Checks whether the given element is a class and if its parent could not be resolved; increment the counter.
protected
incrementUnresolvedParentCounter(DescriptorAbstract $element) : void
Parameters
- $element : DescriptorAbstract