You are here

public function Decorator::isCallable in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Decorator.php \Drupal\webprofiler\Decorator::isCallable()
  2. 8.2 webprofiler/src/Decorator.php \Drupal\webprofiler\Decorator::isCallable()
  3. 4.x webprofiler/src/Decorator.php \Drupal\webprofiler\Decorator::isCallable()

Returns true if $method is a PHP callable.

Parameters

string $method: The method name.

bool $checkSelf:

Return value

bool|mixed

1 call to Decorator::isCallable()
Decorator::__call in webprofiler/src/Decorator.php

File

webprofiler/src/Decorator.php, line 48

Class

Decorator
Generic class Decorator.

Namespace

Drupal\webprofiler

Code

public function isCallable($method, $checkSelf = FALSE) {

  //Check the original object
  $object = $this
    ->getOriginalObject();
  if (is_callable([
    $object,
    $method,
  ])) {
    return $object;
  }

  // Check Decorators.
  $object = $checkSelf ? $this : $this->object;
  while ($object instanceof Decorator) {
    if (is_callable([
      $object,
      $method,
    ])) {
      return $object;
    }
    $object = $this->object;
  }
  return FALSE;
}