ContextFactory
    
            
            in package
            
        
    
    
    
Convenience class to create a Context for DocBlocks when not using the Reflection Component of phpDocumentor.
For a DocBlock to be able to resolve types that use partial namespace names or rely on namespace imports we need to provide a bit of context so that the DocBlock can read that and based on it decide how to resolve the types to Fully Qualified names.
Tags
Table of Contents
Constants
- T_LITERAL_END_OF_USE = ';'
- The literal used at the end of a use statement.
- T_LITERAL_USE_SEPARATOR = ','
- The literal used between sets of use statements
Methods
- createForNamespace() : Context
- Build a Context for a namespace in the provided file contents.
- createFromReflector() : Context
- Build a Context given a Class Reflection.
- createFromReflectionClass() : Context
- createFromReflectionClassConstant() : Context
- createFromReflectionMethod() : Context
- createFromReflectionParameter() : Context
- createFromReflectionProperty() : Context
- extractUseStatements() : array<string|int, string>
- Deduce the namespace name and alias of an import when we are at the T_USE token or have not reached the end of a USE statement yet. This will return a key/value array of the alias => namespace.
- parseNamespace() : string
- Deduce the name from tokens when we are at the T_NAMESPACE token.
- parseUseStatement() : array<string|int, string>
- Deduce the names of all imports when we are at the T_USE token.
- skipToNextStringOrNamespaceSeparator() : void
- Fast-forwards the iterator as longs as we don't encounter a T_STRING or T_NS_SEPARATOR token.
Constants
T_LITERAL_END_OF_USE
The literal used at the end of a use statement.
    private
        mixed
    T_LITERAL_END_OF_USE
    = ';'
    
    
    
    
T_LITERAL_USE_SEPARATOR
The literal used between sets of use statements
    private
        mixed
    T_LITERAL_USE_SEPARATOR
    = ','
    
    
    
    
Methods
createForNamespace()
Build a Context for a namespace in the provided file contents.
    public
                    createForNamespace(string $namespace, string $fileContents) : Context
    Parameters
- $namespace : string
- 
                    It does not matter if a \precedes the namespace name, this method first normalizes.
- $fileContents : string
- 
                    The file's contents to retrieve the aliases from with the given namespace. 
Tags
Return values
ContextcreateFromReflector()
Build a Context given a Class Reflection.
    public
                    createFromReflector(Reflector $reflector) : Context
    Parameters
- $reflector : Reflector
Tags
Return values
ContextcreateFromReflectionClass()
    private
                    createFromReflectionClass(ReflectionClass $class) : Context
    Parameters
- $class : ReflectionClass
Tags
Return values
ContextcreateFromReflectionClassConstant()
    private
                    createFromReflectionClassConstant(ReflectionClassConstant $constant) : Context
    Parameters
- $constant : ReflectionClassConstant
Return values
ContextcreateFromReflectionMethod()
    private
                    createFromReflectionMethod(ReflectionMethod $method) : Context
    Parameters
- $method : ReflectionMethod
Return values
ContextcreateFromReflectionParameter()
    private
                    createFromReflectionParameter(ReflectionParameter $parameter) : Context
    Parameters
- $parameter : ReflectionParameter
Return values
ContextcreateFromReflectionProperty()
    private
                    createFromReflectionProperty(ReflectionProperty $property) : Context
    Parameters
- $property : ReflectionProperty
Return values
ContextextractUseStatements()
Deduce the namespace name and alias of an import when we are at the T_USE token or have not reached the end of a USE statement yet. This will return a key/value array of the alias => namespace.
    private
                    extractUseStatements(ArrayIterator<int, string|array{0: int, 1: string, 2: int}> $tokens) : array<string|int, string>
    Parameters
- $tokens : ArrayIterator<int, string|array{0: int, 1: string, 2: int}>
Tags
Return values
array<string|int, string>parseNamespace()
Deduce the name from tokens when we are at the T_NAMESPACE token.
    private
                    parseNamespace(ArrayIterator<int, string|array{0: int, 1: string, 2: int}> $tokens) : string
    Parameters
- $tokens : ArrayIterator<int, string|array{0: int, 1: string, 2: int}>
Return values
stringparseUseStatement()
Deduce the names of all imports when we are at the T_USE token.
    private
                    parseUseStatement(ArrayIterator<int, string|array{0: int, 1: string, 2: int}> $tokens) : array<string|int, string>
    Parameters
- $tokens : ArrayIterator<int, string|array{0: int, 1: string, 2: int}>
Tags
Return values
array<string|int, string>skipToNextStringOrNamespaceSeparator()
Fast-forwards the iterator as longs as we don't encounter a T_STRING or T_NS_SEPARATOR token.
    private
                    skipToNextStringOrNamespaceSeparator(ArrayIterator<int, string|array{0: int, 1: string, 2: int}> $tokens) : void
    Parameters
- $tokens : ArrayIterator<int, string|array{0: int, 1: string, 2: int}>