Serialize the payload for this feedback

@param ControllerContext $controllerContext
@return mixed
761374
public function serializePayload(ControllerContext $controllerContext)
    {
        $nodeService = new NodeService();
        $node = $this->getNode();

        return [
            'contextPath' => $node->getContextPath(),
            'identifier' => $node->getIdentifier(),
            'isDocument' => $nodeService->isDocument($node)
        ];
    }
239972
public function onKernelViewSerialize(GetResponseForControllerResultEvent $event)
    {
        if (!$this->isEventEligible($event)) {
            return;
        }

        $annot = $this->extractAnnotation($event, 'OpenOrchestra\BaseApiBundle\Controller\Annotation\Serialize');

        if (!$annot) {
            return;
        }

        $format = $event->getRequest()->get('_format', 'json');
        $statusCode = 200;
        $controllerResult = $event->getControllerResult();
        if ($controllerResult instanceof ConstraintViolationListInterface) {
            $statusCode = 400;
        }

        $event->setResponse(
            new Response(
                $this->generateResponseContent(
                    $controllerResult,
                    $format
                ),
                $statusCode,
                array('content-type' => $this->generateContentType($format))
            )
        );
    }
1051477
public function authenticateRequest(DispatcherContext $context)
    {
        if($token = $this->getToken())
        {
            if($token->verify($this->getSecret()))
            {
                $user = $token->getSubject();
                $data = (array) $token->getClaim('user');

                //Ensure the token is not expired
                if($this->_check_expire)
                {
                    if(!$token->getExpireTime() || $token->isExpired()) {
                        throw new ControllerExceptionRequestNotAuthenticated('Token Expired');
                    }
                }

                //Ensure the token is not too old
                if($this->_check_age)
                {
                    if (!$token->getIssueTime() || $token->getAge() > $this->_max_age) {
                        throw new ControllerExceptionRequestNotAuthenticated('Token Expired');
                    }
                }
                //Ensure the user exists
                if($this->_check_user)
                {
                    //Ensure we have a username
                    if(empty($user)) {
                        throw new ControllerExceptionRequestNotAuthenticated('Invalid User');
                    }

                    if($this->getObject('user.provider')->getUser($user)->getId() == 0) {
                        throw new ControllerExceptionRequestNotAuthenticated('User Not Found');
                    }
                }

                //Login the user
                return $this->loginUser($user, $data);
            }
            else throw new ControllerExceptionRequestNotAuthenticated('Invalid Token');
        }
    }
327212
public function serialize(SpanContext $context)
    {
        $spanHex = str_pad($context->spanId(), 16, "0", STR_PAD_LEFT);
        $traceOptions = $context->enabled() ? self::OPTION_ENABLED : 0;
        return pack("CCH*CH*CC", 0, 0, $context->traceId(), 1, $spanHex, 2, $traceOptions);
    }
571223
private function getApiResponseContext(RequestContext $requestContext): ResponseContextAbstract
    {
        $responseContext = $this->httpClient->sendRequest(
            $requestContext
        );

        $this->processApiResponseContextErrors($responseContext);

        return $responseContext;
    }
945409
function serialize($charset_encoding='')
		{
			if ($charset_encoding != '')
				$this->content_type = $this->content_type . '; charset=' . $charset_encoding;
			else
				$this->content_type = $this->content_type;
			$this->payload = serialize_ezjscoreresp($this, $charset_encoding, $this->content_type);
			return $this->payload;
		}
825011
protected function _fetchData(ViewContext $context)
    {
        $output = new \ArrayObject(array(
            'jsonapi' => array('version' => $this->_version),
            'links'   => array('self' => $this->getUrl()->toString()),
            'data'    => array()
        ));

        $model  = $this->getModel();
        $url    = $this->getUrl();

        if ($this->isCollection())
        {
            foreach ($model->fetch() as $entity) {
                $output['data'][] = $this->_createResource($entity);
            }

            $total  = $model->count();
            $limit  = (int) $model->getState()->limit;
            $offset = (int) $model->getState()->offset;

            $output['meta'] = array(
                'offset'   => $offset,
                'limit'    => $limit,
                'total'	   => $total
            );

            if ($limit && $total-($limit + $offset) > 0) {
                $output['links']['next'] = $url->setQuery(array('offset' => $limit+$offset), true)->toString();
            }

            if ($limit && $offset && $offset >= $limit) {
                $output['links']['prev'] = $url->setQuery(array('offset' => max($offset-$limit, 0)), true)->toString();
            }
        }
        else $output['data'] = $this->_createResource($model->fetch());

        if ($this->_included_resources) {
            $output['included'] = array_values($this->_included_resources);
        }

        $context->content = $output;
    }
1022379
public function serializeContextFunction($context)
    {
        $json = array();

        foreach ($context as $key => $value) {
            if (!in_array($key, array('_parent', 'assetic', 'app')) && !preg_match('#sonata#', $key)) {
                try {
                    $serializedValue = $this->serializer->serialize($value, 'json');
                } catch (\JMS\Serializer\Exception\RuntimeException $ex) {
                    $serializedValue = json_encode($value, null, 2);
                }

                if (!empty($serializedValue)) {
                    $json[] = $this->serializer->serialize($key, 'json').':'.$serializedValue;
                }
            }
        }

        return '{'.implode(',', $json).'}';
    }
1335664
protected function _serialize()
    {
        $this->_renderRow($this->viewVars['_header']);
        $this->_renderContent();
        $this->_renderRow($this->viewVars['_footer']);
        $content = $this->_renderRow(false);
        $this->_resetStaticVariables = true;
        $this->_renderRow();

        return $content;
    }
1207109
public function serialize($subject, &$data = array(), SerializerInterface $serializer = null)
    {
        $context = $this->serializer();
        $context($subject, $data, $serializer);
        return $data;
    }
503135
public function onKernelController(FilterControllerEvent $event)
    {
        $request    = $event->getRequest();
        $controller = $event->getController();

        if (is_callable($controller) && method_exists($controller, '__invoke')) {
            $controller = [$controller, '__invoke'];
        }
        
        $this->scopeFetcher->setController($controller);

        $attributeName = $this->getAttributeName($controller);
        $request->attributes->set($attributeName, $this->scopeFetcher);
    }
969760
protected function _afterRead(ControllerContextModel $context)
    {
        $entity = $context->result;

        //Add the notice if the resource is locked
        if($this->canEdit() && $entity->isLockable() && $entity->isLocked())
        {
            //Prevent a re-render of the message
            if($context->request->getUrl() != $context->request->getReferrer())
            {
                if($entity->isLockable() && $entity->isLocked())
                {
                    $user    = $entity->getLocker();
                    $date    = $this->getObject('date', array('date' => $entity->locked_on));
                    $message = $this->getObject('translator')->translate(
                        'Locked by {name} {date}', array('name' => $user->getName(), 'date' => $date->humanize())
                    );

                    $context->response->addMessage($message, 'notice');
                }
            }
        }
    }
1317965
private function responseFrom(ControllerContextInterface $context)
    {
        $response = $context->response();
        if (! $response instanceof ResponseInterface) {
            throw new MissingResponseException(
                "Missing response object after handle the request. If you disabled rendering you need to ".
                "provide an HTTP response object to be returned to the client. Use Context::setResponse() ".
                "to provide a response to be returned."
            );
        }

        return $response;
    }
614091
protected function _actionAdd(ControllerContext $context)
    {
        $entity = $context->entity;

        //Only throw an error if the action explicitly failed.
        if($entity->save() === false)
        {
            $error = $entity->getStatusMessage();
            throw new ControllerExceptionActionFailed($error ? $error : 'Add Action Failed');
        }
        else
        {
            if ($entity instanceof ModelEntityInterface)
            {
                $url = clone $context->request->getUrl();

                if ($this->getModel()->getState()->isUnique())
                {
                    $states = $this->getModel()->getState()->getValues(true);

                    foreach ($states as $key => $value) {
                        $url->query[$key] = $entity->getProperty($key);
                    }
                }
                else $url->query[$entity->getIdentityKey()] = $entity->getProperty($entity->getIdentityKey());

                $context->response->headers->set('Location', (string) $url);
                $context->response->setStatus(HttpResponse::CREATED);
            }
        }

        return $entity;
    }
24744
private function fillGeneralRequestSettings(RequestContext $requestContext): RequestContext
    {
        $requestContext
            ->setContentType(RequestContext::CONTENT_TYPE_FORM_URLENCODED)
            ->setResponseContextClass(JsonResponseContext::class);

        return $requestContext;
    }
22494
public function serializeNodeRecursively(NodeInterface $node, ControllerContext $controllerContext)
    {
        $result = [
            $node->getContextPath() => $this->nodeInfoHelper->renderNodeWithPropertiesAndChildrenInformation($node, $controllerContext)
        ];

        if ($this->isRecursive === true) {
            foreach ($node->getChildNodes() as $childNode) {
                $result = array_merge($result, $this->serializeNodeRecursively($childNode, $controllerContext));
            }
        }

        return $result;
    }
413218
public function serialize() {
        $data = array();
        foreach (get_object_vars($this) as $name => $value) {
            if (! $this->filterRequestNames($name)) {
                $data[$name] = $value;
            }
        }
        return serialize($data);
    }