PHP Class gossi\codegen\model\AbstractPhpStruct

Author: Johannes M. Schmitt ([email protected])
Inheritance: extends AbstractModel, implements gossi\codegen\model\NamespaceInterface, implements gossi\codegen\model\DocblockInterface, use trait gossi\codegen\model\parts\QualifiedNameTrait, use trait gossi\codegen\model\parts\DocblockTrait, use trait gossi\codegen\model\parts\LongDescriptionTrait
Mostra file Open project: gossi/php-code-generator Class Usage Examples

Public Methods

Method Description
__construct ( string $name = null ) Creates a new struct
addRequiredFile ( string $file ) Adds a new required file
addUseStatement ( string $qualifiedName, null | string $alias = null ) Adds a use statement with an optional alias
clearMethods ( ) Clears all methods
clearUseStatements ( ) Clears all use statements
create ( string $name = null ) : static Creates a new struct
declareUse ( string $qualifiedName, null | string $alias = null ) : string Declares a "use $fullClassName" with " as $alias" if $alias is available, and returns its alias (or not qualified classname) to be used in your actual php code.
declareUses ( ) Declares multiple use statements at once.
generateDocblock ( ) Generates a docblock from provided information
getMethod ( string $nameOrMethod ) : PhpMethod Returns a method
getMethodNames ( ) : phootwork\collection\Set Returns all method names
getMethods ( ) : phootwork\collection\Map Returns all methods
getRequiredFiles ( ) : phootwork\collection\Set Returns required files
getUseAlias ( string $qualifiedName ) : string Returns the usable alias for a qualified name
getUseStatements ( ) : phootwork\collection\Map Returns all use statements
hasMethod ( string | PhpMethod $nameOrMethod ) : boolean Checks whether a method exists or not
hasUseStatement ( string $qualifiedName ) : boolean Returns whether the given use statement is present
removeMethod ( string | PhpMethod $nameOrMethod ) Removes a method
removeUseStatement ( string $qualifiedName ) Removes a use statement
setMethod ( PhpMethod $method ) Adds a method
setMethods ( array $methods ) Sets a collection of methods
setRequiredFiles ( array $files ) Sets requried files
setUseStatements ( array $useStatements ) Sets use statements

Method Details

__construct() public method

Creates a new struct
public __construct ( string $name = null )
$name string the fqcn

addRequiredFile() public method

Adds a new required file
public addRequiredFile ( string $file )
$file string

addUseStatement() public method

Adds a use statement with an optional alias
public addUseStatement ( string $qualifiedName, null | string $alias = null )
$qualifiedName string
$alias null | string

clearMethods() public method

Clears all methods
public clearMethods ( )

clearUseStatements() public method

Clears all use statements
public clearUseStatements ( )

create() public static method

Creates a new struct
public static create ( string $name = null ) : static
$name string the fqcn
return static

declareUse() public method

If the class has already been declared you get only the set alias.
public declareUse ( string $qualifiedName, null | string $alias = null ) : string
$qualifiedName string
$alias null | string
return string the used alias

declareUses() public method

Declares multiple use statements at once.
public declareUses ( )

generateDocblock() public method

Generates a docblock from provided information
public generateDocblock ( )

getMethod() public method

Returns a method
public getMethod ( string $nameOrMethod ) : PhpMethod
$nameOrMethod string the methods name
return PhpMethod

getMethodNames() public method

Returns all method names
public getMethodNames ( ) : phootwork\collection\Set
return phootwork\collection\Set

getMethods() public method

Returns all methods
public getMethods ( ) : phootwork\collection\Map
return phootwork\collection\Map collection of methods

getRequiredFiles() public method

Returns required files
public getRequiredFiles ( ) : phootwork\collection\Set
return phootwork\collection\Set collection of filenames

getUseAlias() public method

Returns the usable alias for a qualified name
public getUseAlias ( string $qualifiedName ) : string
$qualifiedName string
return string the alias

getUseStatements() public method

Returns all use statements
public getUseStatements ( ) : phootwork\collection\Map
return phootwork\collection\Map collection of use statements

hasMethod() public method

Checks whether a method exists or not
public hasMethod ( string | PhpMethod $nameOrMethod ) : boolean
$nameOrMethod string | PhpMethod method name or Method instance
return boolean `true` if it exists and `false` if not

hasUseStatement() public method

Returns whether the given use statement is present
public hasUseStatement ( string $qualifiedName ) : boolean
$qualifiedName string
return boolean

removeMethod() public method

Removes a method
public removeMethod ( string | PhpMethod $nameOrMethod )
$nameOrMethod string | PhpMethod method name or Method instance

removeUseStatement() public method

Removes a use statement
public removeUseStatement ( string $qualifiedName )
$qualifiedName string

setMethod() public method

Adds a method
public setMethod ( PhpMethod $method )
$method PhpMethod

setMethods() public method

Sets a collection of methods
public setMethods ( array $methods )
$methods array

setRequiredFiles() public method

Sets requried files
public setRequiredFiles ( array $files )
$files array

setUseStatements() public method

Sets use statements
public setUseStatements ( array $useStatements )
$useStatements array