prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Retry;
use Symfony\Component\HttpClient\Response... | to signal that the body is required to take a decision
*/
public function shouldRetry(AsyncContext $context, ?string $responseContent, ?TransportExceptionInterface $exception): ?bool;
/**
* Returns the time to wait in milliseconds.
| ce RetryStrategyInterface
{
/**
* Returns whether the request should be retried.
*
* @param ?string $responseContent Null is passed when the body did not arrive yet
*
* @return bool|null Returns null | {
"filepath": "src/Symfony/Component/HttpClient/Retry/RetryStrategyInterface.php",
"language": "php",
"file_size": 1136,
"cut_index": 518,
"middle_length": 229
} |
lientTrait;
use Symfony\Component\HttpClient\Internal\AmpBody;
use Symfony\Component\HttpClient\Internal\AmpClientState;
use Symfony\Component\HttpClient\Internal\Canary;
use Symfony\Component\HttpClient\Internal\ClientState;
use Symfony\Contracts\HttpClient\ResponseInterface;
use function Amp\delay;
use function Amp\... | State $multi,
Request $request,
array $options,
?LoggerInterface $logger,
) {
$this->options = &$options;
$this->logger = $logger;
$this->timeout = $options['timeout'];
$this->shouldBuffer = $opti | use TransportResponseTrait;
private static string $nextId = 'a';
private ?array $options;
private \Closure $onProgress;
/**
* @internal
*/
public function __construct(
private AmpClient | {
"filepath": "src/Symfony/Component/HttpClient/Response/AmpResponse.php",
"language": "php",
"file_size": 17574,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient\Response;
use Symfony\Component\HttpClient\Chunk\DataChunk;
use Symfony\Component\HttpClient\Chunk\LastChunk;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Contracts\HttpClient\ChunkInterface;
use Symfony\Contracts\Ht... | allable &$passthru,
private HttpClientInterface $client,
ResponseInterface &$response,
array &$info,
private $content,
private int $offset,
) {
$this->passthru = &$passthru;
$this->response = &$re | ntext
{
/** @var callable|null */
private $passthru;
private ResponseInterface $response;
private array $info = [];
/**
* @param resource|null $content
*/
public function __construct(
?c | {
"filepath": "src/Symfony/Component/HttpClient/Response/AsyncContext.php",
"language": "php",
"file_size": 5655,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Internal;
use Amp\ByteStream\ReadableBuffer;
use Amp\ByteStream\ReadableIterableStream;
use Amp\ByteStream\ReadableResourceStream;
use Amp\ByteS... | gth = -1;
private ?int $uploaded = null;
/**
* @param \Closure|resource|string $body
*/
public function __construct(
$body,
&$info,
private \Closure $onProgress,
) {
$this->info = &$info;
| @internal
*/
class AmpBody implements HttpContent, ReadableStream, \IteratorAggregate
{
private ReadableStream $body;
private ?string $content;
private array $info;
private ?int $offset = 0;
private int $len | {
"filepath": "src/Symfony/Component/HttpClient/Internal/AmpBody.php",
"language": "php",
"file_size": 3953,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient\Internal;
use Amp\DeferredCancellation;
use Amp\Http\Client\ApplicationInterceptor;
use Amp\Http\Client\Connection\Connection;
use Amp\Http\Client\Connection\Stream;
use Amp\Http\Client\EventListener;
use Amp\Http\Client\NetworkInterceptor;
use A... | ion __construct(
array &$info,
private array $pinSha256,
private \Closure $onProgress,
private &$handle,
private float $maxConnectDuration,
private DeferredCancellation $canceller,
) {
$info += [
| as Grekas <p@tchwork.com>
*
* @internal
*/
class AmpListener implements EventListener
{
private array $info;
private ?string $connectTimerId = null;
/**
* @param resource|null $handle
*/
public funct | {
"filepath": "src/Symfony/Component/HttpClient/Internal/AmpListener.php",
"language": "php",
"file_size": 7467,
"cut_index": 716,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Internal;
use Amp\Cancellation;
use Amp\Dns;
use Amp\Dns\DnsRecord;... | :A;
$ip = $this->dnsMap[$name] ?? null;
if (null !== $ip && str_contains($ip, ':')) {
$recordType = DnsRecord::AAAA;
}
if (null === $ip || $recordType !== ($typeRestriction ?? $recordType)) {
return | public function __construct(
private array &$dnsMap,
) {
}
public function resolve(string $name, ?int $typeRestriction = null, ?Cancellation $cancellation = null): array
{
$recordType = DnsRecord: | {
"filepath": "src/Symfony/Component/HttpClient/Internal/AmpResolver.php",
"language": "php",
"file_size": 1628,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient\Internal;
use Http\Client\Exception\NetworkException;
use Http\Promise\Promise;
use Psr\Http\Message\RequestInterface as Psr7RequestInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface as Psr7ResponseIn... | nal class HttplugWaitLoop
{
/**
* @param \SplObjectStorage<ResponseInterface, array{Psr7RequestInterface, Promise}>|null $promisePool
*/
public function __construct(
private HttpClientInterface $client,
private ?\SplObject | cts\HttpClient\Exception\TransportExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
fi | {
"filepath": "src/Symfony/Component/HttpClient/Internal/HttplugWaitLoop.php",
"language": "php",
"file_size": 5519,
"cut_index": 716,
"middle_length": 229
} |
n Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Internal;
/**
* Internal representation of the native client's state.
*
* @author Alexander M. Turek <me@derr... |
public bool $sleep = false;
/** @var int[] */
public array $hosts = [];
public function __construct()
{
$this->id = random_int(\PHP_INT_MIN, \PHP_INT_MAX);
}
public function reset(): void
{
$this->response | ** @var string[] */
public array $dnsCache = []; | {
"filepath": "src/Symfony/Component/HttpClient/Internal/NativeClientState.php",
"language": "php",
"file_size": 966,
"cut_index": 582,
"middle_length": 52
} |
\HttpClient\Exception\TransportException;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\NativeHttpClient;
use Symfony\Component\HttpClient\Response\AsyncContext;
use Symfony\Component\HttpClient\Response\AsyncResponse;
use Symfony\Contracts\HttpClient\ChunkInterface;
use Symfony\Contract... | HttpClientInterface
{
if ('testHandleIsRemovedOnException' === $testCase) {
$this->markTestSkipped("AsyncDecoratorTrait doesn't cache handles");
}
if ('testTimeoutOnDestruct' === $testCase) {
return Htt | acts\HttpClient\ResponseInterface;
class AsyncDecoratorTraitTest extends NativeHttpClientTest
{
protected function getHttpClient(string $testCase, ?\Closure $chunkFilter = null, ?HttpClientInterface $decoratedClient = null): | {
"filepath": "src/Symfony/Component/HttpClient/Tests/AsyncDecoratorTraitTest.php",
"language": "php",
"file_size": 15050,
"cut_index": 921,
"middle_length": 229
} |
ent\CurlHttpClient;
use Symfony\Component\HttpClient\Exception\InvalidArgumentException;
#[RequiresPhpExtension('curl')]
#[Group('dns-sensitive')]
class CurlHttpClientTest extends HttpClientTestCase
{
protected function getHttpClient(string $testCase): CurlHttpClient
{
$usePersistentConnections = str_c... | arkTestSkipped('curl <7.61 is used or it is not compiled with support for HTTP/2 PUSH');
}
return new CurlHttpClient(['verify_peer' => false, 'verify_host' => false, 'extra' => ['use_persistent_connections' => $usePersistentConnections]], | tent_connections' => $usePersistentConnections]]);
}
if (!\defined('CURLMOPT_PUSHFUNCTION') || 0x073D00 > ($v = curl_version())['version_number'] || !(\CURL_VERSION_HTTP2 & $v['features'])) {
$this->m | {
"filepath": "src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php",
"language": "php",
"file_size": 12081,
"cut_index": 921,
"middle_length": 229
} |
Contracts\HttpClient\ResponseInterface as SymfonyResponseInterface;
/**
* A Guzzle handler that uses Symfony's HttpClientInterface as its transport.
*
* This lets SDKs tightly coupled to Guzzle benefit from Symfony HttpClient's
* features (e.g. retry logic, tracing, scoping, mocking) by plugging this
* handler in... | lMultiHandler takes with
* curl_multi_*. Waiting on any single promise drives the whole pool so
* concurrent requests benefit from parallelism automatically.
*
* Guzzle request options are mapped to their Symfony equivalents as faithfully
* as possibl | invoke() returns a *pending* Promise
* immediately without performing any I/O. The actual work is driven by
* Symfony's HttpClientInterface::stream(), which multiplexes all in-flight
* requests together - the same approach Cur | {
"filepath": "src/Symfony/Component/HttpClient/GuzzleHttpHandler.php",
"language": "php",
"file_size": 25497,
"cut_index": 1331,
"middle_length": 229
} |
HTTP method "%s", only uppercase letters are accepted.', $method));
}
if (!$method) {
throw new InvalidArgumentException('The HTTP method cannot be empty.');
}
}
$options = self::mergeDefaultOptions($options, $defaultOptions, $allowExtraOptions);
... | urn bool or stream resource, got "%s".', get_debug_type($buffer)));
}
if (false === strpbrk($bufferInfo['mode'], 'acew+')) {
throw new \LogicException(\sprintf('The stream returned by the clo | s_bool($buffer = $buffer($headers))) {
if (!\is_array($bufferInfo = @stream_get_meta_data($buffer))) {
throw new \LogicException(\sprintf('The closure passed as option "buffer" must ret | {
"filepath": "src/Symfony/Component/HttpClient/HttpClientTrait.php",
"language": "php",
"file_size": 35640,
"cut_index": 2151,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Component\HttpClient\Response\MockResponse;
use Symfony\Component\Ht... | ResetInterface
{
use HttpClientTrait;
private ResponseInterface|\Closure|iterable|null $responseFactory;
private int $requestsCount = 0;
private array $defaultOptions = [];
/**
* @param callable|callable[]|ResponseInterface|Respo | face;
use Symfony\Contracts\Service\ResetInterface;
/**
* A test-friendly HttpClient that doesn't make actual HTTP requests.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class MockHttpClient implements HttpClientInterface, | {
"filepath": "src/Symfony/Component/HttpClient/MockHttpClient.php",
"language": "php",
"file_size": 4244,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Component\HttpClient\Internal\FollowRedirectsTrait;
use Symfony\Component\HttpFoundation\IpUtils;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contra... | ClientTrait;
private array $defaultOptions = self::OPTIONS_DEFAULTS;
private HttpClientInterface $client;
private ?array $subnets;
private array $allowList;
private int $ipFlags;
private \ArrayObject $dnsCache;
/**
* @par | onboaventura@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
final class NoPrivateNetworkHttpClient implements HttpClientInterface, ResetInterface
{
use AsyncDecoratorTrait;
use FollowRedirectsTrait;
use Http | {
"filepath": "src/Symfony/Component/HttpClient/NoPrivateNetworkHttpClient.php",
"language": "php",
"file_size": 7105,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\Response\AsyncContext;
use Symfony\Component\HttpClient\Response\AsyncResponse;
use Symfony\Component\HttpClient\Retry\GenericRetryStrategy;
use Symfony\Component\HttpClient\Retry\Ret... | lient implements HttpClientInterface, ResetInterface
{
use AsyncDecoratorTrait;
private RetryStrategyInterface $strategy;
private array $baseUris = [];
/**
* @param int $maxRetries The maximum number of times to retry
*/
pub | ce;
use Symfony\Contracts\HttpClient\ResponseInterface;
use Symfony\Contracts\Service\ResetInterface;
/**
* Automatically retries failing HTTP requests.
*
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class RetryableHttpC | {
"filepath": "src/Symfony/Component/HttpClient/RetryableHttpClient.php",
"language": "php",
"file_size": 7391,
"cut_index": 716,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient;
use Symfony\Component\RateLimiter\LimiterInterface;
u... | ce $client,
private readonly LimiterInterface $rateLimiter,
) {
$this->client = $client;
}
public function request(string $method, string $url, array $options = []): ResponseInterface
{
$response = $this->client->re | hin a certain period.
*/
class ThrottlingHttpClient implements HttpClientInterface, ResetInterface
{
use DecoratorTrait {
reset as private traitReset;
}
public function __construct(
HttpClientInterfa | {
"filepath": "src/Symfony/Component/HttpClient/ThrottlingHttpClient.php",
"language": "php",
"file_size": 1348,
"cut_index": 524,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient;
use Symfony\Component\HttpClient\Response\ResponseStream;
use Symfony\Component\HttpClient\Response\TraceableResponse;
use Symfony\Component\St... | unction __construct(
private HttpClientInterface $client,
private ?Stopwatch $stopwatch = null,
private ?\Closure $disabled = null,
) {
$this->tracedRequests = new \ArrayObject();
}
public function request(strin | ny\Contracts\Service\ResetInterface;
/**
* @author Jérémy Romey <jeremy@free-agent.fr>
*/
final class TraceableHttpClient implements HttpClientInterface, ResetInterface
{
private \ArrayObject $tracedRequests;
public f | {
"filepath": "src/Symfony/Component/HttpClient/TraceableHttpClient.php",
"language": "php",
"file_size": 3203,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Chunk;
use Symfony\Component\HttpClient\Exception\TimeoutException;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\C... | essage = $error;
} else {
$this->error = $error;
$this->errorMessage = $error->getMessage();
}
}
public function isTimeout(): bool
{
$this->didThrow = true;
if (null !== $this->error) {
| ate string $errorMessage;
private ?\Throwable $error = null;
public function __construct(
private int $offset,
\Throwable|string $error,
) {
if (\is_string($error)) {
$this->errorM | {
"filepath": "src/Symfony/Component/HttpClient/Chunk/ErrorChunk.php",
"language": "php",
"file_size": 3082,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Chunk;
use Symfony\Component\HttpClient\Exception\JsonException;
use Symfony\Contracts\HttpClient\ChunkInterface;
/**
* @author Antoine Bluche... | ve BOM
if (str_starts_with($content, "\xEF\xBB\xBF")) {
$content = substr($content, 3);
}
foreach (preg_split("/(?:\r\n|[\r\n])/", $content) as $line) {
if (0 === $i = strpos($line, ':')) {
c | id = '';
private string $type = 'message';
private float $retry = 0;
private ?array $jsonData = null;
public function __construct(string $content)
{
parent::__construct(-1, $content);
// remo | {
"filepath": "src/Symfony/Component/HttpClient/Chunk/ServerSentEvent.php",
"language": "php",
"file_size": 3354,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient\Internal;
use Amp\ByteStream\ResourceStream;
use Amp\Cancellation;
use Amp\DeferredCancellation;
use Amp\DeferredFuture;
use Amp\Future;
use Amp\Http\Client\Connection\ConnectionLimitingPool;
use Amp\Http\Client\Connection\DefaultConnectionFactor... | rnetAddress;
use Amp\Socket\Socket;
use Amp\Socket\SocketAddress;
use Amp\Socket\SocketConnector;
use Psr\Log\LoggerInterface;
/**
* Internal representation of the Amp client's state.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final | e Amp\Http\Tunnel\Http1TunnelConnector;
use Amp\Http\Tunnel\Https1TunnelConnector;
use Amp\Socket\Certificate;
use Amp\Socket\ClientTlsContext;
use Amp\Socket\ConnectContext;
use Amp\Socket\DnsSocketConnector;
use Amp\Socket\Inte | {
"filepath": "src/Symfony/Component/HttpClient/Internal/AmpClientState.php",
"language": "php",
"file_size": 8234,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Internal;
use Symfony\Component\HttpClient\Response\AsyncContext;
use Symfony\Component\HttpClient\Response\AsyncResponse;
use Symfony\Contracts... | ost name found in $url
* @param \Closure(string $host, string $url, array &$options): void $onRedirect Called before each followed redirect
*/
private function followRedirects(string $method, string $url, string $host, array $options, \Closur | ectsTrait
{
/**
* @param string $url An already prepared, absolute URL
* @param string $host The h | {
"filepath": "src/Symfony/Component/HttpClient/Internal/FollowRedirectsTrait.php",
"language": "php",
"file_size": 4366,
"cut_index": 614,
"middle_length": 229
} |
e = $client->request('POST', 'http://example.com/foo-bar');
$this->assertSame('second response', $response->getContent(), 'Non-cacheable method must bypass caching.');
}
public function testItServesResponseFromCache()
{
$client = $this->buildClient([
new MockResponse('foo', [
... | );
sleep(2);
$response = $client->request('GET', 'http://example.com/foo-bar');
$this->assertSame(200, $response->getStatusCode());
$this->assertSame('foo', $response->getContent());
$this->assertSame('2', $respons | 'should not be served'),
]);
$response = $client->request('GET', 'http://example.com/foo-bar');
$this->assertSame(200, $response->getStatusCode());
$this->assertSame('foo', $response->getContent() | {
"filepath": "src/Symfony/Component/HttpClient/Tests/CachingHttpClientTest.php",
"language": "php",
"file_size": 99455,
"cut_index": 3790,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient;
use Amp\Http\Client\Request as AmpRequest;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* A factory to instantiate the best poss... | S_DEFAULTS for available options
*/
public static function create(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50): HttpClientInterface
{
if ($amp = class_exists(AmpRequest::class)) {
if | ram int $maxHostConnections The maximum number of connections to a single host
* @param int $maxPendingPushes The maximum number of pushed responses to accept in the queue
*
* @see HttpClientInterface::OPTION | {
"filepath": "src/Symfony/Component/HttpClient/HttpClient.php",
"language": "php",
"file_size": 3364,
"cut_index": 614,
"middle_length": 229
} |
ient\Exception\NetworkException;
use Http\Client\Exception\RequestException;
use Http\Client\HttpAsyncClient;
use Http\Discovery\Psr17Factory;
use Http\Discovery\Psr17FactoryDiscovery;
use Nyholm\Psr7\Factory\Psr17Factory as NyholmPsr17Factory;
use Nyholm\Psr7\Request;
use Nyholm\Psr7\Uri;
use Psr\Http\Client\ClientInt... | p;
use Symfony\Component\HttpClient\Response\HttplugPromise;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
use Symfony\Contr | seInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriFactoryInterface;
use Psr\Http\Message\UriInterface;
use Symfony\Component\HttpClient\Internal\HttplugWaitLoo | {
"filepath": "src/Symfony/Component/HttpClient/HttplugClient.php",
"language": "php",
"file_size": 10891,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient;
use Http\Discovery\Psr17Factory;
use Http\Discovery\Psr17FactoryDiscovery;
use Nyholm\Psr7\Factory\Psr17Factory as NyholmPsr17Factory;
use Nyholm\Psr7\Request;
use Nyholm\Psr7\Uri;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Client\Network... | HttpClient\Internal\HttplugWaitLoop;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\Service\ResetInterface;
if (!interface_exists(ClientInterface::class)) | rface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriFactoryInterface;
use Psr\Http\Message\UriInterface;
use Symfony\Component\ | {
"filepath": "src/Symfony/Component/HttpClient/Psr18Client.php",
"language": "php",
"file_size": 8956,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient;
use Symfony\Component\HttpClient\Exception\InvalidArgumentException;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contract... | ttpClientInterface $client,
private array $defaultOptionsByRegexp,
private ?string $defaultRegexp = null,
) {
if (null !== $defaultRegexp && !isset($defaultOptionsByRegexp[$defaultRegexp])) {
throw new InvalidArgumen | requested URL.
*
* @author Anthony Martin <anthony.martin@sensiolabs.com>
*/
class ScopingHttpClient implements HttpClientInterface, ResetInterface
{
use HttpClientTrait;
public function __construct(
private H | {
"filepath": "src/Symfony/Component/HttpClient/ScopingHttpClient.php",
"language": "php",
"file_size": 3735,
"cut_index": 614,
"middle_length": 229
} |
hp
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Chunk;
use Symfony\Contracts\HttpClient\Chunk... | {
return false;
}
public function getInformationalStatus(): ?array
{
return null;
}
public function getContent(): string
{
return $this->content;
}
public function getOffset(): int
{
| private string $content = '',
) {
}
public function isTimeout(): bool
{
return false;
}
public function isFirst(): bool
{
return false;
}
public function isLast(): bool
| {
"filepath": "src/Symfony/Component/HttpClient/Chunk/DataChunk.php",
"language": "php",
"file_size": 1105,
"cut_index": 515,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Tests;
use PHPUnit\Framework\Attributes\Group;
use Symfony\Componen... | otected function getHttpClient(string $testCase): HttpClientInterface
{
return new AmpHttpClient(['verify_peer' => false, 'verify_host' => false, 'timeout' => 30]);
}
public function testProxy()
{
$this->markTestSkipped('A | public function testNonBlockingStream()
{
parent::testNonBlockingStream();
}
/**
* @group transient-on-windows
*/
public function testResolve()
{
parent::testResolve();
}
pr | {
"filepath": "src/Symfony/Component/HttpClient/Tests/AmpHttpClientTest.php",
"language": "php",
"file_size": 1747,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\Respo... | $client ?? HttpClient::create();
}
public function request(string $method, string $url, array $options = []): ResponseInterface
{
$vars = $this->defaultVars;
if (\array_key_exists('vars', $options)) {
if (!\is_arra | re(string $url, array $vars): string)|null $expander
*/
public function __construct(?HttpClientInterface $client = null, private ?\Closure $expander = null, private array $defaultVars = [])
{
$this->client = | {
"filepath": "src/Symfony/Component/HttpClient/UriTemplateHttpClient.php",
"language": "php",
"file_size": 2749,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient\Internal;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpClient\Response\CurlResponse;
/**
* Internal representation of the cURL client's state.
*
* @author Alexander M. Turek <me@derrabus.de>
*
* @internal
*/
final class CurlClien... | INT_MIN;
public ?LoggerInterface $logger = null;
/** @var array<string, true> Indexed by self::originKey() */
public array $ntlmRequiresFreshConnection = [];
public static array $curlVersion;
public function __construct(
priv | bool $performing = false;
/** @var PushedResponse[] */
public array $pushedResponses = [];
public DnsCache $dnsCache;
/** @var float[] */
public array $pauseExpiries = [];
public int $execCounter = \PHP_ | {
"filepath": "src/Symfony/Component/HttpClient/Internal/CurlClientState.php",
"language": "php",
"file_size": 7228,
"cut_index": 716,
"middle_length": 229
} |
Symfony\Contracts\Service\ResetInterface;
/**
* A portable implementation of the HttpClientInterface contracts based on PHP stream wrappers.
*
* PHP stream wrappers are able to fetch response bodies concurrently,
* but each request is opened synchronously.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
final cl... |
private NativeClientState $multi;
/**
* @param array $defaultOptions Default request's options
* @param int $maxHostConnections The maximum number of connections to open
*
* @see HttpClientInterface::OPTIONS_DEFAULTS for | terface::OPTIONS_DEFAULTS + [
'crypto_method' => \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
];
private array $defaultOptions = self::OPTIONS_DEFAULTS;
private static array $emptyDefaults = self::OPTIONS_DEFAULTS;
| {
"filepath": "src/Symfony/Component/HttpClient/NativeHttpClient.php",
"language": "php",
"file_size": 21682,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient\DataCollector;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Component\HttpClient\HttpClientTrait;
use Symfony\Component\HttpClient\TraceableHttpClient;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Compon... | ientTrait;
/**
* @var TraceableHttpClient[]
*/
private array $clients = [];
public function registerClient(string $name, TraceableHttpClient $client): void
{
$this->clients[$name] = $client;
}
public function co | ess\Process;
use Symfony\Component\VarDumper\Caster\ImgStub;
/**
* @author Jérémy Romey <jeremy@free-agent.fr>
*/
final class HttpClientDataCollector extends DataCollector implements LateDataCollectorInterface
{
use HttpCl | {
"filepath": "src/Symfony/Component/HttpClient/DataCollector/HttpClientDataCollector.php",
"language": "php",
"file_size": 8633,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient\Tests;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpClient\DnsResolvingHttpClient;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Response\MockResponse;
us... | );
$client = new DnsResolvingHttpClient($mockClient, static function (string $host) use (&$resolvedHosts): ?string {
$resolvedHosts[] = $host;
return '1.2.3.4';
});
$response = $client->request('GET', 'http | $mockClient = new MockHttpClient(function (string $method, string $url, array $options) {
$this->assertSame('1.2.3.4', $options['resolve']['example.com'] ?? null);
return new MockResponse('OK');
} | {
"filepath": "src/Symfony/Component/HttpClient/Tests/DnsResolvingHttpClientTest.php",
"language": "php",
"file_size": 6010,
"cut_index": 716,
"middle_length": 229
} |
hp
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Runner;
use Symfony\Component\Runtime\RunnerInte... | s_int($exitStatus)) {
$r = new \ReflectionFunction($this->closure);
throw new \TypeError(\sprintf('Unexpected value of type "%s" returned, "string|int|null" expected from "%s" on line "%d".', get_debug_type($exitStatus), $r->getFil | }
public function run(): int
{
$exitStatus = ($this->closure)();
if (\is_string($exitStatus)) {
echo $exitStatus;
return 0;
}
if (null !== $exitStatus && !\i | {
"filepath": "src/Symfony/Component/Runtime/Runner/ClosureRunner.php",
"language": "php",
"file_size": 1083,
"cut_index": 515,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Runner;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInt... | classes
* keeping non-resettable state should override __clone accordingly.
*
* "APP_RUNTIME_MODE" is set to "web=1&worker=1", or "web=1&worker=2" when FRANKENPHP_RESET_KERNEL
* is active.
*
* @author Kévin Dunglas <kevin@dunglas.dev>
*/
class Frank | ass 0 or a negative integer to loop indefinitely.
*
* When the application is an HttpKernelInterface and "FRANKENPHP_RESET_KERNEL" is truthy,
* the kernel is cloned after each request to mitigate cross-request state leaks; sub | {
"filepath": "src/Symfony/Component/Runtime/Runner/FrankenPhpWorkerRunner.php",
"language": "php",
"file_size": 3101,
"cut_index": 614,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Runner\Symfony;
use Symfony\Component\Console\Application;
use Symfony... | efaultEnv,
private readonly InputInterface $input,
private readonly ?OutputInterface $output = null,
) {
}
public function run(): int
{
if (null === $this->defaultEnv) {
return $this->application->run($t | /**
* @author Nicolas Grekas <p@tchwork.com>
*/
class ConsoleApplicationRunner implements RunnerInterface
{
public function __construct(
private readonly Application $application,
private readonly ?string $d | {
"filepath": "src/Symfony/Component/Runtime/Runner/Symfony/ConsoleApplicationRunner.php",
"language": "php",
"file_size": 1650,
"cut_index": 537,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Runner\Symfony;
use Symfony\Component\HttpFoundation\Requ... | Request $request,
private readonly bool $debug = false,
) {
}
public function run(): int
{
$response = $this->kernel->handle($this->request);
$response->send(false);
if (\function_exists('fastcgi_finish_r | nnerInterface;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class HttpKernelRunner implements RunnerInterface
{
public function __construct(
private readonly HttpKernelInterface $kernel,
private readonly | {
"filepath": "src/Symfony/Component/Runtime/Runner/Symfony/HttpKernelRunner.php",
"language": "php",
"file_size": 1461,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector;
use Symfony\Component\CssSelector\Parser\Shortcut\ClassParser;
use Symfony\Component\CssSel... | or Christophe Coevoet <stof@notk.org>
*/
class CssSelectorConverter
{
public static int $maxCachedItems = 1024;
private Translator $translator;
private array $cache;
private static array $xmlCache = [];
private static array $htmlCach | sSelector\XPath\Extension\HtmlExtension;
use Symfony\Component\CssSelector\XPath\Translator;
/**
* CssSelectorConverter is the main entry point of the component and can convert CSS
* selectors to XPath expressions.
*
* @auth | {
"filepath": "src/Symfony/Component/CssSelector/CssSelectorConverter.php",
"language": "php",
"file_size": 2633,
"cut_index": 563,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Exception;
use Symfony\Component\CssSelector\Parser\Token;
/**
*... | elf
{
return new self(\sprintf('Expected %s, but %s found.', $expectedValue, $foundToken));
}
public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation): self
{
return new self(\sprintf('Un | rapy/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*/
class SyntaxErrorException extends ParseException
{
public static function unexpectedToken(string $expectedValue, Token $foundToken): s | {
"filepath": "src/Symfony/Component/CssSelector/Exception/SyntaxErrorException.php",
"language": "php",
"file_size": 1852,
"cut_index": 537,
"middle_length": 229
} |
rException;
use Symfony\Component\CssSelector\Node;
use Symfony\Component\CssSelector\Parser\Tokenizer\Tokenizer;
/**
* CSS selector parser.
*
* This component is a port of the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/scrapy/cssselect.
*
* @author Jean-François Simon <j... | Reader($source);
$stream = $this->tokenizer->tokenize($reader);
return $this->parseSelectorList($stream);
}
/**
* Parses the arguments for ":nth-child()" and friends.
*
* @param Token[] $tokens
*
* @throw | sNestingDepth = 0;
public function __construct(?Tokenizer $tokenizer = null)
{
$this->tokenizer = $tokenizer ?? new Tokenizer();
}
public function parse(string $source): array
{
$reader = new | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Parser.php",
"language": "php",
"file_size": 16050,
"cut_index": 921,
"middle_length": 229
} |
s part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser;
use Symfony\Component\CssSelector\Node\SelectorNode;
/**... | s Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
interface ParserInterface
{
/**
* Parses given selector source into an array of tokens.
*
* @return SelectorNode[]
*/
public function parse(string $source): array;
| r Jean-Françoi | {
"filepath": "src/Symfony/Component/CssSelector/Parser/ParserInterface.php",
"language": "php",
"file_size": 809,
"cut_index": 536,
"middle_length": 14
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser;
/**
* CSS selector reader.
*
* This component is a port... | EOF(): bool
{
return $this->position >= $this->length;
}
public function getPosition(): int
{
return $this->position;
}
public function getRemainingLength(): int
{
return $this->length - $this->position | internal
*/
class Reader
{
private int $length;
private int $position = 0;
public function __construct(
private string $source,
) {
$this->length = \strlen($source);
}
public function is | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Reader.php",
"language": "php",
"file_size": 1848,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser;
/**
* CSS selector token.
*
* This component is a port of the Python cssselect li... | lic const TYPE_NUMBER = 'number';
public const TYPE_STRING = 'string';
/**
* @param self::TYPE_*|null $type
*/
public function __construct(
private ?string $type,
private ?string $value,
private ?int $position | public const TYPE_FILE_END = 'eof';
public const TYPE_DELIMITER = 'delimiter';
public const TYPE_WHITESPACE = 'whitespace';
public const TYPE_IDENTIFIER = 'identifier';
public const TYPE_HASH = 'hash';
pub | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Token.php",
"language": "php",
"file_size": 2507,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser;
use Symfony\Component\CssSelector\Exception\InternalErrorException;
use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
... | ];
private int $cursor = 0;
private ?Token $peeked;
private bool $peeking = false;
/**
* Pushes a token.
*
* @return $this
*/
public function push(Token $token): static
{
$this->tokens[] = $token;
| Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class TokenStream
{
/**
* @var Token[]
*/
private array $tokens = [];
/**
* @var Token[]
*/
private array $used = [ | {
"filepath": "src/Symfony/Component/CssSelector/Parser/TokenStream.php",
"language": "php",
"file_size": 3316,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Tokenizer;
use Symfony\Component\CssSelector\Parser\Handler;
use Symfony\Component\Cs... | * @var Handler\HandlerInterface[]
*/
private array $handlers;
public function __construct()
{
$patterns = new TokenizerPatterns();
$escaping = new TokenizerEscaping($patterns);
$this->handlers = [
| the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class Tokenizer
{
/**
| {
"filepath": "src/Symfony/Component/CssSelector/Parser/Tokenizer/Tokenizer.php",
"language": "php",
"file_size": 2040,
"cut_index": 563,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Tokenizer;
/**
* CSS selector tokenizer escaping applier.
... | $value = $this->replaceUnicodeSequences($value);
return preg_replace($this->patterns->getSimpleEscapePattern(), '$1', $value);
}
public function escapeUnicodeAndNewLine(string $value): string
{
$value = preg_replace($this- | .simon@sensiolabs.com>
*
* @internal
*/
class TokenizerEscaping
{
public function __construct(
private TokenizerPatterns $patterns,
) {
}
public function escapeUnicode(string $value): string
{
| {
"filepath": "src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerEscaping.php",
"language": "php",
"file_size": 1741,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Tokenizer;
/**
* CSS selector tokenizer patterns builder.
*
* This component is a ... | EscapePattern;
private string $nonAsciiPattern;
private string $nmCharPattern;
private string $nmStartPattern;
private string $identifierPattern;
private string $hashPattern;
private string $numberPattern;
private string $quoted | * @internal
*/
class TokenizerPatterns
{
private string $unicodeEscapePattern;
private string $simpleEscapePattern;
private string $newLineEscapePattern;
private string $escapePattern;
private string $string | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerPatterns.php",
"language": "php",
"file_size": 2863,
"cut_index": 563,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Shortcut;
use Symfony\Component\CssSelector\Node\ClassNode;... | >
*
* @internal
*/
class ClassParser implements ParserInterface
{
public function parse(string $source): array
{
// Matches an optional namespace, optional element, and required class
// $source = 'test|input.ab6bd_field';
| arser shortcut.
*
* This component is a port of the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Shortcut/ClassParser.php",
"language": "php",
"file_size": 1559,
"cut_index": 537,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Shortcut;
use Symfony\Component\CssSelector\No... | Parser implements ParserInterface
{
public function parse(string $source): array
{
// Matches an optional namespace, required element or `*`
// $source = 'testns|testel';
// $matches = array (size=3)
// 0 => stri | t is a port of the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class Element | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Shortcut/ElementParser.php",
"language": "php",
"file_size": 1351,
"cut_index": 524,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Shortcut;
use Symfony\Component\CssSelec... | which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class EmptyStringParser implements ParserInterface
{
public function parse(string $s | tcut ensure compatibility with previous version.
* - The parser fails to parse an empty string.
* - In the previous version, an empty string matches each tags.
*
* This component is a port of the Python cssselect library,
* | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Shortcut/EmptyStringParser.php",
"language": "php",
"file_size": 1193,
"cut_index": 518,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Shortcut;
use Symfony\Component\CssSelector\Node\ElementNod... | *
* @internal
*/
class HashParser implements ParserInterface
{
public function parse(string $source): array
{
// Matches an optional namespace, optional element, and required id
// $source = 'test|input#ab6bd_field';
// $ | ser shortcut.
*
* This component is a port of the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
| {
"filepath": "src/Symfony/Component/CssSelector/Parser/Shortcut/HashParser.php",
"language": "php",
"file_size": 1551,
"cut_index": 537,
"middle_length": 229
} |
hp
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Handler;
use Symfony\Component\CssSel... | ndle(Reader $reader, TokenStream $stream): bool
{
if ('/*' !== $reader->getSubstring(2)) {
return false;
}
$offset = $reader->getOffset('*/');
if (false === $offset) {
$reader->moveToEnd();
| yright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class CommentHandler implements HandlerInterface
{
public function ha | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Handler/CommentHandler.php",
"language": "php",
"file_size": 1101,
"cut_index": 515,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Handler;
use Symfony\Component\CssSelector\Par... | apin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class HashHandler implements HandlerInterface
{
public function __construct(
private TokenizerPatterns $patterns,
private Tokenize | tterns;
use Symfony\Component\CssSelector\Parser\TokenStream;
/**
* CSS selector comment handler.
*
* This component is a port of the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonS | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Handler/HashHandler.php",
"language": "php",
"file_size": 1481,
"cut_index": 524,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Handler;
use Symfony\Component\CssSelector\Par... | apin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class IdentifierHandler implements HandlerInterface
{
public function __construct(
private TokenizerPatterns $patterns,
private To | tterns;
use Symfony\Component\CssSelector\Parser\TokenStream;
/**
* CSS selector comment handler.
*
* This component is a port of the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonS | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Handler/IdentifierHandler.php",
"language": "php",
"file_size": 1499,
"cut_index": 524,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Handler;
use Symfony\Component\CssSelector\Par... | sensiolabs.com>
*
* @internal
*/
class NumberHandler implements HandlerInterface
{
public function __construct(
private TokenizerPatterns $patterns,
) {
}
public function handle(Reader $reader, TokenStream $stream): bool
{
| CSS selector comment handler.
*
* This component is a port of the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@ | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Handler/NumberHandler.php",
"language": "php",
"file_size": 1315,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Handler;
use Symfony\Component\CssSelector\Exception\InternalErrorException;
use Symf... | the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class StringHandler implements HandlerInterface
{
p | ser\Tokenizer\TokenizerEscaping;
use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
use Symfony\Component\CssSelector\Parser\TokenStream;
/**
* CSS selector comment handler.
*
* This component is a port of | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Handler/StringHandler.php",
"language": "php",
"file_size": 2323,
"cut_index": 563,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Parser\Handler;
use Symfony\Component\CssSelect... | mplements HandlerInterface
{
public function handle(Reader $reader, TokenStream $stream): bool
{
$match = $reader->findPattern('~^[ \t\r\n\f]+~');
if (false === $match) {
return false;
}
$stream->push(n | of the Python cssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class WhitespaceHandler i | {
"filepath": "src/Symfony/Component/CssSelector/Parser/Handler/WhitespaceHandler.php",
"language": "php",
"file_size": 1154,
"cut_index": 518,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\CssSelector\XPath;
use Symfony\Component\CssSelector\Exception\ExpressionErrorException;
use Symfony\Component\CssSelector\Node\FunctionNode;
use Symfony\Component\CssSelector\Node\NodeInterface;
use Symfony\Component\CssSelector\Node\SelectorNode;
use Symf... | terface
{
private ParserInterface $mainParser;
/**
* @var ParserInterface[]
*/
private array $shortcutParsers = [];
/**
* @var Extension\ExtensionInterface[]
*/
private array $extensions = [];
private array $n | ssselect library,
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
class Translator implements TranslatorIn | {
"filepath": "src/Symfony/Component/CssSelector/XPath/Translator.php",
"language": "php",
"file_size": 8051,
"cut_index": 716,
"middle_length": 229
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\XPath;
use Symfony\Component\CssSelector\... | tion cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string;
/**
* Translates a parsed selector node to an XPath expression.
*/
public function selectorToXPath(SelectorNode $selector, string $prefix = 'descendant-or | onSapin/cssselect.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*
* @internal
*/
interface TranslatorInterface
{
/**
* Translates a CSS selector to an XPath expression.
*/
public func | {
"filepath": "src/Symfony/Component/CssSelector/XPath/TranslatorInterface.php",
"language": "php",
"file_size": 1019,
"cut_index": 512,
"middle_length": 229
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation... | ' : 'KO request runtime', "\n";
return new StreamedResponse(static function () use ($context) {
echo 'OK Request '.$context['SOME_VAR'], "\n";
echo class_exists(ResponseRuntime::class, false) ? 'KO response runtime' : 'OK response runt | nseRuntime;
$_SERVER['APP_RUNTIME'] = GenericRuntime::class;
require __DIR__.'/autoload.php';
return static function (Request $request, array $context) {
echo class_exists(RequestRuntime::class, false) ? 'OK request runtime | {
"filepath": "src/Symfony/Component/Runtime/Tests/phpt/generic-request.php",
"language": "php",
"file_size": 1020,
"cut_index": 512,
"middle_length": 229
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Ht... | ublic function __construct(string $env, string $var)
{
$this->env = $env;
$this->var = $var;
}
public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = true): Response
{
return new Response('OK | private string $env;
private string $var;
p | {
"filepath": "src/Symfony/Component/Runtime/Tests/phpt/kernel.php",
"language": "php",
"file_size": 907,
"cut_index": 547,
"middle_length": 52
} |
ovides a single extension point to process a response's content stream.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class AsyncResponse implements ResponseInterface, StreamableInterface
{
use CommonResponseTrait;
private const FIRST_CHUNK_YIELDED = 1;
private const LAST_CHUNK_YIELDED = 2;
private... | entInterface $client, string $method, string $url, array $options, ?callable $passthru = null)
{
$this->client = $client;
$this->shouldBuffer = $options['buffer'] ?? true;
if (null !== $onProgress = $options['on_progress'] ?? n | ator $stream = null;
private ?int $yieldedState = null;
private bool $hasThrown = false;
/**
* @param ?callable(ChunkInterface, AsyncContext): ?\Iterator $passthru
*/
public function __construct(HttpCli | {
"filepath": "src/Symfony/Component/HttpClient/Response/AsyncResponse.php",
"language": "php",
"file_size": 17645,
"cut_index": 1331,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Response;
use GuzzleHttp\Promise\Create;
use GuzzleHttp\Promise\Pro... | ?callable $onFulfilled = null, ?callable $onRejected = null): self
{
return new self($this->promise->then(
$this->wrapThenCallback($onFulfilled),
$this->wrapThenCallback($onRejected)
));
}
public functio | bias.nyholm@gmail.com>
*
* @internal
*/
final class HttplugPromise implements HttplugPromiseInterface
{
public function __construct(
private GuzzlePromiseInterface $promise,
) {
}
public function then( | {
"filepath": "src/Symfony/Component/HttpClient/Response/HttplugPromise.php",
"language": "php",
"file_size": 1768,
"cut_index": 537,
"middle_length": 229
} |
nt\HttpClient\Exception\InvalidArgumentException;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Component\HttpClient\Internal\ClientState;
use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* A test-friendly response.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class MockRespons... | se body as a string or an iterable of strings,
* yielding an empty string simulates an idle timeout,
* throwing or yielding an exception yields an Err | [];
private string $requestUrl;
private string $requestMethod;
private static ClientState $mainMulti;
private static int $idSequence = 0;
/**
* @param string|iterable<string|\Throwable> $body The respon | {
"filepath": "src/Symfony/Component/HttpClient/Response/MockResponse.php",
"language": "php",
"file_size": 12331,
"cut_index": 921,
"middle_length": 229
} |
n\TransportException;
use Symfony\Component\HttpClient\Internal\Canary;
use Symfony\Component\HttpClient\Internal\ClientState;
use Symfony\Component\HttpClient\Internal\NativeClientState;
use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class N... | ction __construct(
private NativeClientState $multi,
private $context,
private string $url,
array $options,
array &$info,
callable $resolver,
?callable $onProgress,
?LoggerInterface $logger,
| s;
private ?int $remaining = null;
/**
* @var resource|null
*/
private $buffer;
private float $pauseExpiry = 0.0;
/**
* @internal
*
* @param $context resource
*/
public fun | {
"filepath": "src/Symfony/Component/HttpClient/Response/NativeResponse.php",
"language": "php",
"file_size": 13772,
"cut_index": 921,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Response;
use Symfony\Contracts\HttpClient\Excep... | *
* @throws TransportExceptionInterface When a network error occurs
* @throws RedirectionExceptionInterface On a 3xx when $throw is true and the "max_redirects" option has been reached
* @throws ClientExceptionInterface On a 4xx w | cts\HttpClient\Exception\TransportExceptionInterface;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
interface StreamableInterface
{
/**
* Casts the response to a PHP stream resource.
*
* @return resource
| {
"filepath": "src/Symfony/Component/HttpClient/Response/StreamableInterface.php",
"language": "php",
"file_size": 1156,
"cut_index": 518,
"middle_length": 229
} |
orChunk;
use Symfony\Component\HttpClient\Chunk\FirstChunk;
use Symfony\Component\HttpClient\Chunk\LastChunk;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Component\HttpClient\Internal\Canary;
use Symfony\Component\HttpClient\Internal\ClientState;
/**
* Implements common logic for transp... | rivate $handle;
private int|string $id;
private ?float $timeout = 0;
private \InflateContext|bool|null $inflate = null;
private ?array $finalInfo = null;
private ?LoggerInterface $logger = null;
private bool $didTimeout = false;
| */
private array $headers = [];
private array $info = [
'response_headers' => [],
'http_code' => 0,
'error' => null,
'canceled' => false,
];
/** @var object|resource|null */
p | {
"filepath": "src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php",
"language": "php",
"file_size": 11855,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Runtime;
use Symfony\Component\Runtime\Internal\BasicErrorHandler;
use Symfony\Component\Runtime\Resolver\ClosureResolver;
use Symfony\Component\Runtime\Resolver\DebugClosureResolver;
use Symfony\Component\Runtime\Runner\ClosureRunner;
// Help opcache.prel... | the class to use to handle PHP errors;
* - "env_var_name" and "debug_var_name" define the name of the env
* vars that hold the Symfony env and the debug flag respectively.
*
* The app-callable can declare arguments among either:
* - "array $conte | g" toggles displaying errors and defaults
* to the "APP_DEBUG" environment variable;
* - "runtimes" maps types to a GenericRuntime implementation
* that knows how to deal with each of them;
* - "error_handler" defines | {
"filepath": "src/Symfony/Component/Runtime/GenericRuntime.php",
"language": "php",
"file_size": 7869,
"cut_index": 716,
"middle_length": 229
} |
ut;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\RawInputInterface;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Componen... | unner\Symfony\ResponseRunner;
// Help opcache.preload discover always-needed symbols
class_exists(MissingDotenv::class, false) || class_exists(Dotenv::class) || class_exists(MissingDotenv::class);
/**
* Knows the basic conventions to run Symfony apps.
| r;
use Symfony\Component\Runtime\Runner\FrankenPhpWorkerRunner;
use Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner;
use Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner;
use Symfony\Component\Runtime\R | {
"filepath": "src/Symfony/Component/Runtime/SymfonyRuntime.php",
"language": "php",
"file_size": 13136,
"cut_index": 921,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Internal;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @interna... | ors only if they're not already logged to STDERR
ini_set('display_errors', 1);
}
if (0 <= \ini_get('zend.assertions')) {
ini_set('zend.assertions', (int) $debug);
}
ini_set('assert.active', 1);
| P_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
ini_set('display_errors', $debug);
} elseif (!filter_var(\ini_get('log_errors'), \FILTER_VALIDATE_BOOL) || \ini_get('error_log')) {
// CLI - display err | {
"filepath": "src/Symfony/Component/Runtime/Internal/BasicErrorHandler.php",
"language": "php",
"file_size": 1547,
"cut_index": 537,
"middle_length": 229
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Resolver;
/**
* @author Nicolas Grekas <p@tc... | ($closure);
throw new \TypeError(\sprintf('Unexpected value of type "%s" returned, "object" expected from "%s" on line "%d".', get_debug_type($app), $r->getFileName(), $r->getStartLine()));
},
$arguments,
]; | static function (...$arguments) use ($closure) {
if (\is_object($app = $closure(...$arguments)) || null === $app) {
return $app;
}
$r = new \ReflectionFunction | {
"filepath": "src/Symfony/Component/Runtime/Resolver/DebugClosureResolver.php",
"language": "php",
"file_size": 1006,
"cut_index": 512,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Runtime\Tests;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\RawInputInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Sy... | Runtime();
try {
$this->assertNotInstanceOf(FrankenPhpWorkerRunner::class, $runtime->getRunner(null));
$this->assertNotInstanceOf(FrankenPhpWorkerRunner::class, $runtime->getRunner($application));
$_SERVER['FRAN | unset($_SERVER['FRANKENPHP_WORKER'], $_SERVER['FRANKENPHP_LOOP_MAX']);
}
public function testGetRunner()
{
$application = $this->createStub(HttpKernelInterface::class);
$runtime = new Symfony | {
"filepath": "src/Symfony/Component/Runtime/Tests/SymfonyRuntimeTest.php",
"language": "php",
"file_size": 6993,
"cut_index": 716,
"middle_length": 229
} |
ackage.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\Inp... | utInterface $output) use ($context): int {
$output->write('OK Application '.$context['SOME_VAR']);
return 0;
});
$app = new Application();
$app->addCommand($command);
$app->setDefaultCommand('go', true);
return $app;
| setCode(static function (InputInterface $input, Outp | {
"filepath": "src/Symfony/Component/Runtime/Tests/phpt/application.php",
"language": "php",
"file_size": 870,
"cut_index": 559,
"middle_length": 52
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Compon... | dOption('hello', 'e', InputOption::VALUE_REQUIRED, 'How should I greet?', 'OK');
return $command->setCode(static function () use ($input, $output, $context): int {
$output->write($input->getOption('hello').' Command '.$context['SOME_VAR']);
| nterface $output, array $context) {
$command->ad | {
"filepath": "src/Symfony/Component/Runtime/Tests/phpt/command.php",
"language": "php",
"file_size": 883,
"cut_index": 547,
"middle_length": 52
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use ... | ame('Hello console');
$command->setDescription('Hello description ');
$command->setName('my_command');
[$cmd, $args] = $runtime->getResolver(require __DIR__.'/command.php')->resolve();
$app->addCommand($cmd(...$args));
return $app;
} | $app->setN | {
"filepath": "src/Symfony/Component/Runtime/Tests/phpt/command_list.php",
"language": "php",
"file_size": 796,
"cut_index": 524,
"middle_length": 14
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Response;
use Symfony\Component\HttpClient\Exception\ClientException;
use Symfony\Component\HttpClient\Exception\JsonException;
use Symfony\Comp... | */
private $initializer;
/** @var bool|\Closure|resource|null */
private $shouldBuffer;
/** @var resource|null */
private $content;
private int $offset = 0;
private ?array $jsonData = null;
public function getContent(bool | ommon logic for response classes.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
trait CommonResponseTrait
{
/**
* @var callable|null A callback that tells whether we're waiting for response headers
| {
"filepath": "src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php",
"language": "php",
"file_size": 4900,
"cut_index": 614,
"middle_length": 229
} |
terface, StreamableInterface
{
use CommonResponseTrait {
getContent as private doGetContent;
}
use TransportResponseTrait;
/**
* @var resource
*/
private $debugBuffer;
/**
* @internal
*/
public function __construct(
private CurlClientState $multi,
... | temp', 'w+');
if (0x074000 === $curlVersion) {
fwrite($this->debugBuffer, 'Due to a bug in curl 7.64.0, the debug log is disabled; use another version to work around the issue.');
} else {
curl_setopt | Version = null,
?string $originalUrl = null,
private ?string $ntlmOriginKey = null,
) {
if ($ch instanceof \CurlHandle) {
$this->handle = $ch;
$this->debugBuffer = fopen('php:// | {
"filepath": "src/Symfony/Component/HttpClient/Response/CurlResponse.php",
"language": "php",
"file_size": 21518,
"cut_index": 1331,
"middle_length": 229
} |
hp
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Response;
use Symfony\Contracts\HttpClient\Ch... | }
public function current(): ChunkInterface
{
return $this->generator->current();
}
public function next(): void
{
$this->generator->next();
}
public function rewind(): void
{
$this->generator->rew | nseStream implements ResponseStreamInterface
{
public function __construct(
private \Generator $generator,
) {
}
public function key(): ResponseInterface
{
return $this->generator->key();
| {
"filepath": "src/Symfony/Component/HttpClient/Response/ResponseStream.php",
"language": "php",
"file_size": 1104,
"cut_index": 515,
"middle_length": 229
} |
Symfony\Contracts\HttpClient\ResponseInterface;
/**
* Allows turning ResponseInterface instances to PHP streams.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class StreamWrapper
{
/** @var resource|null */
public $context;
private HttpClientInterface|ResponseInterface $client;
private ResponseIn... | urce(ResponseInterface $response, ?HttpClientInterface $client = null)
{
if ($response instanceof StreamableInterface) {
$stack = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 2);
if ($ | at $timeout = null;
private bool $eof = false;
private ?int $offset = 0;
/**
* Creates a PHP stream resource from a ResponseInterface.
*
* @return resource
*/
public static function createReso | {
"filepath": "src/Symfony/Component/HttpClient/Response/StreamWrapper.php",
"language": "php",
"file_size": 9363,
"cut_index": 921,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\DependencyInjection;
use Symfony\Component\DependencyInjection\Comp... | nition('data_collector.http_client')) {
return;
}
foreach ($container->findTaggedServiceIds('http_client.client') as $id => $tags) {
$container->register('.debug.'.$id, TraceableHttpClient::class)
-> | Reference;
use Symfony\Component\HttpClient\TraceableHttpClient;
final class HttpClientPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefi | {
"filepath": "src/Symfony/Component/HttpClient/DependencyInjection/HttpClientPass.php",
"language": "php",
"file_size": 1540,
"cut_index": 537,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Internal;
use Symfony\Component\ErrorHandler\BufferingLogger;
use Symf... | RECATED & ~\E_USER_DEPRECATED);
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
ini_set('display_errors', $debug);
} elseif (!filter_var(\ini_get('log_errors'), \FILTER_VALIDATE_BOOL) || \ini_get('error_log')) {
| public static function register(bool $debug): void
{
if (!class_exists(ErrorHandler::class)) {
BasicErrorHandler::register($debug);
return;
}
error_reporting(\E_ALL & ~\E_DEP | {
"filepath": "src/Symfony/Component/Runtime/Internal/SymfonyErrorHandler.php",
"language": "php",
"file_size": 1508,
"cut_index": 537,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\Runtime\SymfonyRuntime;
$_SERVER['APP_RUNTIME_OPTIONS'] ??= [];
$... | RUNTIME'] ?? SymfonyRuntime::class;
$runtime = new $runtime($_SERVER['APP_RUNTIME_OPTIONS']);
[$app, $args] = $runtime->getResolver($app)->resolve();
exit($runtime->getRunner($app(...$args))->run());
}
if (!file_exists(dirname(__DIR__, 6).'/ve | oad.php')) {
if (true === (require_once dirname(__DIR__, 2).'/vendor/autoload.php') || empty($_SERVER['SCRIPT_FILENAME'])) {
return;
}
$app = require $_SERVER['SCRIPT_FILENAME'];
$runtime = $_SERVER['APP_ | {
"filepath": "src/Symfony/Component/Runtime/Tests/phpt/autoload.php",
"language": "php",
"file_size": 1152,
"cut_index": 518,
"middle_length": 229
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Runtime\Runner... | echo "\n";
$kernel->handle(new Request())->send();
echo "\n";
return 0;
});
}
};
[$app, $args] = $runtime->getResolver(require __DIR__.'/kernel.php')->resolve();
echo $runtime->getRunner($app(...$args)) | extends SymfonyRuntime {
public function getRunner(?object $kernel): RunnerInterface
{
return new ClosureRunner(static function () use ($kernel): int {
$kernel->handle(new Request())->send();
| {
"filepath": "src/Symfony/Component/Runtime/Tests/phpt/kernel-loop.php",
"language": "php",
"file_size": 1006,
"cut_index": 512,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* A helper providing autocompletion for available options.
*
* @see HttpClientInterface for a description of each options.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class HttpO... | return $this;
}
/**
* @return $this
*/
public function setAuthBearer(#[\SensitiveParameter] string $token): static
{
$this->options['auth_bearer'] = $token;
return $this;
}
/**
* @return $this
| c(string $user, #[\SensitiveParameter] string $password = ''): static
{
$this->options['auth_basic'] = $user;
if ('' !== $password) {
$this->options['auth_basic'] .= ':'.$password;
}
| {
"filepath": "src/Symfony/Component/HttpClient/HttpOptions.php",
"language": "php",
"file_size": 6642,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\HttpClient\Response;
use Symfony\Component\HttpClient\Chunk\ErrorChunk;
use Symfony\Component\HttpClient\Exception\ClientException;
use Symfony\Component\HttpClient\Exception\RedirectionException;
use Symfony\Component\HttpClient\Exception\ServerException;
... | tpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
class TraceableResponse implements ResponseInterface, StreamableInterface
{
public function __construct(
p | \HttpClient\Exception\RedirectionExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
use Symfony\Contracts\HttpClient\Ht | {
"filepath": "src/Symfony/Component/HttpClient/Response/TraceableResponse.php",
"language": "php",
"file_size": 6551,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Internal;
use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\Factory;
use Composer\IO\IOInterface;
use Comp... | on activate(Composer $composer, IOInterface $io): void
{
self::$activated = true;
$this->composer = $composer;
$this->io = $io;
}
public function deactivate(Composer $composer, IOInterface $io): void
{
self: | ork.com>
*
* @internal
*/
class ComposerPlugin implements PluginInterface, EventSubscriberInterface
{
private Composer $composer;
private IOInterface $io;
private static bool $activated = false;
public functi | {
"filepath": "src/Symfony/Component/Runtime/Internal/ComposerPlugin.php",
"language": "php",
"file_size": 4218,
"cut_index": 614,
"middle_length": 229
} |
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInte... | $command->addArgument('name', null, 'Who should I greet?', 'World');
return static function () use ($input, $output, $context) {
$output->writeln(sprintf('Hello %s', $input->getArgument('name')));
$output->write('OK Command '.$contex | $context) {
| {
"filepath": "src/Symfony/Component/Runtime/Tests/phpt/command2.php",
"language": "php",
"file_size": 818,
"cut_index": 522,
"middle_length": 14
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpClient\Response;
use Symfony\Component\HttpClient\Exception\I... | ion('JSON encoding failed: '.$e->getMessage(), $e->getCode(), $e);
}
$info['response_headers']['content-type'] ??= 'application/json';
parent::__construct($json, $info);
}
public static function fromFile(string $path, arr | ixed $body = [], array $info = [])
{
try {
$json = json_encode($body, \JSON_THROW_ON_ERROR | \JSON_PRESERVE_ZERO_FRACTION);
} catch (\JsonException $e) {
throw new InvalidArgumentExcept | {
"filepath": "src/Symfony/Component/HttpClient/Response/JsonMockResponse.php",
"language": "php",
"file_size": 1465,
"cut_index": 524,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Tests;
require_once __DIR__.'/frankenphp-function-mock.php';
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Sym... | HP_RESET_KERNEL'], $_SERVER['APP_RUNTIME_MODE']);
}
public function testRun()
{
$application = $this->createMock(TestAppInterface::class);
$application
->expects($this->once())
->method('handle')
| PhpWorkerRunner;
interface TestAppInterface extends HttpKernelInterface, TerminableInterface
{
}
class FrankenPhpWorkerRunnerTest extends TestCase
{
protected function tearDown(): void
{
unset($_SERVER['FRANKENP | {
"filepath": "src/Symfony/Component/Runtime/Tests/FrankenPhpWorkerRunnerTest.php",
"language": "php",
"file_size": 4166,
"cut_index": 614,
"middle_length": 229
} |
?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime;
/**
* Enables decoupling applications from g... | /**
* Returns a callable that knows how to run the passed object and that returns its exit status as int.
*
* The passed object is typically created by calling ResolverInterface::resolve().
*/
public function getRunner(?object $a | callable itself should return an object that represents the application to pass to the getRunner() method.
*/
public function getResolver(callable $callable, ?\ReflectionFunction $reflector = null): ResolverInterface;
| {
"filepath": "src/Symfony/Component/Runtime/RuntimeInterface.php",
"language": "php",
"file_size": 1030,
"cut_index": 513,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\XPath;
/**
* XPath expression translator interface.
*
* This component is a port of the Python cssselect library,
* which is copyright Ian ... | }
}
public function getElement(): string
{
return $this->element;
}
/**
* @return $this
*/
public function addCondition(string $condition, string $operator = 'and'): static
{
$this->condition = $thi | ct(
private string $path = '',
private string $element = '*',
private string $condition = '',
bool $starPrefix = false,
) {
if ($starPrefix) {
$this->addStarPrefix();
| {
"filepath": "src/Symfony/Component/CssSelector/XPath/XPathExpr.php",
"language": "php",
"file_size": 3093,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\T... | $reader = new Reader($value);
$stream = new TokenStream();
$this->assertTrue($this->generateHandler()->handle($reader, $stream));
$this->assertEquals($expectedToken, $stream->getNext());
$this->assertRemainingContent($re | mon <contact@jfsimon.fr>
*/
abstract class AbstractHandlerTestCase extends TestCase
{
#[DataProvider('getHandleValueTestData')]
public function testHandleValue($value, Token $expectedToken, $remainingContent)
{
| {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Handler/AbstractHandlerTestCase.php",
"language": "php",
"file_size": 2278,
"cut_index": 563,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use PHPUnit\Framework\Attributes\DataProvide... | $reader = new Reader($value);
$stream = new TokenStream();
$this->assertTrue($this->generateHandler()->handle($reader, $stream));
// comments are ignored (not pushed as token in stream)
$this->assertStreamEmpty($stream) | lector\Parser\TokenStream;
class CommentHandlerTest extends AbstractHandlerTestCase
{
#[DataProvider('getHandleValueTestData')]
public function testHandleValue($value, Token $unusedArgument, $remainingContent)
{
| {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Handler/CommentHandlerTest.php",
"language": "php",
"file_size": 1646,
"cut_index": 537,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelect... | ['#123', new Token(Token::TYPE_HASH, '123', 0), ''],
['#id.class', new Token(Token::TYPE_HASH, 'id', 0), '.class'],
['#id element', new Token(Token::TYPE_HASH, 'id', 0), ' element'],
];
}
public static functio | kenizer\TokenizerPatterns;
class HashHandlerTest extends AbstractHandlerTestCase
{
public static function getHandleValueTestData()
{
return [
['#id', new Token(Token::TYPE_HASH, 'id', 0), ''],
| {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Handler/HashHandlerTest.php",
"language": "php",
"file_size": 1357,
"cut_index": 524,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelect... | ', 0), ''],
['foo|bar', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '|bar'],
['foo.class', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '.class'],
['foo[attr]', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '[attr]'],
| ser\Tokenizer\TokenizerPatterns;
class IdentifierHandlerTest extends AbstractHandlerTestCase
{
public static function getHandleValueTestData()
{
return [
['foo', new Token(Token::TYPE_IDENTIFIER, 'foo | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Handler/IdentifierHandlerTest.php",
"language": "php",
"file_size": 1495,
"cut_index": 524,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelect... | ['+12.34', new Token(Token::TYPE_NUMBER, '+12.34', 0), ''],
['-12.34', new Token(Token::TYPE_NUMBER, '-12.34', 0), ''],
['12 arg', new Token(Token::TYPE_NUMBER, '12', 0), ' arg'],
['12]', new Token(Token::TYPE | HandlerTestCase
{
public static function getHandleValueTestData()
{
return [
['12', new Token(Token::TYPE_NUMBER, '12', 0), ''],
['12.34', new Token(Token::TYPE_NUMBER, '12.34', 0), ''],
| {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Handler/NumberHandlerTest.php",
"language": "php",
"file_size": 1406,
"cut_index": 524,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelect... | ''],
['"1"', new Token(Token::TYPE_STRING, '1', 1), ''],
['" "', new Token(Token::TYPE_STRING, ' ', 1), ''],
['""', new Token(Token::TYPE_STRING, '', 1), ''],
["'hello'", new Token(Token::TYPE_STRING, 'hello | Tokenizer\TokenizerPatterns;
class StringHandlerTest extends AbstractHandlerTestCase
{
public static function getHandleValueTestData()
{
return [
['"hello"', new Token(Token::TYPE_STRING, 'hello', 1), | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Handler/StringHandlerTest.php",
"language": "php",
"file_size": 1471,
"cut_index": 524,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\Css... | 0), ''],
[' foo', new Token(Token::TYPE_WHITESPACE, ' ', 0), 'foo'],
[' .foo', new Token(Token::TYPE_WHITESPACE, ' ', 0), '.foo'],
];
}
public static function getDontHandleValueTestData()
{
return [
| lueTestData()
{
return [
[' ', new Token(Token::TYPE_WHITESPACE, ' ', 0), ''],
["\n", new Token(Token::TYPE_WHITESPACE, "\n", 0), ''],
["\t", new Token(Token::TYPE_WHITESPACE, "\t", | {
"filepath": "src/Symfony/Component/CssSelector/Tests/Parser/Handler/WhitespaceHandlerTest.php",
"language": "php",
"file_size": 1171,
"cut_index": 518,
"middle_length": 229
} |
PathExpr;
class TranslatorTest extends TestCase
{
#[DataProvider('getXpathLiteralTestData')]
public function testXpathLiteral($value, $literal)
{
$this->assertEquals($literal, Translator::getXpathLiteral($value));
}
#[DataProvider('getCssToXPathTestData')]
public function testCssToXPat... | mlExtension($translator));
$this->expectException(SyntaxErrorException::class);
$translator->cssToXPath($css, '');
}
public static function getUnsupportedHasSelectorTestData(): iterable
{
yield 'pseudo-element inside | h($css, ''));
}
#[DataProvider('getUnsupportedHasSelectorTestData')]
public function testHasUnsupportedSelector(string $css)
{
$translator = new Translator();
$translator->registerExtension(new Ht | {
"filepath": "src/Symfony/Component/CssSelector/Tests/XPath/TranslatorTest.php",
"language": "php",
"file_size": 23534,
"cut_index": 1331,
"middle_length": 229
} |
?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Node;
use PHPUnit\Framework\Attribut... | public function testSpecificityValue(NodeInterface $node, $value)
{
$this->assertEquals($value, $node->getSpecificity()->getValue());
}
abstract public static function getToStringConversionTestData();
abstract public static func | nversionTestData')]
public function testToStringConversion(NodeInterface $node, $representation)
{
$this->assertEquals($representation, (string) $node);
}
#[DataProvider('getSpecificityValueTestData')]
| {
"filepath": "src/Symfony/Component/CssSelector/Tests/Node/AbstractNodeTestCase.php",
"language": "php",
"file_size": 1036,
"cut_index": 513,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.