Visit struct returned by controllers.

@param mixed $data

@return \Symfony\Component\HttpFoundation\Response
557797
public function visit($data)
    {
        $this->generator->reset();
        $this->generator->startDocument($data);

        $this->visitValueObject($data);

        //@todo Needs refactoring!
        // A hackish solution to enable outer visitors to disable setting
        // of certain headers in inner visitors, for example Accept-Patch header
        // which is valid in GET/POST/PATCH for a resource, but must not appear
        // in the list of resources
        foreach ($this->response->headers->all() as $headerName => $headerValue) {
            if ($headerValue[0] === false) {
                $this->response->headers->remove($headerName);
            }
        }

        $response = clone $this->response;

        $response->setContent($this->generator->isEmpty() ? null : $this->generator->endDocument($data));

        // reset the inner response
        $this->response = new Response(null, 200);
        $this->statusCode = null;

        return $response;
    }
279450
public function respondWithData(array $data)
    {

        $responseData = $this->getResponseStructure(true, $data, '');
        $response = new JsonResponse($responseData, $this->getStatusCode(), $this->getHeaders());
        return $response;
    }
467577
public function sendData($data)
    {
        $httpResponse = $this->sendRequest($this->getEndpointAction(), null, 'GET');
        $responseData = json_decode($httpResponse->getBody(true), true);

        return $this->response = new HostedPurchaseResponse($this, $responseData);
    }
1285897
public static function createFromJsonResponse($data)
    {
        $data = json_decode($data, true);

        $stacks = array_map(function ($stack) {
            return Stack::createFromDecodedJsonResponse($stack);
        }, $data['items']);

        return new self($stacks);
    }
109168
public function setStructureMetadata($data)
    {
        if ($data === null) {
            $this->structureMetadata = $data;
            $this->terminalStructureMetadata = $data;
        } elseif (is_array($data)) {
            $struct = $this->createStructureMetadata();
            $struct->merge($data);

            $this->structureMetadata = $struct;
            $this->terminalStructureMetadata = $data;
        } elseif ($data instanceof MetadataInterface) {
            $this->structureMetadata = $data;
            $this->terminalStructureMetadata = $data;
        } else {
            throw new InvalidArgumentException(sprintf(
                'Structure [%s] is invalid (must be array or an instance of %s).',
                (is_object($data) ? get_class($data) : gettype($data)),
                StructureMetadata::class
            ));
        }

        $this->isStructureFinalized = false;

        return $this;
    }
863520
public function sendData($data)
    {
        $method = $this->getRequestMethod();
        $url    = $this->getRequestUrl($data);
        $body   = $this->getRequestBody();

        $headers = [
            'Content-Type' => 'application/x-www-form-urlencoded'
        ];

        $response = $this->httpClient->request($method, $url, $headers, $body);

        $payload = $this->decode($response->getBody());

        return $payload;
    }
1097545
public function sendData($data)
    {
        $response = $this->braintree->transaction()->void($data['transactionReference']);

        return $this->createResponse($response);
    }
404855
public function sendData($data)
    {
        if (is_array($data) && count($data)) {
            $class = $this->getResponseClass();

            return $this->response = new $class($this, $data);
        }

        return false;
    }
1150362
public function route($data)
    {
        if (is_array($data)) {
            $path = $data[0];
            $pkg = $data[1];
        } else {
            $path = $data;
        }

        $path = trim($path, '/');
        $pkgHandle = null;
        if ($pkg) {
            if (is_object($pkg)) {
                $pkgHandle = $pkg->getPackageHandle();
            } else {
                $pkgHandle = $pkg;
            }
        }

        $route = '/ccm';
        if ($pkgHandle) {
            $route .= "/{$pkgHandle}";
        } else {
            $route .= '/system';
        }

        $route .= "/{$path}";

        return $route;
    }
1161052
protected function returnData($data)
    {
        if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false) {
            $this->returnJson([
                'success' => true,
                'data' => $data,
            ]);
        } else {
            $this->setData('breadcrumbs', $data);
            $this->setView('blocks/breadcrumbs.tpl', 'tao');
        }
    }
54316
protected function createStructure( array $data )
    {
        if ( isset( $data['proxyData'] ) )
        {
            $proxyData = $data['proxyData'] ?: array();
            unset( $data['proxyData'] );
        }
        else
        {
            $proxyData = $data;
        }

        $proxyData['proxyBase'] = parent::createStructure( $data );
        $proxyData['type']      = $proxyData['proxyBase']->type;

        return $this->structureFactory
                    ->factory( $proxyData );
    }
1109306
public function sendData($data)
    {
        $httpResponse = $this->sendRequest('GET', '/gateways', json_encode($data));

        $this->response = new RestFetchPaymentMethodsResponse(
            $this,
            json_decode($httpResponse->getBody()->getContents(), true)
        );

        return $this->response;
    }
1371854
public function sendData($data)
    {
        $response = $this->gocardless->mandates()->create($data);

        return $this->response = new MandateResponse($this, $response);
    }
584179
public function render($data)
    {
        $in_data = array ('items' => $data);
        return $this->_twig->render($this->_template, $in_data);
    }
785791
public function createStructure( array $data )
    {
        $structure = parent::createStructure( $data );

        if ( $structure instanceof SiteInfoAwareInterface )
        {
            $structure->setSiteInfo( $this->getSiteInfo() );
        }

        return $structure;
    }
1032579
public function sendData($data)
    {
        $data = $this->httpRequest('back', $data);

        return $this->response = new ExpressResponse($this, $data);
    }
335001
public function sendData($data)
    {
        $response = $this->gocardless->events()->get($this->getEventId());

        return $this->response = new EventResponse($this, $response);
    }