Determine tags for the given queued listener.

@param  mixed  $job
@return array
968764
protected static function tagsForListener($job)
    {
        return collect(
            [static::extractListener($job), static::extractEvent($job),
        ])->map(function ($job) {
            return static::from($job);
        })->collapse()->unique()->toArray();
    }
1373630
private function tags($event)
    {
        return array_merge([
            $this->formatNotifiable($event->notifiable),
        ], ExtractTags::from($event->notification));
    }
985105
public function resolveLegacyName($job)
    {
        try {
            $payload = json_decode($job->getRawBody(), true);
            $name = $payload['job'];

            if (! empty($payload['displayName'])) {
                return $payload['displayName'];
            }

            if ($name === 'Illuminate\Queue\CallQueuedHandler@call') {
                return get_class(unserialize($data['data']['command']));
            }

            if ($name === 'Illuminate\Events\CallQueuedHandler@call') {
                return $payload['data']['class'].'@'.$payload['data']['method'];
            }
        } catch (Exception $e) {
            $this->eye->logger()->error('Unable to resolve Legacy Name', $e);
            $name = 'Unknown';
        }

        return $name;
    }
238067
protected static function targetsFor($job)
    {
        switch (true) {
            case $job instanceof BroadcastEvent:
                return [$job->event];
            case $job instanceof CallQueuedListener:
                return [static::extractEvent($job)];
            case $job instanceof SendQueuedMailable:
                return [$job->mailable];
            case $job instanceof SendQueuedNotifications:
                return [$job->notification];
            default:
                return [$job];
        }
    }
874471
public function isRunning(Job $job) {
        $runner = $this->getJobRunner($job);

        return $runner->isRunning($job);
    }
709305
public function getTags ($tag)
	{
		
		$tags	= array ();
		
		foreach ($this->lines as $line)
		{
			if (strpos ($line, '@' . $tag) === 0)
			{
				$tags[]	= trim (substr ($line, strlen ('@' . $tag)));
			}
		}
		
		return $tags;
		
	}
1060648
public function getJob($job)
    {
        $jobId = Utilities::getEntityId(
            $job,
            'WindowsAzure\MediaServices\Models\Job'
        );

        return Job::createFromOptions($this->_getEntity("Jobs('{$jobId}')"));
    }
1181024
public function tagged($tag)
    {
        $results = [];

        if (isset($this->tags[$tag])) {
            foreach ($this->tags[$tag] as $abstract) {
                $results[] = $this->make($abstract);
            }
        }

        return $results;
    }
467769
public function transform(Job $job)
    {
        return [
            'createdAt' => $job->created_at->toW3cString(),
            'memberIds' => $job->members->pluck('id'),
            'memberName' => (count($job->members) > 0) ? $job->members->first()->user->name : null,
            'memberTagIds' => $job->member_tags->pluck('id'),
            'memberTagNames' => (count($job->member_tags) > 0)
                ? implode(', ', $job->member_tags->pluck('name')->toArray()) : null,
            'id' => $job->id,
            'locationId' => $job->location_id,
            'locationName' => is_null($job->location_id) ? null : $job->location->name,
            'start' => $job->start->toW3cString(),
            'updatedAt' => $job->updated_at->toW3cString(),
        ];
    }
217566
public function dehydrate(Job $job)
    {
        return array(
            'datePublishStart' => $job->getDatePublishStart(),
            'title' => $job->getTitle(),
            'location' => $job->getLocation(),
            'link' => $this->jobUrl->__invoke(
                $job,
                [
                  'linkOnly'=> true,
                  'absolute' => true,
                ]
            ),
            'organization' => array(
                'name' => $job->getOrganization()->getOrganizationName()->getName(),
            ),
            'template_values' => array(
                'requirements' => $job->getTemplateValues()->getRequirements(),
                'qualification' => $job->getTemplateValues()->getQualifications(),
                'benefits' => $job->getTemplateValues()->getBenefits()
            )
        );
    }
1008128
public static function getRegistered($event) {
            $listeners = [];
            foreach (self::$listeners as $ev => $registered_listeners) {
                if ($ev & $event) {
                    $listeners = array_merge($listeners, $registered_listeners);
                }
            }

            return $listeners;
        }
807998
protected function createClosurePayload( $job, $data )
	{
		$closure = $this->getEncrypter()->encrypt( ( new Serializer )->serialize( $job ) );

		return ['job' => 'IlluminateQueueClosure', 'data' => compact( 'closure' )];
	}
740909
public function push(Job $job, $queueName = '')
    {
        if (!isset($this->queues[$queueName])) {
            $this->queues[$queueName] = [];
        }

        $this->queues[$queueName][] = $job;

        return Queue::QUEUED;

    }
1215659
protected function markJobAsReserved($job)
    {
        $this->database->table($this->table)->where('id', $job->id)->update([
            'reserved_at' => $job->touch(),
            'attempts' => $job->increment(),
        ]);

        return $job;
    }
600963
public function do_job($job) {

        static $objects;

        if ($objects===null) $objects = array();

        $w = $job->workload();

        $h = $job->handle();

        $job_name = $job->functionName();

        if ($this->prefix) {
            $func = $this->prefix.$job_name;
        } else {
            $func = $job_name;
        }

        if (empty($objects[$job_name]) && !function_exists($func) && !class_exists($func, false)) {

            if (!isset($this->functions[$job_name])) {
                $this->log("Function $func is not a registered job name");
                return;
            }

            require_once $this->functions[$job_name]["path"];

            if (class_exists($func) && method_exists($func, "run")) {

                $this->log("Creating a $func object", GearmanManager::LOG_LEVEL_WORKER_INFO);
                $ns_func = "\\$func";
                $objects[$job_name] = new $ns_func();

            } elseif (!function_exists($func)) {

                $this->log("Function $func not found");
                return;
            }

        }

        $this->log("($h) Starting Job: $job_name", GearmanManager::LOG_LEVEL_WORKER_INFO);

        $this->log("($h) Workload: $w", GearmanManager::LOG_LEVEL_DEBUG);

        $log = array();

        /**
         * Run the real function here
         */
        if (isset($objects[$job_name])) {
            $this->log("($h) Calling object for $job_name.", GearmanManager::LOG_LEVEL_DEBUG);
            $result = $objects[$job_name]->run($job, $log);
        } elseif (function_exists($func)) {
            $this->log("($h) Calling function for $job_name.", GearmanManager::LOG_LEVEL_DEBUG);
            $result = $func($job, $log);
        } else {
            $this->log("($h) FAILED to find a function or class for $job_name.", GearmanManager::LOG_LEVEL_INFO);
        }

        if (!empty($log)) {
            foreach ($log as $l) {

                if (!is_scalar($l)) {
                    $l = explode("\n", trim(print_r($l, true)));
                } elseif (strlen($l) > 256) {
                    $l = substr($l, 0, 256)."...(truncated)";
                }

                if (is_array($l)) {
                    foreach ($l as $ln) {
                        $this->log("($h) $ln", GearmanManager::LOG_LEVEL_WORKER_INFO);
                    }
                } else {
                    $this->log("($h) $l", GearmanManager::LOG_LEVEL_WORKER_INFO);
                }

            }
        }

        $result_log = $result;

        if (!is_scalar($result_log)) {
            $result_log = explode("\n", trim(print_r($result_log, true)));
        } elseif (strlen($result_log) > 256) {
            $result_log = substr($result_log, 0, 256)."...(truncated)";
        }

        if (is_array($result_log)) {
            foreach ($result_log as $ln) {
                $this->log("($h) $ln", GearmanManager::LOG_LEVEL_DEBUG);
            }
        } else {
            $this->log("($h) $result_log", GearmanManager::LOG_LEVEL_DEBUG);
        }

        /**
         * Workaround for PECL bug #17114
         * http://pecl.php.net/bugs/bug.php?id=17114
         */
        $type = gettype($result);
        settype($result, $type);


        $this->job_execution_count++;

        return $result;

    }
1164538
protected function getSortedListeners($event)
    {
        if (! $this->hasListeners($event)) {
            return [];
        }

        $listeners = $this->listeners[$event];
        krsort($listeners);

        return call_user_func_array('array_merge', $listeners);
    }
1320312
public function listenersOfEvent(Event $event)
    {
        $event_name = get_class($event);
        $this->lazyLoad($event_name);

        return array_values($this->listeners[$event_name]);
    }