@param array $payload

@return MessageEchoEvent
3992
public static function createMessageEchoEvent(array $payload)
    {
        $message = MessageEcho::create($payload['message']);
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];

        return new MessageEchoEvent($senderId, $recipientId, $timestamp, $message);
    }
787668
public function event($eventName, array $payload)
    {
        $topic = getenv('MULTICAST_TOPIC_NAME') ? getenv('MULTICAST_TOPIC_NAME') : 'multicast_event';

        $this->producer = $this->eventProducer->setTargetServiceName($this->namespace . '.' . $topic);

        $this->send($eventName, $payload);

        return $this;
    }
266180
public static function createPostbackEvent(array $payload)
    {
        $postback = Postback::create($payload['postback']);
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];

        return new PostbackEvent($senderId, $recipientId, $timestamp, $postback);
    }
337251
public function process(array $pipes, $payload)
    {
        foreach ($pipes as $pipe) {
            $payload = $this->resolvePipe($pipe, $payload);
        }

        return $payload;
    }
415111
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];
        $takeThreadControl = TakeThreadControl::create($payload['take_thread_control']);

        return new static($senderId, $recipientId, $timestamp, $takeThreadControl);
    }
1074352
public function bind(array $payload=null)
    {
        $bound = false;
        $this->_boundEntities = array();

        if (!is_null($payload)
            && isset($payload[$this->getName()])
            && $this->validateSynchronizerToken($payload)
        ) {
            $this->logger->debug('start binding form', array('name' => $this->getName(), 'payload' => $payload));

            $propertyMapper = new PropertyMapper();

            $formOptions = $this->buildFormOptions($payload);

            if ($this->getEntityContainerMap()->count() > 0) {
                $entityContainers = $this->getEntityContainerMap()->getAll();

                /**
                 * @var $entityContainer    \Naucon\Form\Mapper\EntityContainerInterface
                 */
                foreach ($entityContainers as $entityContainer) {
                    $name = $entityContainer->getName();

                    if (is_null($formOptions) || in_array($name, $formOptions)) {
                        $this->_formOptionValues[] = $name;
                        if (isset($payload[$this->getName()][$name])) {
                            $formData = $payload[$this->getName()][$name];

                            $propertyMapper->mapFormToData($entityContainer->getEntity(), $formData);
                            $this->addBoundEntity($entityContainer->getEntity());

                            // postbind hook
                            $this->logger->debug('invoke form postbind hook', array('name' => $this->getName(), 'entity' => $entityContainer->getName()));
                            $entityContainer->invokeHook('postbindHook');

                        }
                    } elseif (!is_null($formOptions) && !in_array($name, $formOptions)) {
                        $entityContainer->setValidate(false);
                    }
                }
            }

            switch($this->configuration->get('collection_type'))
            {
                case self::COLLECTION_TYPE_ONE:
                    if (count($this->getBoundEntities())==1) {
                        $bound = true;
                    }
                    break;
                case self::COLLECTION_TYPE_MANY:
                    if (count($this->getBoundEntities()) == count($this->_formOptionValues)) {
                        $bound = true;
                    }
                    break;
                case self::COLLECTION_TYPE_ALL:
                    if ($this->getEntityContainerMap()->count() == count($this->getBoundEntities())) {
                        $bound = true;
                    }
                    break;
                case self::COLLECTION_TYPE_ANY:
                    if ($this->getEntityContainerMap()->count() > 0) {
                        $bound = true;
                    }
                    break;
            }

        }

        $this->setBound($bound);

        $this->logger->debug('execute post binding form', array('name' => $this->getName()));
        $this->postBind();

        if ($this->isBound()) {
            $this->logger->debug('finished binding form successful', array('name' => $this->getName()));
        } else {
            $this->logger->debug('finished binding form failed', array('name' => $this->getName()));
        }
        return $this->isBound();
    }
994908
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];
        $payment = Payment::create($payload['payment']);

        return new static($senderId, $recipientId, $timestamp, $payment);
    }
1296930
function buildPayload(&$payload)
    {
        if (is_array($payload)) {
            $payload = $this->array_map_deep($payload, array($this, 'buildPayloadItemInfo'));
        } else {
            $payload = $this->makePayloadBuilder($payload);
            $this->buildPayload($payload);
        }

        return $payload;
    }
478262
public function triggerEvent($event, Payload $payload): string
    {
        return $this->state($payload->state())->triggerEvent($event, $payload);
    }
1283516
protected function resolveAndHandle(array $payload)
    {
        list($class, $method) = Str::parseCallback($payload['job'], 'handle');

        $this->instance = $this->resolve($class);

        call_user_func(array($this->instance, $method), $this, $payload['data']);
    }
118265
public function update(array $payload): Response
    {
        $this->requiresAccessToken();

        return $this->sendJson(
            'PATCH', 'profile', $this->getApiHeaders(), $this->mergeApiBody($payload)
        );
    }
124754
public function process($payload)
    {
        foreach ($this->stages as $stage) {
            $payload = call_user_func($stage, $payload);
        }
        return $payload;
    }
419309
public static function create(array $payload): AbstractEvent
    {
        foreach (array_keys($payload) as $key) {
            if (\array_key_exists($key, self::EVENTS)) {
                $className = self::EVENTS[$key];
                if (isset($payload['message']['is_echo'])) {
                    $className = MessageEchoEvent::class;
                }

                return $className::create($payload);
            }
        }

        return RawEvent::create($payload);
    }
481521
protected function addRequestInformation(&$payload)
    {
        if ($this->container->bound('request')) {
            $payload = array_merge($payload, [
                'ip_address' => $this->ipAddress(),
                'user_agent' => $this->userAgent(),
            ]);
        }

        return $this;
    }
497758
public static function get($payload)
    {
        switch ($payload) {
            case 'OK':
            case 'QUEUED':
                if (isset(self::$$payload)) {
                    return self::$$payload;
                }

                return self::$$payload = new self($payload);

            default:
                return new self($payload);
        }
    }
1171980
public static function unserializeMessagePayload($payload)
    {
        $message = json_decode($payload, true);
        if (json_last_error() === JSON_ERROR_NONE) {
            return $message;
        }

        return $payload;
    }
665473
public static function create(array $payload): self
    {
        $senderId = isset($payload['sender']) ? $payload['sender']['id'] : '';
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];
        $appRoles = AppRoles::create($payload['app_roles']);

        return new static($senderId, $recipientId, $timestamp, $appRoles);
    }