Mapper

Takes the ScannedBase tokens and resolves PHPDoc inheritance.

class Mapper
Copyright
2016 Appertly
License
Apache-2.0

Constructors / Destructors

Public
ReturnsSignature and Description
void
__construct(ConstVector<ScannedBase> $tokens, Parser $parser)

Creates a new Mapper.

Instance Methods

Public
ReturnsSignature and Description
?ClassyDeclaration
getClass(string $name)

Gets a class declaration

ConstMap<string,ClassyDeclaration>

Gets all class declarations.

?ConstantDeclaration
getConstant(string $name)

Gets a constant declaration.

?FileDeclaration
getFile(string $name)

Gets a file definition.

ConstMap<string,FileDeclaration>

Gets the file definitions.

?FunctionDeclaration
getFunction(string $name)

Gets a function declaration.

ConstSet<string>

Gets the namespaces of the tokens.

ConstVector<ScannedBase>

Gets a list of all tokens

ImmMap<string,ImmVector<ScannedBase>>

Gets all tokens by filename.

ImmMap<string,ScannedBase>

Gets all tokens by their name.

ImmMap<string,ImmVector<ScannedBase>>

Gets all tokens by namespace name.

Method Details

__construct

public function __construct(ConstVector<ScannedBase> $tokens, Parser $parser)

Creates a new Mapper.

Parameters
NameTypeDescription
$tokensConstVector<ScannedBase>

All scanned tokens

$parserParser

getClass

public function getClass(string $name)

Gets a class declaration

Parameters
NameTypeDescription
$namestring

The class name

Returns
TypeDescription
?ClassyDeclaration

The class declaration or null

getClasses

public function getClasses()

Gets all class declarations.

Returns
TypeDescription
ConstMap<string,ClassyDeclaration>

The class declarations

getConstant

public function getConstant(string $name)

Gets a constant declaration.

Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
?ConstantDeclaration

The constant declaration or null

getFile

public function getFile(string $name)

Gets a file definition.

Parameters
NameTypeDescription
$namestring

The file name

Returns
TypeDescription
?FileDeclaration

The file declaration or null

getFiles

public function getFiles()

Gets the file definitions.

Returns
TypeDescription
ConstMap<string,FileDeclaration>

The file definitions

getFunction

public function getFunction(string $name)

Gets a function declaration.

Parameters
NameTypeDescription
$namestring

The function name

Returns
TypeDescription
?FunctionDeclaration

The function declaration or null

getNamespaces

public function getNamespaces()

Gets the namespaces of the tokens.

Returns
TypeDescription
ConstSet<string>

The token namespaces

getTokens

public function getTokens()

Gets a list of all tokens

Returns
TypeDescription
ConstVector<ScannedBase>

getTokensByFilename

public function getTokensByFilename()

Gets all tokens by filename.

Returns
TypeDescription
ImmMap<string,ImmVector<ScannedBase>>

The tokens by filename

getTokensByName

public function getTokensByName()

Gets all tokens by their name.

Returns
TypeDescription
ImmMap<string,ScannedBase>

The tokens by name

getTokensByNamespace

public function getTokensByNamespace()

Gets all tokens by namespace name.

Returns
TypeDescription
ImmMap<string,ImmVector<ScannedBase>>

The tokens by namespace name