Overview

Namespaces

  • Pharborist
    • Constants
    • ControlStructures
    • Exceptions
    • Functions
    • Generators
    • Namespaces
    • Objects
    • Operators
    • Types
    • Variables

Classes

  • ClassConstantLookupNode
  • ClassMemberListNode
  • ClassMemberLookupNode
  • ClassMemberNode
  • ClassMethodCallNode
  • ClassMethodNode
  • ClassNameScalarNode
  • ClassNode
  • ClassStatementNode
  • InterfaceMethodNode
  • InterfaceNode
  • NameExpressionNode
  • NewNode
  • ObjectMethodCallNode
  • ObjectPropertyNode
  • SingleInheritanceNode
  • TraitAdaptationStatementNode
  • TraitAliasNode
  • TraitMethodReferenceNode
  • TraitNode
  • TraitPrecedenceNode
  • TraitUseNode

Interfaces

  • InterfaceStatementNode

Traits

  • MethodTrait
  • VisibilityTrait
  • Overview
  • Namespace
  • Class

Class SingleInheritanceNode

Base class for ClassNode and TraitNode.

Pharborist\Node implements Pharborist\NodeInterface
Extended by Pharborist\ParentNode implements Pharborist\ParentNodeInterface
Extended by Pharborist\StatementNode
Extended by Pharborist\Objects\SingleInheritanceNode uses Pharborist\DocCommentTrait, Pharborist\Namespaces\IdentifierNameTrait

Direct known subclasses

Pharborist\Objects\ClassNode, Pharborist\Objects\TraitNode
Abstract
Namespace: Pharborist\Objects
See: Pharborist\Objects\ClassNode
See: Pharborist\Objects\TraitNode
Located at Objects/SingleInheritanceNode.php
Methods summary
public Pharborist\Namespaces\NameNode
# getExtends( )

Returns

Pharborist\Namespaces\NameNode
public
# setExtends( string|Pharborist\Namespaces\NameNode $extends )

Parameters

$extends

Returns


$this
public Pharborist\CommaListNode
# getImplementList( )

Returns

Pharborist\CommaListNode
public Pharborist\NodeCollection|Pharborist\Namespaces\NameNode[]
# getImplements( )

Returns

Pharborist\NodeCollection|Pharborist\Namespaces\NameNode[]
public
# setImplements( string|Pharborist\Namespaces\NameNode|Pharborist\CommaListNode|array|null $implements )

Parameters

$implements

Returns


$this

Throws

InvalidArgumentException
public Pharborist\StatementBlockNode
# getBody( )

Returns

Pharborist\StatementBlockNode
public Pharborist\NodeCollection|Pharborist\Objects\ClassStatementNode[]
# getStatements( )

Returns

Pharborist\NodeCollection|Pharborist\Objects\ClassStatementNode[]
public
# appendMethod( Pharborist\Functions\FunctionDeclarationNode|Pharborist\Objects\ClassMethodNode|string $method )

Adds a method to a class/trait.

Adds a method to a class/trait.

Parameters

$method

The method to append. Can either be an existing method, a function (which will be converted to a public method), or a string (a new public method will be created with that name).

Returns


$this
public boolean
# hasProperty( string $name )

Returns if the class/trait has the named property, regardless of visibility.

Returns if the class/trait has the named property, regardless of visibility.

Parameters

$name
The property name, with or without a leading $.

Returns

boolean
public string[]
# getPropertyNames( )

Returns the names of all class/trait properties, regardless of visibility.

Returns the names of all class/trait properties, regardless of visibility.

Returns

string[]
public Pharborist\NodeCollection
# getAllProperties( )

Returns

Pharborist\NodeCollection
public boolean
# hasMethod( string $name )

Returns if the class has the named method, regardless of visibility.

Returns if the class has the named method, regardless of visibility.

Parameters

$name
The method name.

Returns

boolean
public string[]
# getMethodNames( )

Returns the names of all class methods, regardless of visibility.

Returns the names of all class methods, regardless of visibility.

Returns

string[]
public Pharborist\NodeCollection|Pharborist\Objects\ClassMethodNode[]
# getAllMethods( )

Returns

Pharborist\NodeCollection|Pharborist\Objects\ClassMethodNode[]
public Pharborist\Objects\ClassMemberNode|null
# getProperty( string $name )

Returns a property by name, if it exists.

Returns a property by name, if it exists.

Parameters

$name
The property name, with or without the $.

Returns

Pharborist\Objects\ClassMemberNode|null
public Pharborist\Objects\ClassMethodNode|null
# getMethod( string $name )

Returns a method by name, if it exists.

Returns a method by name, if it exists.

Parameters

$name
The method name.

Returns

Pharborist\Objects\ClassMethodNode|null
public
# createProperty( string $name, Pharborist\ExpressionNode $value = NULL, string $visibility = 'public' )

Creates a new property in this class.

Creates a new property in this class.

Parameters

$name
$value
$visibility

Returns


$this

See

Pharborist\Objects\ClassMemberNode::create()
public
# appendProperty( string|Pharborist\Objects\ClassMemberListNode $property )

Add property to class.

Add property to class.

Parameters

$property

Returns


$this
Methods inherited from Pharborist\StatementNode
addCommentAbove(), getLineCount(), toComment()
Methods inherited from Pharborist\ParentNode
__clone(), __toString(), acceptVisitor(), addChild(), addChildren(), append(), childCount(), children(), clear(), find(), firstChild(), firstToken(), getSourcePosition(), getText(), getTree(), has(), isDescendant(), isEmpty(), lastChild(), lastToken(), mergeNode(), prepend(), walk()
Methods inherited from Pharborist\Node
after(), appendTo(), before(), closest(), fromValue(), furthest(), getLogicalBlock(), getRoot(), getStatement(), hasRoot(), index(), insertAfter(), insertBefore(), is(), isAllOf(), isAnyOf(), next(), nextAll(), nextToken(), nextUntil(), parent(), parents(), parentsUntil(), prependTo(), previous(), previousAll(), previousToken(), previousUntil(), remove(), replaceAll(), replaceWith(), siblings(), sortKey(), swapWith()
Methods used from Pharborist\DocCommentTrait
getDocComment(), getIndent(), setDocComment()
Methods used from Pharborist\Namespaces\IdentifierNameTrait
getName(), getNamespace(), inNamespace(), setName()
Pharborist API documentation generated by ApiGen