Job Factory method.

@param array $args
@return Job
168440
public static function create(array $args)
    {
        $job = new Job($args['body']);

        if (isset($args['id'])) {
            $job->setId($args['id']);
            $job->setTtl(hexdec(substr($job->getId(), -4)));
        }

        if (isset($args['queue'])) {
            $job->setQueue($args['queue']);
        }

        if (isset($args['ttl'])) {
            $job->setTtl($args['ttl']);
        }

        if (isset($args['retry'])) {
            $job->setRetry($args['retry']);
        }

        return $job;
    }
693053
public function update( array $args ) {

		if ( self::$ran ) {
			return new NullLog();
		}

		if ( $this->is_cron() || $this->is_cli() ) {
			$this->register_event_listener();
		}

		return new NullLog();
	}
286001
protected function initService(array $args = null) {
		if ($args === null) {
			return call_user_func($this->callback);
		}
		
		return call_user_func_array($this->callback, $args);
	}
589666
protected function initService(array $args = null) {
		if (is_object($this->prototype)) {
			return clone $this->prototype;
		}
		
		$copy = $this->prototype;
		return $copy;
	}
109782
private function makeService($name, array $args = [])
    {
        if (!isset($this->services[$name]) || $args) {
            $apiClient = $this->sdk->createClient($name, $args);
            $model = $this->loadModel($name, $apiClient->getApi()->getApiVersion());
            $resourceClient = new ResourceClient($apiClient, $model);
            $this->services[$name] = new Resource($resourceClient, 'service', [], []);
        }

        return $this->services[$name];
    }
511820
public function run($run, array $arguments = [])
    {

        $lambda = new Lambda($run);

        return $this->repository->transaction(function($repo) use ($lambda, $arguments) {

            $taskTemplate = $this->newTask($lambda);

            $this->callBeforeListeners('run', [$taskTemplate, $lambda, $arguments]);

            $task = $this->repository->create($taskTemplate);

            $job = $this->createJob($task, $lambda, $arguments);

            // We can just ignore to write state because typically the job
            // is typically started in another process
            $task->setJob($job);

            $this->callAfterListeners('run', [$taskTemplate, $job]);

            return $task;

        });
    }
564319
public function start($args = array())
    {
        $arg = $this->formatArgs($args);

        /**
         * Arguments and Options
         *
         */
        if (!empty($arg)) {
            $this->prepper
                 ->load($arg['task'])
                 ->loadParams($arg['params'])
                 ->prep($arg['action']);

            $this->dispatcher->setTaskName($arg['task']);
            $this->dispatcher->setActionName($arg['action']);
            $this->dispatcher->setParams($arg['params']);
        }

        $this->di->setShared('library', $this->library);
        $this->dispatcher->setDI($this->di);

        return $this->dispatcher->dispatch();
    }
1133096
public function appPay(array $args = array()) {
        if (!isset($args['timestamp'])) {
            $args['timestamp'] = time();
        }
        return $this->set($args)->getAppPay();
    }
1141147
public function handle(array $args)
  {
    switch ( strtoupper(request()->getMethod()) ) {
      case "GET"    : return $this->handleGET($args); break;
      case "POST"   : return $this->handlePOST($args); break;
      case "PUT"    : return $this->handlePUT($args); break;
      case "PATCH"  : return $this->handlePATCH($args); break;
      case "DELETE" : return $this->handleDELETE($args); break;
      case "HEAD"   : return $this->handleHEAD($args); break;
      case "OPTIONS": return $this->handleOPTIONS($args); break;
      default       : return $this->handleCUSTOM($args); break;
    }
  }
826777
public function execute(array $arguments): void
    {
        if (!isset($arguments['job'])) {
            throw new UnrecoverableJobException('Missing doctrine delay job');
        }

        $job = $arguments['job'];
        if (!$job instanceof DoctrineDelayJob) {
            throw new UnrecoverableJobException('Invalid job');
        }

        $this->queueManagerRegistry->put($job->getName(), $job->getArguments(), $job->getOptions(), $job->getManager());
    }
647815
public function data(...$args)
    {
        $this->each(function ($item) use ($args) {
            $item->data(...$args);
        });

        return $this;
    }
1027858
public static function init($args=null) {
    if(is_null(self::$instance)) {
      self::$instance = new ErrorClass($args);
    }
    return self::$instance;
  }
56301
public static function fromArray(array $arr)
    {
        if (empty($arr['name']) || !isset($arr['data'])) {
            throw new \InvalidArgumentException('malformed job');
        }
        $metadata = isset($arr['metadata']) ? $arr['metadata'] : [];
        return new static($arr['name'], $arr['data'], $metadata);
    }
272795
public static function create(...$args) {
        list($table,$pk,$config) = $args;
        $class = get_called_class();
        if($table===null) {
            $class = explode('\\',$class);
            $table = end($class);
        }

        if(!$config) {
            throw new \Exception('dao config not exists!');
        }

        $class = static::parse(get_class(),$config);

        return new $class($table,$pk,$config);
    }
1195711
protected function createLaravelAdapter(array $args=[])
    {
        if(!$this->app->bound('filedb.filesystem')) {
            return new FilesystemAdapter($this->createFlysystem($args));
        }

        $adapter = $this->app->make('filedb.filesystem');

        if ($adapter instanceof \Illuminate\Contracts\Filesystem\Filesystem) {
            return $adapter;
        }

        throw new TypeException("The binding behind filedb.filesystem implement Filesystem interface not " . Type::of($adapter));

    }
436035
public function index($args = array(), $params = array()) {
    $jobs = $this->proxy->retrieveData("jobs.json", $args, $params);
    $results = array();
    foreach($jobs as $job) $results[] = new Services_Zencoder_Job($job);
    return $results;
  }
679760
public function execute(array $args, array $options = [])
    {
        $this->bootstrap($args, $options);

        $version = isset($options['target']) ? $options['target'] : $options['t'];
        $date = isset($options['date']) ? $options['date'] : $options['d'];

        // run the migrations
        $start = microtime(true);
        if (null !== $date) {
            $this->getManager()->migrateToDateTime(new \DateTime($date));
        } else {
            $this->getManager()->migrate($version);
        }
        $end = microtime(true);

        Output::writeln('');
        Output::writeln(Colour::colour('All Done. Took ' . sprintf('%.4fs', $end - $start), Colour::CYAN));

        return 0;
    }