Kohkimakimoto\Worker\Job\Job::__construct PHP Метод

__construct() публичный Метод

public __construct ( $id, $name, $command, $config )
    public function __construct($id, $name, $command, $config)
    {
        $this->id = $id;
        $this->name = $name;
        $this->config = $config;
        if (is_string($command)) {
            // Command line string.
            $this->command = $command;
        } elseif ($command instanceof \Closure) {
            // Closure code.
            $this->command = $command;
        } elseif (is_array($command)) {
            // array
            if (isset($command["command"])) {
                $this->command = $command["command"];
            }
            if (isset($command["cron_time"])) {
                $this->cronTime = $command["cron_time"];
            }
            if (isset($command["max_processes"])) {
                $this->maxProcesses = $command["max_processes"];
            } else {
                $this->maxProcesses = false;
            }
        } else {
            throw new \InvalidArgumentException("Unsupported type of 'command'.");
        }
        if ($this->cronTime) {
            $this->cronExpression = CronExpression::factory($this->cronTime);
        }
    }