Deployment\Deployer::runJobs PHP Метод

runJobs() приватный Метод

private runJobs ( array $jobs ) : void
$jobs array
Результат void
    private function runJobs(array $jobs)
    {
        foreach ($jobs as $job) {
            if (is_string($job) && preg_match('#^(https?|local|remote):\\s*(.+)#', $job, $m)) {
                $out = $err = NULL;
                if ($m[1] === 'local') {
                    $out = @system($m[2], $code);
                    $err = $code !== 0 ? "exit code {$code}" : NULL;
                } elseif ($m[1] === 'remote') {
                    try {
                        $out = $this->server->execute($m[2]);
                    } catch (ServerException $e) {
                        $err = $e->getMessage() ?: 'unknown error';
                    }
                } else {
                    $out = Helpers::fetchUrl($job, $err);
                }
                $this->logger->log($job . ($out == NULL ? '' : ": {$out}"));
                // intentionally ==
                if ($err) {
                    throw new \RuntimeException('Job failed, ' . $err);
                }
            } elseif (is_callable($job)) {
                if ($job($this->server, $this->logger, $this) === FALSE) {
                    throw new \RuntimeException('Job failed');
                }
            } else {
                throw new \InvalidArgumentException("Invalid job {$job}.");
            }
        }
    }