Returns method to call for applying a given domain event to the aggregate.
This can be overridden to suit your custom naming convention.

@param Serializable $payload

@return string
495651
protected function applyMethod(Serializable $payload)
    {
        $className = get_class($payload);

        return 'apply'.substr($className, strrpos($className, '\\') + 1);
    }
288484
public function getDataIdentifierForPayload($payload)
    {
        $resourceInformation = $this->findResourceInformation($payload);
        $resource = $resourceInformation->getResource($payload);

        return array(
            'type' => $this->exposableTypeMap->getType($resource->getType()),
            'id' => $resource->getId()
        );
    }
1117169
protected function dispatch(string $aggregateId, PayloadInterface $payload, array $metaData = null): void
    {
        $this
            ->getCommandDispatcher()
            ->dispatch(
                new CommandMessage(
                    $payload,
                    new PayloadType($payload),
                    $aggregateId,
                    $metaData
                )
            );
    }
1059688
public function triggerEvent($event, Payload $payload)
    {
        if ($payload->state() === null) {
            $this->updatePayload($this->process->initialState(), $payload);
        }

        $state = $this->process->state($payload->state());

        $nextStateName = $state->triggerEvent($event, $payload);
        if ($nextStateName === null) {
            return;
        }

        $state = $this->process->state($nextStateName);

        $this->updatePayload($state, $payload);
        $this->handleOnStateWasSet($state, $payload);
    }
1228687
public function handle($event, $payload)
    {
        list($model) = $payload;

        // Don't log changes to pivot models.  Even though a user may have initiated
        // this, it's kind of meaningless to them.  These events can happen when a
        // user messes with drag and drop positioning.
        if (is_a($model, \Illuminate\Database\Eloquent\Relations\Pivot::class)) {
            return;
        }

        // Get the action of the event
        preg_match('#eloquent\.(\w+)#', $event, $matches);
        $action = $matches[1];
        if (!in_array($action, $this->supported)) {
            return;
        }

        // Get the admin acting on the record
        $admin = app('decoy.user');

        // If `log_changes` was configed as a callable, see if this model event
        // should not be logged
        if ($check = config('decoy.site.log_changes')) {
            if (is_bool($check) && !$check) {
                return;
            }
            if (is_callable($check)) {
                \Log::error('Callable log_changes have been deprecated');
                if (!call_user_func($check, $model, $action, $admin)) {
                    return;
                }
            }
        } else {
            return;
        }

        // Check with the model itself to see if it should be logged
        if (method_exists($model, 'shouldLogChange')) {
            if (!$model->shouldLogChange($action)) {
                return;
            }

        // Default to not logging changes if there is no shouldLogChange()
        } else {
            return;
        }

        // Log the event
        Change::log($model, $action, $admin);
    }
1110217
private function sign(array $payload): string
    {
        $jsonConverter = new StandardConverter();
        $payload = array_merge(
            $payload,
            $this->getAdditionalPayload()
        );
        $headers = $this->getSignatureHeader();
        $signatureKey = $this->signatureKeyset->get($this->signatureKeyIndex);
        if ($signatureKey->has('kid')) {
            $headers['kid'] = $signatureKey->get('kid');
        }

        $jws = $this->jwsBuilder
            ->create()
            ->withPayload($jsonConverter->encode($payload))
            ->addSignature($signatureKey, $headers)
            ->build();

        $serializer = new JWSCompactSerializer($jsonConverter);

        return $serializer->serialize($jws, 0);
    }
157308
public function payload($payload, $format = '', $container = 'data')
    {
        $class = $this->getFormatClass($format);
        return $this->generate($payload, new $class, $container);
    }
264022
public static function createReferralEvent(array $payload)
    {
        $referral = Referral::create($payload['referral']);
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];

        return new ReferralEvent($senderId, $recipientId, $timestamp, $referral);
    }
219165
protected function callHandler(callable $handler, $payload)
    {
        try {
            return $handler($payload);
        } catch (\Exception $e) {
            if (property_exists($this, 'app') && $this->app instanceof ServiceContainer) {
                $this->app['logger']->error($e->getCode().': '.$e->getMessage(), [
                    'code' => $e->getCode(),
                    'message' => $e->getMessage(),
                    'file' => $e->getFile(),
                    'line' => $e->getLine(),
                ]);
            }
        }
    }
1136456
public function process($payload) {
        $result = $this->convertToObject($payload, true);

        return $this->processPayload($result);
    }
1198439
final protected function applyChange(Serializable $payload)
    {
        $this->apply($payload);
        $this->changes()->addEventFromPayload($payload);
    }
89042
public function deserializeToken($payload)
  {
    try {
      $payload = str_replace(array('-', '_'), array('+', '/'), $payload);
      $data = $this->encrypter->decrypt($payload);
    } catch (DecryptException $e) {
      return null;
    }

    if(empty($data['id']) || empty($data['key'])) {
      return null;
    }

    $token = $this->generateAuthToken($data['key']);
    $token->setAuthIdentifier($data['id']);

    return $token;
  }
55626
public static function create(array $payload)
    {
        // MessageEvent & MessageEchoEvent
        if (isset($payload['message'])) {
            if (isset($payload['message']['is_echo'])) {
                return self::createMessageEchoEvent($payload);
            }

            return self::createMessageEvent($payload);
        }
        
        // PostbackEvent
        if (isset($payload['postback'])) {
            return self::createPostbackEvent($payload);
        }

        // AuthenticationEvent
        if (isset($payload['optin'])) {
            return self::createAuthenticationEvent($payload);
        }

        // AccountLinkingEvent
        if (isset($payload['account_linking'])) {
            return self::createAccountLinkingEvent($payload);
        }

        // MessageDeliveryEvent
        if (isset($payload['delivery'])) {
            return self::createMessageDeliveryEvent($payload);
        }

        // MessageReadEvent
        if (isset($payload['read'])) {
            return self::createMessageReadEvent($payload);
        }

        // ReferralEvent
        if(isset($payload['referral'])) {
            return self::createReferralEvent($payload);
        }

        return new RawEvent($payload['sender']['id'], $payload['recipient']['id'], $payload);
    }
1294706
public static function createMessageDeliveryEvent(array $payload)
    {
        $delivery = Delivery::create($payload['delivery']);
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];

        return new MessageDeliveryEvent($senderId, $recipientId, $delivery);
    }
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')
        );
    }
1271547
public function fill($payload)
    {
        $payload = $this->determineTypeAndMessage($payload);
        $payload = $this->fillBlanks($payload);
        return $payload;
    }
1204227
protected function parseEventAndPayload($event, $payload)
    {
        if (is_object($event)) {
            list($payload, $event) = [[$event], get_class($event)];
        }

        return [$event, array_wrap($payload)];
    }