You are here

protected function Client::getScript in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/http-kernel/Client.php \Symfony\Component\HttpKernel\Client::getScript()
  2. 8 vendor/symfony/browser-kit/Client.php \Symfony\Component\BrowserKit\Client::getScript()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Client.php \Symfony\Component\HttpKernel\Client::getScript()

Returns the script to execute when the request must be insulated.

Parameters

Request $request A Request instance:

Return value

string

Overrides Client::getScript

1 call to Client::getScript()
TestClient::getScript in vendor/symfony/http-kernel/Tests/Fixtures/TestClient.php
Returns the script to execute when the request must be insulated.
1 method overrides Client::getScript()
TestClient::getScript in vendor/symfony/http-kernel/Tests/Fixtures/TestClient.php
Returns the script to execute when the request must be insulated.

File

vendor/symfony/http-kernel/Client.php, line 95

Class

Client
Client simulates a browser and makes requests to a Kernel object.

Namespace

Symfony\Component\HttpKernel

Code

protected function getScript($request) {
  $kernel = str_replace("'", "\\'", serialize($this->kernel));
  $request = str_replace("'", "\\'", serialize($request));
  $r = new \ReflectionClass('\\Symfony\\Component\\ClassLoader\\ClassLoader');
  $requirePath = str_replace("'", "\\'", $r
    ->getFileName());
  $symfonyPath = str_replace("'", "\\'", dirname(dirname(dirname(__DIR__))));
  $errorReporting = error_reporting();
  $code = <<<EOF
<?php

error_reporting({<span class="php-variable">$errorReporting</span>} & ~E_USER_DEPRECATED);

require_once '{<span class="php-variable">$requirePath</span>}';

\$loader = new Symfony\\Component\\ClassLoader\\ClassLoader();
\$loader->addPrefix('Symfony', '{<span class="php-variable">$symfonyPath</span>}');
\$loader->register();

\$kernel = unserialize('{<span class="php-variable">$kernel</span>}');
\$request = unserialize('{<span class="php-variable">$request</span>}');
EOF;
  return $code . $this
    ->getHandleScript();
}