Mutate the state of the aggregate by applying a domain event.

@param Serializable $payload
337237
final private function apply(Serializable $payload)
    {
        $method = $this->applyMethod($payload);
        $this->$method($payload);
    }
897585
protected function serialize($payload)
    {
        // convert identifier to Doctrine object
        if (is_array($payload) || is_scalar($payload)) {
            // just use the id when no keys are given (Doctrine expects an array like [id: 1234]
            if (is_array($payload) && is_numeric(key($payload))) {
                $payload = current($payload);
            }

            $payload = $this->doctrine->getRepository($this->className)->find($payload);
        }

        // anything else is just wrong at this point
        if (!is_object($payload) || !($payload instanceof $this->className)) {
            throw new \RuntimeException(
                sprintf('Expecting object of type %s, but got %s', $this->className, var_export($payload, true))
            );
        }

        return parent::serialize($payload);
    }
118265
public function update(array $payload): Response
    {
        $this->requiresAccessToken();

        return $this->sendJson(
            'PATCH', 'profile', $this->getApiHeaders(), $this->mergeApiBody($payload)
        );
    }
779517
public function put($route, array $binds = [], $payload = [])
    {
        $this->setParam($route, $binds);

        return $this->createRequest('PUT', $payload);
    }
174018
public function broadcast(array $channels, $event, array $payload = [])
    {
        $this->pushman->push($event, $channels, $payload);
    }
1066647
public function setPayload(string $payload): self
    {
        $this->checkContentType();
        $this->isValidString($payload, 1000);

        $this->payload = $payload;

        return $this;
    }
596681
public function update(array $payload): bool
    {
        $resourceType = static::resourceType();
        $response = null;

        try {
            $response = $this->getHttpClient()->request('PUT', $this->apiUrl(), [
                'json' => $payload,
            ]);
        } catch (RequestException $e) {
            $this->throwResourceException($e->getResponse(), 'update', UpdateResourceException::class);
        }

        $json = json_decode((string) $response->getBody(), true);

        if (empty($json[$resourceType])) {
            return false;
        }

        $this->data = $json[$resourceType];

        return true;
    }
1024281
protected function buildRefreshClaims(Payload $payload)
    {
        // assign the payload values as variables for use later
        extract($payload->toArray());

        // persist the relevant claims
        return array_merge(
            $this->customClaims,
            compact($this->persistentClaims, 'sub', 'iat')
        );
    }
250615
public function unserialize($serialized)
	{
		list(	$this->deviceToken,
				$this->certificate,
				$this->expiresAt,
				$this->alert,
				$this->badge,
				$this->sound,
				$this->payload,
				$this->contentAvailable) = unserialize($serialized);
	}
814371
public function withPayload($payload): self
    {
        $payload = \is_string($payload) ? $payload : $this->jsonConverter->encode($payload);
        if (false === \mb_detect_encoding($payload, 'UTF-8', true)) {
            throw new \InvalidArgumentException('The payload must be encoded in UTF-8');
        }
        $clone = clone $this;
        $clone->payload = $payload;

        return $clone;
    }
1065565
final public function process($payload)
    {
        $payload = $this->processor->processStack($payload, $this->stack);

        if ( $this->next instanceof PipeChainInterface ) {
            $payload = $this->next->process($payload);
        }

        return $payload;
    }
1324659
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];
        $message = Message::create($payload['message']);

        return new static($senderId, $recipientId, $timestamp, $message);
    }
83402
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();

            /**
             * @var $entityContainer    \Naucon\Form\Mapper\EntityContainerInterface
             */
            if ($this->getEntityContainerMap()->count() > 0) {
                if (!is_null($entityContainer = current($this->getEntityContainerMap()->getAll()))) {
                    $propertyMapper->mapFormToData($entityContainer->getEntity(), $payload[$this->getName()]);
                    $this->addBoundEntity($entityContainer->getEntity());

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

                    $bound = true;
                }
            }
        }


        $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();
    }
1011092
final private function replayChange(Event $event)
    {
        $this->apply($event->payload());
        $this->lastCommittedEventSequenceNumber = $event->sequenceNumber();
    }
1136456
public function process($payload) {
        $result = $this->convertToObject($payload, true);

        return $this->processPayload($result);
    }
1171980
public static function unserializeMessagePayload($payload)
    {
        $message = json_decode($payload, true);
        if (json_last_error() === JSON_ERROR_NONE) {
            return $message;
        }

        return $payload;
    }
1048987
public function encode(Payload $payload)
    {
        $token = $this->provider->encode($payload->get());

        return new Token($token);
    }