function 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;
}