PDepend\Source\Language\PHP\PHPBuilder::findType PHP Method

findType() protected method

This method tries to find an interface or class instance matching for the given qualified name in all scopes already processed. It will return the best matching instance or null if no match exists.
Since: 0.9.5
protected findType ( array $instances, string $qualifiedName ) : AbstractASTType
$instances array
$qualifiedName string
return PDepend\Source\AST\AbstractASTType
    protected function findType(array $instances, $qualifiedName)
    {
        $classOrInterfaceName = $this->extractTypeName($qualifiedName);
        $namespaceName = $this->extractNamespaceName($qualifiedName);
        $caseInsensitiveName = strtolower($classOrInterfaceName);
        if (!isset($instances[$caseInsensitiveName])) {
            return null;
        }
        // Check for exact match and return first matching instance
        if (isset($instances[$caseInsensitiveName][$namespaceName])) {
            return reset($instances[$caseInsensitiveName][$namespaceName]);
        }
        if (!$this->isDefault($namespaceName)) {
            return null;
        }
        $classesOrInterfaces = reset($instances[$caseInsensitiveName]);
        return reset($classesOrInterfaces);
    }
PHPBuilder