protected function BackendBase::getCallbackFunction in SCSS Compiler 1.0.x
Fetch the callback function to use for the supplied descriptor.
This method serves to provide a point where the concrete class can wrap (or otherwise modify) the callback function before it is conveyed to the underlying compiler implementation.
By default, this method wraps the callback function to facilitate processing of its return value.
Parameters
object $descriptor: A function descriptor object created by ::registerFunction().
Return value
callable The callback function to use for the supplied descriptor.
File
- src/
BackendBase.php, line 84
Class
- BackendBase
- Provides a base compiler backend implementation.
Namespace
Drupal\compiler_scssCode
protected function getCallbackFunction(object $descriptor) {
return function ($args) use ($descriptor) {
if (count($args) !== count($descriptor->params)) {
throw new \BadFunctionCallException('PHP function parameter mismatch');
}
$args = array_map([
$this,
'processArgumentValue',
], $args);
$return = call_user_func_array($descriptor->callback, $args);
$return = $this
->processReturnValue($return);
return $return;
};
}