Overview

Namespaces

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

Classes

  • AnonymousFunctionNode
  • CallbackCallNode
  • CallNode
  • DefineNode
  • EmptyNode
  • EvalNode
  • FunctionCallNode
  • FunctionDeclarationNode
  • HaltCompilerNode
  • IssetNode
  • ListNode
  • ParameterNode
  • ParameterNodeCollection
  • UnsetNode

Interfaces

  • LexicalVariableNode

Traits

  • ArgumentTrait
  • FunctionTrait
  • ParameterTrait
  • Overview
  • Namespace
  • Class

Class CallNode

Base class of any function or method call, including:

foobar();
$foo->bar();
Foo::bar();
$foo('bar');
Pharborist\Node implements Pharborist\NodeInterface
Extended by Pharborist\ParentNode implements Pharborist\ParentNodeInterface
Extended by Pharborist\Functions\CallNode uses Pharborist\Functions\ArgumentTrait, Pharborist\ParenTrait

Direct known subclasses

Pharborist\Functions\CallbackCallNode, Pharborist\Functions\FunctionCallNode, Pharborist\Objects\ClassMethodCallNode, Pharborist\Objects\ObjectMethodCallNode

Indirect known subclasses

Pharborist\Functions\DefineNode, Pharborist\Functions\EmptyNode, Pharborist\Functions\EvalNode, Pharborist\Functions\HaltCompilerNode, Pharborist\Functions\IssetNode, Pharborist\Functions\ListNode, Pharborist\Functions\UnsetNode
Abstract
Namespace: Pharborist\Functions
Located at Functions/CallNode.php
Methods summary
public Pharborist\Objects\ObjectMethodCallNode
# appendMethodCall( string $method_name )

Allows you to append a method call to this one, building a chain of method calls.

Allows you to append a method call to this one, building a chain of method calls.

For example:

// \Drupal::entityManager()
$classCall = ClassMethodCallNode::create('\Drupal', 'entityManager');

$methodCall = $classCall->appendMethodCall('getDefinitions');
echo $methodCall->getText(); // \Drupal::entityManager()->getDefinitions()
echo $methodCall->getObject(); // \Drupal::entityManager()
echo $methodCall->getMethodName(); // getDefinitions

// You can chain yet another call, and keep going as long as you want.

$methodCall = $methodCall->appendMethodCall('clearCache')
echo $methodCall->getText(); // \Drupal::entityManager()->getDefinitions()->clearCache()

// These methods are chainable themselves, so you can build an entire call chain
// in one fell swoop.

$chain = ClassMethodCallNode::create('Foo', 'bar')->appendMethodCall('baz')->appendMethodCall('zorg');
echo $chain->getText();  // Foo::bar()->baz()->zorg()

Parameters

$method_name
The name of the method to call.

Returns

Pharborist\Objects\ObjectMethodCallNode

The newly-created method call, in which every previous part of the chain will be the "object", and $method_name will be the "method". The call will be created without arguments, but you can add some using appendArgument().

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\Functions\ArgumentTrait
appendArgument(), clearArguments(), getArgumentList(), getArguments(), insertArgument(), prependArgument()
Methods used from Pharborist\ParenTrait
getCloseParen(), getOpenParen()
Pharborist API documentation generated by ApiGen