Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ClassNode.php

function ClassNode::addMethod

Parameters

MethodNode $method:

bool $force:

Return value

void

File

vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ClassNode.php, line 150

Class

ClassNode
Class node.

Namespace

Prophecy\Doubler\Generator\Node

Code

public function addMethod(MethodNode $method, $force = false) {
    if (!$this->isExtendable($method->getName())) {
        $message = sprintf('Method `%s` is not extendable, so can not be added.', $method->getName());
        throw new MethodNotExtendableException($message, $this->getParentClass(), $method->getName());
    }
    if ($force || !isset($this->methods[$method->getName()])) {
        $this->methods[$method->getName()] = $method;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal