Push an event to Pushman, the most used command.

@param        $event
@param string $channel
@param array  $payload
@return string
@throws \Pushman\PHPLib\Exceptions\InvalidChannelException
@throws \Pushman\PHPLib\Exceptions\InvalidEventException
775111
public function push($event, $channel = 'public', array $payload = [])
    {
        $payload = $this->preparePayload($payload);
        $this->validateEvent($event);
        $channels = $this->validateChannel($channel);

        $url = $this->getURL();

        $headers = [
            'body' => [
                'private'  => $this->privateKey,
                'channels' => $channels,
                'event'    => $event,
                'payload'  => $payload
            ]
        ];

        $response = $this->processRequest($url, $headers);

        return $response;
    }
694486
public function recordEvent($eventName, $payload)
    {
        if (! Telescope::isRecording() || $this->shouldIgnore($eventName)) {
            return;
        }

        $formattedPayload = $this->extractPayload($eventName, $payload);

        Telescope::recordEvent(IncomingEntry::make([
            'name' => $eventName,
            'payload' => empty($formattedPayload) ? null : $formattedPayload,
            'listeners' => $this->formatListeners($eventName),
            'broadcast' => class_exists($eventName)
                        ? in_array(ShouldBroadcast::class, (array) class_implements($eventName))
                        : false,
        ])->tags(class_exists($eventName) && isset($payload[0]) ? ExtractTags::from($payload[0]) : []));
    }
73922
public function pushRaw($payload, $queue = null, array $options = [])
    {
        return $this->swoole->task($payload, ! is_numeric($queue) ? -1 : (int)$queue);
    }
781157
public function fire($event, $payload=[], $halt=false)
    {

        $returnValues = [];
        $payload = (array)$payload;

        foreach ($this->getListeners($event) as $priority=>$listeners)
        {
            foreach($listeners as $listener)
            {

                $returnValue = call_user_func_array($listener, $payload);

                if( $returnValue !== null && $halt)
                {
                    return $returnValue;
                }

                if ($returnValue === false) {
                    break 2;
                }

                $returnValues[] = $returnValue;
            }

        }

        return $halt ? null : $returnValues;
    }
900126
public function pushRaw($payload, $queue = null, array $options = [])
    {
        $payload = (new JobPayload($payload))->prepare($this->lastPushed)->value;

        return tap(parent::pushRaw($payload, $queue, $options), function () use ($queue, $payload) {
            $this->event($this->getQueue($queue), new JobPushed($payload));
        });
    }
675068
public function pushRaw($payload, $queue = null, array $options = [])
    {
        $this->jobs[] = [
            'type'    => 'push',
            'payload' => $payload,
            'queue'   => $queue,
            'options' => $options,
        ];
    }
1328870
public function pushRaw($payload, $queue = null, array $options = array())
	{
		return $this->redis->rpush($this->getQueue($queue), $payload);
	}
57944
public function push($chunk)
    {
        $this->buffer .= $chunk;

        while ($this->buffer !== '') {
            if (!isset($this->buffer[7])) {
                // last header byte not set => no complete header in buffer
                break;
            }

            $header = unpack('Cstream/x/x/x/Nlength', substr($this->buffer, 0, 8));

            if (!isset($this->buffer[7 + $header['length']])) {
                // last payload byte not set => message payload is incomplete
                break;
            }

            $payload = substr($this->buffer, 8, $header['length']);
            $this->buffer = (string)substr($this->buffer, 8 + $header['length']);

            $this->emit(
                ($header['stream'] === 2) ? $this->stderrEvent : 'data',
                array($payload)
            );
        }
    }
484846
protected function fireCacheEvent($event, $payload)
	{
		if (isset($this->events))
		{
			$this->events->fire('cache.'.$event, $payload);
		}
	}
1365564
public function broadcast(array $channels, $event, array $payload = [])
    {
        $payload = ['event' => $event, 'data' => $payload];
        foreach ($channels as $channel) {
            if ($this->async)
                $this->fanout->publish_async($channel, $payload);
            else
                $this->fanout->publish($channel, $payload);
        }
    }
1050593
protected function fireCacheEvent( $event, $payload )
	{
		if ( !isset( $this->events ) )
			return null;

		switch ( $event )
		{
			case 'hit':
				if ( count( $payload ) == 2 )
					$payload[] = [];

				return $this->events->fire( new Events\CacheHit( $payload[0], $payload[1], $payload[2] ) );
			case 'missed':
				if ( count( $payload ) == 1 )
					$payload[] = [];

				return $this->events->fire( new Events\CacheMissed( $payload[0], $payload[1] ) );
			case 'delete':
				if ( count( $payload ) == 1 )
					$payload[] = [];

				return $this->events->fire( new Events\KeyForgotten( $payload[0], $payload[1] ) );
			case 'write':
				if ( count( $payload ) == 3 )
					$payload[] = [];

				return $this->events->fire( new Events\KeyWritten( $payload[0], $payload[1], $payload[2], $payload[3] ) );
		}
		return null;
	}
772872
public function fire($event, &$payload = [], $halt = false)
    {
        // When the given "event" is actually an object we will assume it is an event
        // object and use the class as the event name and this event itself as the
        // payload to the handler, which makes object based events quite simple.
        if ( is_object($event) )
        {
            list($payload, $event, $eventName) = [ [$event], $event, get_class($event) ];
        }
        else
        {
            $eventName = $event;
        }

        $responses = [];

        // If an array is not given to us as the payload, we will turn it into one so
        // we can easily use call_user_func_array on the listeners, passing in the
        // payload to each of them so that they receive each of these arguments.
        if ( ! is_array($payload) )
        {
            $payload = [$payload];
        }

        $this->firing[] = $eventName;

        if ( isset($payload[0]) && $payload[0] instanceof ShouldBroadcast )
        {
            $this->broadcastEvent($payload[0]);
        }

        foreach ($this->getListeners($event) as $listener)
        {
            dd($listener());
        	
        	try
        	{
        		$response = call_user_func_array($listener, $payload);
        	}
            catch(ValidationException $e)
            {
            	$this->validationExceptions[] = $e;
            	$response = 0;
            }

            // If a response is returned from the listener and event halting is enabled
            // we will just return this response, and not call the rest of the event
            // listeners. Otherwise we will add the response on the response list.
            if (!is_null($response) && $halt)
            {
                array_pop($this->firing);

                return $response;
            }

            // If a boolean false is returned from a listener, we will stop propagating
            // the event to any further listeners down in the chain, else we keep on
            // looping through the listeners and firing every one in our sequence.
            if ($response === false)
            {
                break;
            }

            $responses[] = $response;
        }

        array_pop($this->firing);

        if( ! empty($this->validationExceptions) )
        {
        	throw new ValidationException([], 422, $this->validationExceptions);
        	
        }

        return $halt ? null : $responses;
    }
299397
protected function push($url, array $payload, array $headers)
    {
        $request = [
            'headers' => array_merge(
                ['Content-Type' => 'application/json'],
                $headers
            ),
            'json'       => $payload,
            'exceptions' => false,
        ];

        $this->request('put', $url, $request);
    }
166881
public function pushRaw($payload, $queue = null, array $options = [])
    {
        return $this->pheanstalk->useTube($this->getQueue($queue))->put(
            $payload, Pheanstalk::DEFAULT_PRIORITY, Pheanstalk::DEFAULT_DELAY, $this->timeToRun
        );
    }
395343
public function publish($channelAlias, $payload)
    {
        $channel = $this
            ->queueAliasResolver
            ->getQueue($channelAlias);

        $payloadSerialized = $this
            ->serializer
            ->apply($payload);

        $this
            ->redis
            ->publish(
                $channel,
                $payloadSerialized
            );

        /*
         * Dispatching publisher event...
         */
        $publisherEvent = new RSQueuePublisherEvent(
            $payload,
            $payloadSerialized,
            $channel,
            $this->redis
        );

        $this
            ->eventDispatcher
            ->dispatch(
                RSQueueEvents::RSQUEUE_PUBLISHER,
                $publisherEvent
            );

        return $this;
    }
921627
public static function createMessageReadEvent(array $payload)
    {
        $read = Read::create($payload['read']);
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];

        return new MessageReadEvent($senderId, $recipientId, $timestamp, $read);
    }
473980
public function trigger($event, &$payload = null)
    {
        // Disallow calling a trigger on global hooks
        if ($event === '*') {
            return $this;
        }

        // Get all global hooks
        $globalHooks = [];
        if (isset($this->hooks['*']) && count($this->hooks['*']) > 0) {
            $globalHooks = $this->hooks['*'];
        }

        // Check if the event exists and has callables to run
        if (!isset($this->hooks[$event]) || count($this->hooks[$event]) === 0) {
            // There are no specific hooks, but maybe there's global hooks?
            if (count($globalHooks) === 0) {
                // There is nothing to do here
                return $this;
            }
            $hooks = $globalHooks;
        } else {
            $hooks = $this->hooks[$event];
            $hooks = array_merge($hooks, $globalHooks);
        }

        // All good, let's call those callables
        foreach ($hooks as $callable) {
            $callable($event, $payload);
        }
        return $this;
    }