public function ResourceDecoratorBase::isInstanceOf in RESTful 7.2
Checks if the decorated object is an instance of something.
Parameters
string $class: Class or interface to check the instance.
Return value
bool TRUE if the decorated object is an instace of the $class. FALSE otherwise.
Overrides ExplorableDecoratorInterface::isInstanceOf
File
- src/
Plugin/ resource/ Decorators/ ResourceDecoratorBase.php, line 404 - Contains \Drupal\restful\Plugin\resource\Decorators\ResourceDecoratorBase.
Class
- ResourceDecoratorBase
- Class ResourceDecoratorBase.
Namespace
Drupal\restful\Plugin\resource\DecoratorsCode
public function isInstanceOf($class) {
if ($this instanceof $class || $this->subject instanceof $class) {
return TRUE;
}
// Check if the decorated resource is also a decorator.
if ($this->subject instanceof ExplorableDecoratorInterface) {
return $this->subject
->isInstanceOf($class);
}
return FALSE;
}