You are here

public function WebformCliService::__call in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Commands/WebformCliService.php \Drupal\webform\Commands\WebformCliService::__call()

Call WebformCommand method or drush function.

Parameters

string $name: Function name.

array $arguments: Function arguments.

Return value

mixed Return function results.

Throws

\Exception Throw exception if WebformCommand method and drush function is not found.

File

src/Commands/WebformCliService.php, line 67

Class

WebformCliService
Drush version agnostic commands.

Namespace

Drupal\webform\Commands

Code

public function __call($name, array $arguments) {
  if ($this->command && method_exists($this->command, $name)) {
    return call_user_func_array([
      $this->command,
      $name,
    ], $arguments);
  }
  elseif (function_exists($name)) {
    return call_user_func_array($name, $arguments);
  }
  else {
    throw new \Exception("Unknown method/function '{$name}'.");
  }
}