You are here

protected function CronJob::resolveCallback in Ultimate Cron 8.2

Returns a callable for the given controller.

Parameters

string $callback: A callback string.

Return value

mixed A PHP callable.

Throws

\InvalidArgumentException If the callback class does not exist.

1 call to CronJob::resolveCallback()
CronJob::getCallback in src/Entity/CronJob.php
Gets the cron job callback string.

File

src/Entity/CronJob.php, line 340

Class

CronJob
Class for handling cron jobs.

Namespace

Drupal\ultimate_cron\Entity

Code

protected function resolveCallback($callback) {

  // Controller in the service:method notation.
  $count = substr_count($callback, ':');
  if ($count == 1) {
    list($class_or_service, $method) = explode(':', $callback, 2);
  }
  elseif (strpos($callback, '::') !== FALSE) {
    list($class_or_service, $method) = explode('::', $callback, 2);
  }
  else {
    return $callback;
  }
  $callback = $this->classResolver
    ->getInstanceFromDefinition($class_or_service);
  return array(
    $callback,
    $method,
  );
}