PHP Class PHPSA\Definition\ClassDefinition

Inheritance: extends ParentDefinition
Show file Open project: ovr/phpsa Class Usage Examples

Protected Properties

Property Type Description
$constants PhpParser\Node\Stmt\Const_[] Class constants
$extendsClass string | null
$extendsClassDefinition ClassDefinition | null
$filepath string
$interfaces array
$methods ClassMethod[] Class methods
$properties PhpParser\Node\Stmt\PropertyProperty[] Class properties
$propertyStatements PhpParser\Node\Stmt\Property[] Property Statements
$statement PhpParser\Node\Stmt\Class_ | null
$type integer

Public Methods

Method Description
__construct ( string $name, Class_ $statement = null, integer $type )
addConst ( ClassConst $const )
addInterface ( string $interface )
addMethod ( ClassMethod $classMethod, boolean $overwrite = true ) : boolean
addProperty ( Property $property )
compile ( Context $context )
getExtendsClass ( ) : null | string
getExtendsClassDefinition ( ) : null | ClassDefinition
getFilepath ( ) : string
getMethod ( $name, boolean | false $inherit = false ) : ClassMethod | null
getProperty ( string $name, boolean $inherit = false ) : PhpParser\Node\Stmt\PropertyProperty
getPropertyStatement ( string $name, boolean $inherit = false ) : Property
hasConst ( string $name, boolean $inherit = false ) : boolean
hasMethod ( string $name, boolean | false $inherit = false ) : boolean
hasProperty ( $name, boolean $inherit = false ) : boolean
isAbstract ( ) : boolean
isFinal ( ) : boolean
mergeTrait ( TraitDefinition $definition, array $adaptations )
setExtendsClass ( null | string $extendsClass )
setExtendsClassDefinition ( ClassDefinition $extendsClassDefinition )
setFilepath ( string $filepath )

Method Details

__construct() public method

public __construct ( string $name, Class_ $statement = null, integer $type )
$name string
$statement PhpParser\Node\Stmt\Class_
$type integer

addConst() public method

public addConst ( ClassConst $const )
$const PhpParser\Node\Stmt\ClassConst

addInterface() public method

public addInterface ( string $interface )
$interface string

addMethod() public method

public addMethod ( ClassMethod $classMethod, boolean $overwrite = true ) : boolean
$classMethod ClassMethod
$overwrite boolean Should we overwrite method if it already exists
return boolean Did we overwrite method?

addProperty() public method

public addProperty ( Property $property )
$property PhpParser\Node\Stmt\Property

compile() public method

public compile ( Context $context )
$context PHPSA\Context

getExtendsClass() public method

public getExtendsClass ( ) : null | string
return null | string

getExtendsClassDefinition() public method

public getExtendsClassDefinition ( ) : null | ClassDefinition
return null | ClassDefinition

getFilepath() public method

public getFilepath ( ) : string
return string

getMethod() public method

public getMethod ( $name, boolean | false $inherit = false ) : ClassMethod | null
$name
$inherit boolean | false
return ClassMethod | null

getProperty() public method

public getProperty ( string $name, boolean $inherit = false ) : PhpParser\Node\Stmt\PropertyProperty
$name string
$inherit boolean
return PhpParser\Node\Stmt\PropertyProperty

getPropertyStatement() public method

public getPropertyStatement ( string $name, boolean $inherit = false ) : Property
$name string
$inherit boolean
return PhpParser\Node\Stmt\Property

hasConst() public method

public hasConst ( string $name, boolean $inherit = false ) : boolean
$name string
$inherit boolean
return boolean

hasMethod() public method

public hasMethod ( string $name, boolean | false $inherit = false ) : boolean
$name string
$inherit boolean | false
return boolean

hasProperty() public method

public hasProperty ( $name, boolean $inherit = false ) : boolean
$name
$inherit boolean
return boolean

isAbstract() public method

public isAbstract ( ) : boolean
return boolean

isFinal() public method

public isFinal ( ) : boolean
return boolean

mergeTrait() public method

public mergeTrait ( TraitDefinition $definition, array $adaptations )
$definition TraitDefinition
$adaptations array

setExtendsClass() public method

public setExtendsClass ( null | string $extendsClass )
$extendsClass null | string

setExtendsClassDefinition() public method

public setExtendsClassDefinition ( ClassDefinition $extendsClassDefinition )
$extendsClassDefinition ClassDefinition

setFilepath() public method

public setFilepath ( string $filepath )
$filepath string

Property Details

$constants protected property

Class constants
protected Const_[],PhpParser\Node\Stmt $constants
return PhpParser\Node\Stmt\Const_[]

$extendsClass protected property

protected string|null $extendsClass
return string | null

$extendsClassDefinition protected property

protected ClassDefinition,PHPSA\Definition|null $extendsClassDefinition
return ClassDefinition | null

$filepath protected property

protected string $filepath
return string

$interfaces protected property

protected array $interfaces
return array

$methods protected property

Class methods
protected ClassMethod[],PHPSA\Definition $methods
return ClassMethod[]

$properties protected property

Class properties
protected PropertyProperty[],PhpParser\Node\Stmt $properties
return PhpParser\Node\Stmt\PropertyProperty[]

$propertyStatements protected property

Property Statements
protected Property[],PhpParser\Node\Stmt $propertyStatements
return PhpParser\Node\Stmt\Property[]

$statement protected property

protected Class_,PhpParser\Node\Stmt|null $statement
return PhpParser\Node\Stmt\Class_ | null

$type protected property

protected int $type
return integer