Server IP : 127.0.0.2 / Your IP : 3.144.112.72 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/ |
Upload File : |
<?php namespace Illuminate\Queue; use DateTime; use Carbon\Carbon; use Illuminate\Support\Arr; use InvalidArgumentException; use Illuminate\Container\Container; abstract class Queue { /** * The IoC container instance. * * @var \Illuminate\Container\Container */ protected $container; /** * The encrypter implementation. * * @var \Illuminate\Contracts\Encryption\Encrypter */ protected $encrypter; /** * Push a new job onto the queue. * * @param string $queue * @param string $job * @param mixed $data * @return mixed */ public function pushOn($queue, $job, $data = '') { return $this->push($job, $data, $queue); } /** * Push a new job onto the queue after a delay. * * @param string $queue * @param \DateTime|int $delay * @param string $job * @param mixed $data * @return mixed */ public function laterOn($queue, $delay, $job, $data = '') { return $this->later($delay, $job, $data, $queue); } /** * Push an array of jobs onto the queue. * * @param array $jobs * @param mixed $data * @param string $queue * @return mixed */ public function bulk($jobs, $data = '', $queue = null) { foreach ((array) $jobs as $job) { $this->push($job, $data, $queue); } } /** * Create a payload string from the given job and data. * * @param string $job * @param mixed $data * @param string $queue * @return string * * @throws \InvalidArgumentException */ protected function createPayload($job, $data = '', $queue = null) { if (is_object($job)) { $payload = json_encode([ 'job' => 'Illuminate\Queue\CallQueuedHandler@call', 'data' => [ 'commandName' => get_class($job), 'command' => serialize(clone $job), ], ]); } else { $payload = json_encode($this->createPlainPayload($job, $data)); } if (JSON_ERROR_NONE !== json_last_error()) { throw new InvalidArgumentException('Unable to create payload: '.json_last_error_msg()); } return $payload; } /** * Create a typical, "plain" queue payload array. * * @param string $job * @param mixed $data * @return array */ protected function createPlainPayload($job, $data) { return ['job' => $job, 'data' => $data]; } /** * Set additional meta on a payload string. * * @param string $payload * @param string $key * @param string $value * @return string * * @throws \InvalidArgumentException */ protected function setMeta($payload, $key, $value) { $payload = json_decode($payload, true); $payload = json_encode(Arr::set($payload, $key, $value)); if (JSON_ERROR_NONE !== json_last_error()) { throw new InvalidArgumentException('Unable to create payload: '.json_last_error_msg()); } return $payload; } /** * Calculate the number of seconds with the given delay. * * @param \DateTime|int $delay * @return int */ protected function getSeconds($delay) { if ($delay instanceof DateTime) { return max(0, $delay->getTimestamp() - $this->getTime()); } return (int) $delay; } /** * Get the current UNIX timestamp. * * @return int */ protected function getTime() { return Carbon::now()->getTimestamp(); } /** * Set the IoC container instance. * * @param \Illuminate\Container\Container $container * @return void */ public function setContainer(Container $container) { $this->container = $container; } }