Documentation

FileDescriptor extends DescriptorAbstract
in package
implements FileInterface

Represents a file in the project.

This class contains all structural elements of the file it represents. In most modern projects a file will contain a single element like a Class, Interface or Trait, sometimes multiple functions. Depending on the config settings of the parsed project it might include all source code from the file in the project.

Interfaces, Classes and Traits

FileInterface
Describes the public interface for a description of a File.

Table of Contents

$classes  : Collection<string|int, ClassDescriptor>
$constants  : Collection<string|int, ConstantDescriptor>
$description  : DescriptionDescriptor|null
$errors  : Collection<string|int, Error>
$fileDescriptor  : FileDescriptor|null
$fqsen  : Fqsen
$functions  : Collection<string|int, FunctionDescriptor>
$hash  : string
$includes  : Collection<string|int, string>
$inheritedElement  : DescriptorAbstract|null
$interfaces  : Collection<string|int, InterfaceDescriptor>
$line  : int
$markers  : Collection<string|int, array<int|string, mixed>>
$name  : string
$namespace  : NamespaceDescriptor|string
$namespaceAliases  : Collection<string|int, NamespaceDescriptor>|Collection<string|int, Fqsen>
$package  : PackageDescriptor|string
$path  : string
$source  : string|null
$summary  : string
$tags  : Collection<string|int, Collection<string|int, TagDescriptor>>
$traits  : Collection<string|int, TraitDescriptor>
__call()  : Collection<string|int, TagDescriptor>|null
Dynamically constructs a set of getters to retrieve tag (collections) with.
__construct()  : mixed
Initializes a new file descriptor with the given hash of its contents.
__toString()  : string
Represents this object by its unique identifier, the Fully Qualified Structural Element Name.
getAllErrors()  : Collection<string|int, Error>
Returns a list of all errors in this file and all its child elements.
getAuthor()  : Collection<string|int, AuthorDescriptor>
getClasses()  : Collection
Returns a list of class descriptors contained in this file.
getConstants()  : Collection
Returns a list of constant descriptors contained in this file.
getCopyright()  : Collection<string|int, TagDescriptor>
Returns the copyrights for this element.
getDescription()  : DescriptionDescriptor|null
Returns the description for this element.
getErrors()  : Collection<string|int, Error>
Returns all errors that occur in this element.
getFile()  : FileDescriptor|null
Returns the file in which this element resides or null in case the element is not bound to a file.
getFullyQualifiedStructuralElementName()  : Fqsen|null
Returns the Fully Qualified Structural Element Name (FQSEN) for this element.
getFunctions()  : Collection
Returns a list of function descriptors contained in this file.
getHash()  : string
Returns the hash of the contents for this file.
getIncludes()  : Collection<string|int, string>
Returns a list of all includes that have been declared in this file.
getInheritedElement()  : DescriptorAbstract|string|Fqsen|null
getInterfaces()  : Collection
Returns a list of interface descriptors contained in this file.
getLine()  : int
Returns the line number where the definition for this element can be found.
getMarkers()  : Collection<string|int, array<int|string, mixed>>
Returns a series of markers contained in this file.
getName()  : string
Returns the local name for this element.
getNamespace()  : NamespaceDescriptor|string
Returns the namespace for this element (defaults to global "\")
getNamespaceAliases()  : Collection<string|int, NamespaceDescriptor>|Collection<string|int, Fqsen>
Returns the namespace aliases that have been defined in this file.
getPackage()  : PackageDescriptor|null
Returns the package name for this element.
getPath()  : string
Returns the relative file path.
getSource()  : string|null
Retrieves the contents of this file.
getSummary()  : string
Returns the summary which describes this element.
getTags()  : Collection<string|int, Collection<string|int, TagDescriptor>>
Returns the tags associated with this element.
getTraits()  : Collection
Returns a list of trait descriptors contained in this file.
getVersion()  : Collection<string|int, VersionDescriptor>
Returns the versions for this element.
isDeprecated()  : bool
Checks whether this element is deprecated.
setHash()  : void
Sets the hash of the contents for this file.

Properties

$fqsen

protected Fqsen $fqsen

Fully Qualified Structural Element Name; the FQCN including method, property or constant name

$summary

protected string $summary = ''

A summary describing the function of this element in short.

Methods

__call()

Dynamically constructs a set of getters to retrieve tag (collections) with.

public __call(string $name, array<string|int, mixed> $arguments) : Collection<string|int, TagDescriptor>|null

Important: __call() is not a fast method of access; it is preferred to directly use the getTags() collection. This interface is provided to allow for uniform and easy access to certain tags.

Parameters
$name : string
$arguments : array<string|int, mixed>
Return values
Collection<string|int, TagDescriptor>|null

__construct()

Initializes a new file descriptor with the given hash of its contents.

public __construct(string $hash) : mixed
Parameters
$hash : string

An MD5 hash of the contents if this file.

Return values
mixed

__toString()

Represents this object by its unique identifier, the Fully Qualified Structural Element Name.

public __toString() : string
Return values
string

getAllErrors()

Returns a list of all errors in this file and all its child elements.

public getAllErrors() : Collection<string|int, Error>

All errors from structual elements in the file are collected to the deepes level.

Return values
Collection<string|int, Error>

getFullyQualifiedStructuralElementName()

Returns the Fully Qualified Structural Element Name (FQSEN) for this element.

public getFullyQualifiedStructuralElementName() : Fqsen|null
Return values
Fqsen|null

getHash()

Returns the hash of the contents for this file.

public getHash() : string
Return values
string

getIncludes()

Returns a list of all includes that have been declared in this file.

public getIncludes() : Collection<string|int, string>
Return values
Collection<string|int, string>

getLine()

Returns the line number where the definition for this element can be found.

public getLine() : int
Return values
int

getMarkers()

Returns a series of markers contained in this file.

public getMarkers() : Collection<string|int, array<int|string, mixed>>

A marker is a special inline comment that starts with a keyword and is followed by a single line description.

Example:

// TODO: This is an item that needs to be done.
Return values
Collection<string|int, array<int|string, mixed>>

getName()

Returns the local name for this element.

public getName() : string
Return values
string

getNamespaceAliases()

Returns the namespace aliases that have been defined in this file.

public getNamespaceAliases() : Collection<string|int, NamespaceDescriptor>|Collection<string|int, Fqsen>

A namespace alias can either be a full descriptor of the namespace or just a Fqsen when the namespace was not part of the processed code. When it is a NamespaceDescriptor it will contain all structural elements in the namespace not just the once in this particlar file.

Return values
Collection<string|int, NamespaceDescriptor>|Collection<string|int, Fqsen>

getPath()

Returns the relative file path.

public getPath() : string

The path is a relative to the source file based on the dsn of the config.

Return values
string

getSource()

Retrieves the contents of this file.

public getSource() : string|null

When source is included in parsing process this property will contain the raw file contents.

Return values
string|null

getSummary()

Returns the summary which describes this element.

public getSummary() : string

This method will automatically attempt to inherit the parent's summary if this one has none.

Return values
string

isDeprecated()

Checks whether this element is deprecated.

public isDeprecated() : bool
Return values
bool

setHash()

Sets the hash of the contents for this file.

protected setHash(string $hash) : void
Parameters
$hash : string
Return values
void

Search results