@param CompilerPayload $payload

@return CompilerPayload
2989
public function compileLimit(CompilerPayload $payload)
    {
        $builder = $payload->getBuilder();

        if ($builder instanceof Clause\LimitInterface && $builder->getLimitClause()) {
            $newSQL = 'LIMIT ' . $builder->getLimitClause();
            $payload = $payload->appendSQL($newSQL);
        }

        return $payload;
    }
785510
public static function generateToken($payload = null)
    {
        if (empty($payload)) {
            return false;
        }

        $token = JWT::encode($payload, Configure::read('ApiRequest.jwtAuth.cypherKey'), Configure::read('ApiRequest.jwtAuth.tokenAlgorithm'));

        return $token;
    }
279187
public function compileOrderBy(CompilerPayload $payload)
    {
        $builder = $payload->getBuilder();

        if ($builder instanceof Clause\OrderByInterface && $builder->getOrderByClauses()) {
            $newSQL = 'ORDER BY ' . implode(', ', $builder->getOrderByClauses());
            $payload = $payload->appendSQL($newSQL);
        }

        return $payload;
    }
1271547
public function fill($payload)
    {
        $payload = $this->determineTypeAndMessage($payload);
        $payload = $this->fillBlanks($payload);
        return $payload;
    }
1258193
public function enqueue($payload, $priority = 0)
    {
        $this->collection
            ->createDocument(array(
                'payload'   => $payload,
                'priority'  => (int) $priority,
                'datetime'  => new \MongoDate,
            ))
            ->save();
        
        return $this;
    }
856443
protected function processPipeClassName(string $pipe, $payload)
    {
        if (isset($this->container)) {
            $pinst = $this->container->get($pipe);
        }

        if (!isset($pinst)) {
            $pinst = new $pipe();
        }

        if (!$pinst instanceof PipeInterface) {
            throw new MissingPipeInterfaceException(get_class($pinst));
        }

        return $pinst($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);
    }
288484
public function getDataIdentifierForPayload($payload)
    {
        $resourceInformation = $this->findResourceInformation($payload);
        $resource = $resourceInformation->getResource($payload);

        return array(
            'type' => $this->exposableTypeMap->getType($resource->getType()),
            'id' => $resource->getId()
        );
    }
478262
public function triggerEvent($event, Payload $payload): string
    {
        return $this->state($payload->state())->triggerEvent($event, $payload);
    }
1026032
public static function customPayload(array $payload, string $secret): string
    {
        $builder = self::builder();

        foreach ($payload as $key => $value) {
            if (is_int($key)) {
                throw new ValidateException('Invalid payload claim.', 8);
            }

            $builder->setPayloadClaim($key, $value);
        }

        return $builder->setSecret($secret)
            ->build()
            ->getToken();
    }
158833
public function withPayload(string $payload, bool $isPayloadDetached = false): self
    {
        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;
        $clone->isPayloadDetached = $isPayloadDetached;

        return $clone;
    }
910342
public function generate($payload, $container = 'data')
    {
        if ($payload) {
            try {
                $flags = (defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT_AS_MAP')) ? (SFYaml::DUMP_OBJECT_AS_MAP | SFYaml::DUMP_EXCEPTION_ON_INVALID_TYPE) : true;
                return SFYaml::dump([$container => $payload], 9999, 4, $flags);
            } catch (\Exception $ex) {
                throw new ResponderException('Failed To Generate YAML');
            }
        }

        return '';
    }
1208961
private function queryPayload($payload, $path = null)
    {
        if(is_null($path)) return $payload;

        if(array_key_exists($path, $payload)) {
            return $payload[$path];
        }

        $dotData = Arr::dot($payload);
        if(array_key_exists($path, $dotData)) {
            return $dotData[$path];
        }

        return null;
    }
964560
protected function parseEventAndPayload($event, $payload)
    {
        if (is_object($event)) {
            list($payload, $event) = [[$event], get_class($event)];
        }

        return [$event, Arr::wrap($payload)];
    }
1007477
public function encode(Payload $payload)
    {
        $token = $this->jwt->encode($payload->get());

        return new Token($token);
    }
157308
public function payload($payload, $format = '', $container = 'data')
    {
        $class = $this->getFormatClass($format);
        return $this->generate($payload, new $class, $container);
    }
973726
protected function intoResource($payload)
    {
        // Transformer are intended to singular resources,
        // so what to do with collections
        if ($this->transformer != null) {
            $payload = $this->transformPayload($payload);
        }

        if($payload instanceof Collection || $payload instanceof AbstractPaginator) {
            return is_array($payload->first()) 
                ?  new ResourceCollection($payload->map(function($item) {
                    return new ArrayWrapper($item);
                }))
                : new ResourceCollection($payload);
        }

        if($payload instanceof Arrayable) {
            return $this->instantiateJsonResource($payload);
        }
        
        if(is_array($payload)) {
            return $this->instantiateJsonResource(new ArrayWrapper($payload));
        }
        
        if($payload instanceof \JsonSerializable) {
            return $this->instantiateJsonResource($payload);
        }

        throw new ResponderException("Cannot serialize object");
    }