FileDescriptor
extends DescriptorAbstract
in package
implements
FileInterface, Stringable
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.
Table of Contents
Interfaces
- FileInterface
- Describes the public interface for a description of a File.
- Stringable
Properties
- $classes : Collection<string|int, ClassInterface>
- $constants : Collection<string|int, ConstantInterface>
- $description : DescriptionDescriptor|null
- $endLocation : Location|null
- $errors : Collection<string|int, Error>
- $fileDescriptor : FileInterface|null
- $fqsen : Fqsen|null
- $functions : Collection<string|int, FunctionInterface>
- $hash : string
- $includes : Collection<string|int, string>
- $inheritedElement : ElementInterface|string|Fqsen|null
- $interfaces : Collection<string|int, InterfaceInterface>
- $line : int
- $markers : Collection<string|int, array<int|string, mixed>>
- $name : string
- $namespace : NamespaceInterface|string
- $namespaceAliases : Collection<string|int, NamespaceInterface|Fqsen>
- $package : PackageInterface|string
- $path : string
- $source : string|null
- $startLocation : Location|null
- $summary : string
- $tags : Collection<string|int, Collection<string|int, TagDescriptor>>
- $traits : Collection<string|int, TraitInterface>
- $enums : Collection<string|int, EnumInterface>
- $metadata : array<string|int, Metadata>
Methods
- __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<string|int, ClassInterface>
- Returns a list of class descriptors contained in this file.
- getConstants() : Collection<string|int, ConstantInterface>
- Returns a list of constant descriptors contained in this file.
- getCopyright() : Collection<string|int, TagDescriptor>
- Returns the copyrights for this element.
- getDeprecations() : array<string|int, Deprecation>
- getDescription() : DescriptionDescriptor
- Returns the description for this element.
- getEndLocation() : Location|null
- Returns the end location where the definition for this element can be found.
- getEnums() : Collection<string|int, EnumInterface>
- getErrors() : Collection<string|int, Error>
- Returns all errors that occur in this element.
- getFile() : FileInterface|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<string|int, FunctionInterface>
- 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() : ElementInterface|string|Fqsen|null
- Returns the element from which this element inherits, or null if it doesn't inherit any information.
- getInterfaces() : Collection<string|int, InterfaceInterface>
- 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.
- getMetadata() : array<string|int, Metadata>
- getName() : string
- Returns the name for this element.
- getNamespace() : NamespaceInterface|string
- Returns the namespace for this element (defaults to global "\")
- getNamespaceAliases() : Collection<string|int, NamespaceInterface|Fqsen>
- Returns the namespace aliases that have been defined in this file.
- getPackage() : PackageInterface|null
- Returns the package name for this element.
- getPath() : string
- Returns the relative file path.
- getSource() : string|null
- Retrieves the contents of this file.
- getStartLocation() : Location|null
- Returns the start location where the definition for this element can be found.
- 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<string|int, TraitInterface>
- 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.
- setDescription() : void
- Sets a description or none to inherit from a parent.
- setMetadata() : void
- setHash() : void
- Sets the hash of the contents for this file.
- createDescription() : Description
- isDeprecatedByAttribute() : bool
- isDeprecatedByTag() : bool
Properties
$classes
protected
Collection<string|int, ClassInterface>
$classes
$constants
protected
Collection<string|int, ConstantInterface>
$constants
$description
protected
DescriptionDescriptor|null
$description
= null
$endLocation
protected
Location|null
$endLocation
= null
$errors
protected
Collection<string|int, Error>
$errors
A collection of errors found during filtering.
$fileDescriptor
protected
FileInterface|null
$fileDescriptor
= null
The file to which this element belongs; if applicable
$fqsen
protected
Fqsen|null
$fqsen
= null
Fully Qualified Structural Element Name; the FQCN including method, property or constant name
$functions
protected
Collection<string|int, FunctionInterface>
$functions
$hash
protected
string
$hash
= ''
$includes
protected
Collection<string|int, string>
$includes
$inheritedElement
protected
ElementInterface|string|Fqsen|null
$inheritedElement
= null
the element from which to inherit information in this element
$interfaces
protected
Collection<string|int, InterfaceInterface>
$interfaces
$line
protected
int
$line
= 0
The line number on which this element occurs.
$markers
protected
Collection<string|int, array<int|string, mixed>>
$markers
$name
protected
string
$name
= ''
$namespace
protected
NamespaceInterface|string
$namespace
= ''
The namespace for this element
$namespaceAliases
protected
Collection<string|int, NamespaceInterface|Fqsen>
$namespaceAliases
$package
protected
PackageInterface|string
$package
The package with which this element is associated
$path
protected
string
$path
= ''
$source
protected
string|null
$source
= null
$startLocation
protected
Location|null
$startLocation
= null
$summary
protected
string
$summary
= ''
A summary describing the function of this element in short.
$tags
protected
Collection<string|int, Collection<string|int, TagDescriptor>>
$tags
The tags associated with this element.
$traits
protected
Collection<string|int, TraitInterface>
$traits
$enums
private
Collection<string|int, EnumInterface>
$enums
$metadata
private
array<string|int, Metadata>
$metadata
= []
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.
__toString()
Represents this object by its unique identifier, the Fully Qualified Structural Element Name.
public
__toString() : string
Return values
stringgetAllErrors()
Returns a list of all errors in this file and all its child elements.
public
getAllErrors() : Collection<string|int, Error>
All errors from structural elements in the file are collected to the deepest level.
Return values
Collection<string|int, Error>getAuthor()
public
getAuthor() : Collection<string|int, AuthorDescriptor>
Return values
Collection<string|int, AuthorDescriptor>getClasses()
Returns a list of class descriptors contained in this file.
public
getClasses() : Collection<string|int, ClassInterface>
Return values
Collection<string|int, ClassInterface>getConstants()
Returns a list of constant descriptors contained in this file.
public
getConstants() : Collection<string|int, ConstantInterface>
Return values
Collection<string|int, ConstantInterface>getCopyright()
Returns the copyrights for this element.
public
getCopyright() : Collection<string|int, TagDescriptor>
Return values
Collection<string|int, TagDescriptor>getDeprecations()
public
getDeprecations() : array<string|int, Deprecation>
Return values
array<string|int, Deprecation>getDescription()
Returns the description for this element.
public
getDescription() : DescriptionDescriptor
This method will automatically attempt to inherit the parent's description if this one has none.
Return values
DescriptionDescriptorgetEndLocation()
Returns the end location where the definition for this element can be found.
public
getEndLocation() : Location|null
Return values
Location|nullgetEnums()
public
getEnums() : Collection<string|int, EnumInterface>
Return values
Collection<string|int, EnumInterface>getErrors()
Returns all errors that occur in this element.
public
getErrors() : Collection<string|int, Error>
Return values
Collection<string|int, Error>getFile()
Returns the file in which this element resides or null in case the element is not bound to a file.
public
getFile() : FileInterface|null
.
Return values
FileInterface|nullgetFullyQualifiedStructuralElementName()
Returns the Fully Qualified Structural Element Name (FQSEN) for this element.
public
getFullyQualifiedStructuralElementName() : Fqsen|null
Return values
Fqsen|nullgetFunctions()
Returns a list of function descriptors contained in this file.
public
getFunctions() : Collection<string|int, FunctionInterface>
Return values
Collection<string|int, FunctionInterface>getHash()
Returns the hash of the contents for this file.
public
getHash() : string
Return values
stringgetIncludes()
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>getInheritedElement()
Returns the element from which this element inherits, or null if it doesn't inherit any information.
public
getInheritedElement() : ElementInterface|string|Fqsen|null
This method is usually overridden in consuming classes with the determination how that class should resolve inheritance. This is a placeholder function for those classes who need a simple way to provide inheritance.
Return values
ElementInterface|string|Fqsen|nullgetInterfaces()
Returns a list of interface descriptors contained in this file.
public
getInterfaces() : Collection<string|int, InterfaceInterface>
Return values
Collection<string|int, InterfaceInterface>getLine()
Returns the line number where the definition for this element can be found.
public
getLine() : int
use getStartLocation()->getLineNumber() instead
Return values
intgetMarkers()
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>>getMetadata()
public
getMetadata() : array<string|int, Metadata>
Return values
array<string|int, Metadata>getName()
Returns the name for this element.
public
getName() : string
Return values
stringgetNamespace()
Returns the namespace for this element (defaults to global "\")
public
getNamespace() : NamespaceInterface|string
Return values
NamespaceInterface|stringgetNamespaceAliases()
Returns the namespace aliases that have been defined in this file.
public
getNamespaceAliases() : Collection<string|int, NamespaceInterface|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, NamespaceInterface|Fqsen>getPackage()
Returns the package name for this element.
public
getPackage() : PackageInterface|null
Return values
PackageInterface|nullgetPath()
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
stringgetSource()
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|nullgetStartLocation()
Returns the start location where the definition for this element can be found.
public
getStartLocation() : Location|null
Return values
Location|nullgetSummary()
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
stringgetTags()
Returns the tags associated with this element.
public
getTags() : Collection<string|int, Collection<string|int, TagDescriptor>>
Return values
Collection<string|int, Collection<string|int, TagDescriptor>>getTraits()
Returns a list of trait descriptors contained in this file.
public
getTraits() : Collection<string|int, TraitInterface>
Return values
Collection<string|int, TraitInterface>getVersion()
Returns the versions for this element.
public
getVersion() : Collection<string|int, VersionDescriptor>
Return values
Collection<string|int, VersionDescriptor>isDeprecated()
Checks whether this element is deprecated.
public
isDeprecated() : bool
Return values
boolsetDescription()
Sets a description or none to inherit from a parent.
public
setDescription(DescriptionDescriptor|null $description) : void
Parameters
- $description : DescriptionDescriptor|null
setMetadata()
public
setMetadata(array<string|int, Metadata> $metadata) : void
Parameters
- $metadata : array<string|int, Metadata>
setHash()
Sets the hash of the contents for this file.
protected
setHash(string $hash) : void
Parameters
- $hash : string
createDescription()
private
createDescription(string|null $param) : Description
Parameters
- $param : string|null
Return values
DescriptionisDeprecatedByAttribute()
private
isDeprecatedByAttribute() : bool
Tags
Return values
boolisDeprecatedByTag()
private
isDeprecatedByTag() : bool