PHP Class Neos\Flow\Utility\PhpAnalyzer

Usage: extract the FQN e.g. "Some\Namespace\SomeClassName" $fullyQualifiedClassName = (new PhpAnalyzer($fileContents))->extractFullyQualifiedClassName(); extract the namespace "Some\Namespace" $namespace = (new PhpAnalyzer($fileContents))->extractNamespace(); extract just the class name "SomeClassName" $className = (new PhpAnalyzer($fileContents))->extractClassName();
Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$phpCode string

Méthodes publiques

Méthode Description
__construct ( string $phpCode )
extractClassName ( ) : string Extracts the className of the given PHP code Note: This only returns the class name without namespace, @see extractFullyQualifiedClassName()
extractFullyQualifiedClassName ( ) : string Extracts the Fully Qualified Class name from the given PHP code
extractNamespace ( ) : string Extracts the PHP namespace from the given PHP code

Method Details

__construct() public méthode

public __construct ( string $phpCode )
$phpCode string

extractClassName() public méthode

Extracts the className of the given PHP code Note: This only returns the class name without namespace, @see extractFullyQualifiedClassName()
public extractClassName ( ) : string
Résultat string

extractFullyQualifiedClassName() public méthode

Extracts the Fully Qualified Class name from the given PHP code
public extractFullyQualifiedClassName ( ) : string
Résultat string FQN in the format "Some\Fully\Qualified\ClassName" or NULL if no class was detected

extractNamespace() public méthode

Extracts the PHP namespace from the given PHP code
public extractNamespace ( ) : string
Résultat string the PHP namespace in the form "Some\Namespace" (w/o leading backslash) - or NULL if no namespace modifier was found

Property Details

$phpCode protected_oe property

protected string $phpCode
Résultat string