_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q262500 | Application.defaults | test | public function defaults(string $commandName, array $argumentDefaults = []): void
{
$command = $this->get($commandName);
$commandDefinition = $command->getDefinition();
foreach ($argumentDefaults as $name => $default) {
$argument = $commandDefinition->getArgument($name... | php | {
"resource": ""
} |
q262501 | Application.phpBinary | test | public static function phpBinary(): string
{
$finder = (new PhpExecutableFinder())->find(false);
return \escapeshellarg($finder === false ? '' : $finder);
} | php | {
"resource": ""
} |
q262502 | Application.cerebroBinary | test | public static function cerebroBinary(): string
{
$constant = \defined('CEREBRO_BINARY') ? \constant('CEREBRO_BINARY') : null;
return $constant !== null ? \escapeshellarg($constant) : 'cerebro';
} | php | {
"resource": ""
} |
q262503 | Application.doRunCommand | test | protected function doRunCommand(SymfonyCommand $command, InputInterface $input, OutputInterface $output): int
{
$this->runningCommand = $command;
foreach ($command->getHelperSet() as $helper) {
if ($helper instanceof InputAwareInterface) {
$helper->setInput($input);
... | php | {
"resource": ""
} |
q262504 | Application.getDefaultInputDefinition | test | protected function getDefaultInputDefinition(): InputDefinition
{
$definition = parent::getDefaultInputDefinition();
$definition->addOption($this->getEnvironmentOption());
return $definition;
} | php | {
"resource": ""
} |
q262505 | RouteTreeBuilder.build | test | public function build(array $routes): array
{
$rootRouteData = null;
$nodes = [];
$groupedRoutes = [];
foreach ($routes as $route) {
$groupedRoutes[\count($route->getSegments())][] = $route;
}
if (isset($groupedRoutes[0])) {
$rootRout... | php | {
"resource": ""
} |
q262506 | RouteTreeBuilder.addRouteToNode | test | private function addRouteToNode(
RouteTreeNode $node,
RouteContract $route,
array $segments,
int $segmentDepth,
array $parameterIndexNameMap
): void {
if (\count($segments) === 0) {
$node->getContents()->addRoute($route, $parameterIndexNameMap);
... | php | {
"resource": ""
} |
q262507 | RouteTreeBuilder.getMatcher | test | private function getMatcher($firstSegment, array &$parameterIndexNameMap): SegmentMatcherContract
{
if ($firstSegment instanceof ParameterMatcher) {
return $firstSegment->getMatcher($parameterIndexNameMap);
}
return $firstSegment;
} | php | {
"resource": ""
} |
q262508 | FilesystemServiceProvider.createFilesystemManager | test | public static function createFilesystemManager(ContainerInterface $container): FilesystemManager
{
$manager = new FilesystemManager($container->get('config'));
if ($container->has(CacheManagerContract::class)) {
$manager->setCacheManager($container->get(CacheManagerContract::class));
... | php | {
"resource": ""
} |
q262509 | FilesystemServiceProvider.createCachedFactory | test | public static function createCachedFactory(ContainerInterface $container): CachedFactory
{
$cache = null;
if ($container->has(CacheManagerContract::class)) {
$cache = $container->get(CacheManagerContract::class);
}
return new CachedFactory(
$container->get(F... | php | {
"resource": ""
} |
q262510 | TraceablePDODecorater.getAccumulatedStatementsDuration | test | public function getAccumulatedStatementsDuration(): int
{
return \array_reduce($this->executedStatements, static function ($v, $s) {
return $v + $s->getDuration();
});
} | php | {
"resource": ""
} |
q262511 | TraceablePDODecorater.getMemoryUsage | test | public function getMemoryUsage(): int
{
return \array_reduce($this->executedStatements, static function ($v, $s) {
return $v + $s->getMemoryUsage();
});
} | php | {
"resource": ""
} |
q262512 | TraceablePDODecorater.profileCall | test | protected function profileCall(string $method, string $sql, array $args)
{
$trace = new TracedStatement($sql);
$trace->start();
$ex = null;
$result = null;
try {
$result = $this->pdo->{$method}(...$args);
} catch (PDOException $e) {
$ex =... | php | {
"resource": ""
} |
q262513 | Resolver.resolve | test | public function resolve(string $alias): ?string
{
// Check wether the alias matches the pattern
if (\preg_match($this->regex, $alias, $matches) !== 1) {
return null;
}
// Get the translation
$translation = $this->translation;
if (\mb_strpos($translation,... | php | {
"resource": ""
} |
q262514 | Resolver.matches | test | public function matches(string $pattern, string $translation = null): bool
{
return $this->pattern === $pattern && (! $translation || $translation === $this->translation);
} | php | {
"resource": ""
} |
q262515 | TwigServiceProvider.createTwigEngine | test | public static function createTwigEngine(ContainerInterface $container): TwigEngine
{
$engine = new TwigEngine($container->get(TwigEnvironment::class), $container->get('config'));
$engine->setContainer($container);
return $engine;
} | php | {
"resource": ""
} |
q262516 | TwigServiceProvider.extendViewFactory | test | public static function extendViewFactory(
ContainerInterface $container,
?FactoryContract $view = null
): ?FactoryContract {
if ($view !== null) {
// @var FactoryContract $view
$view->addExtension('twig', 'twig');
}
return $view;
} | php | {
"resource": ""
} |
q262517 | TwigServiceProvider.extendEngineResolver | test | public static function extendEngineResolver(
ContainerInterface $container,
?EngineResolver $engines = null
): ?EngineResolver {
if ($engines !== null) {
// @var EngineResolver $engines
$engines->register('twig', static function () use ($container) {
r... | php | {
"resource": ""
} |
q262518 | TwigServiceProvider.createTwigEnvironment | test | public static function createTwigEnvironment(ContainerInterface $container): TwigEnvironment
{
$options = self::resolveOptions($container->get('config'));
$twigOptions = $options['engines']['twig']['options'];
$twig = new TwigEnvironment(
$container->get(LoaderInterface::cla... | php | {
"resource": ""
} |
q262519 | TwigServiceProvider.createTwigLoader | test | public static function createTwigLoader(ContainerInterface $container): LoaderInterface
{
$options = self::resolveOptions($container->get('config'));
$loaders = [];
$twigOptions = $options['engines']['twig'];
$loader = new TwigLoader($container->get(FinderContract::class));... | php | {
"resource": ""
} |
q262520 | Validator.parseData | test | protected function parseData(array $data): array
{
$newData = [];
foreach ($data as $key => $value) {
if (\is_array($value)) {
return $this->parseData($value);
}
$newData[$key] = $value;
}
return $newData;
} | php | {
"resource": ""
} |
q262521 | Validator.createRule | test | protected function createRule($rules): RespectValidator
{
$notRules = [];
$optionalRules = [];
if (\is_string($rules)) {
// remove duplicate
$rules = \array_unique(\explode('|', $rules));
}
foreach ($rules as $key => $rule) {
if (\mb... | php | {
"resource": ""
} |
q262522 | Validator.createNegativeOrOptionalValidator | test | protected function createNegativeOrOptionalValidator(string $filter, array $rules): RespectValidator
{
[$method, $parameters] = $this->parseStringRule($rules[0]);
unset($rules[0]);
$method = \str_replace($filter, '', $method);
$validator = RespectValidator::$method(...$parameter... | php | {
"resource": ""
} |
q262523 | Validator.createChainableValidators | test | protected function createChainableValidators(RespectValidator $class, array $rules): RespectValidator
{
// reset keys
$rules = \array_values($rules);
if (\count($rules) !== 0) {
$chain = '';
foreach ($rules as $rule) {
if ($rules[0] === $rule) {
... | php | {
"resource": ""
} |
q262524 | Validator.parseStringRule | test | protected function parseStringRule(string $rules): array
{
$parameters = [];
// The format for specifying validation rules and parameters follows an
// easy {rule}:{parameters} formatting convention. For instance the
// rule "Min:3" states that the value may only be three letters.
... | php | {
"resource": ""
} |
q262525 | Validator.parseParameters | test | protected function parseParameters(string $rule, string $parameter): array
{
if (\mb_strtolower($rule) === 'regex') {
return [$parameter];
}
return \str_getcsv($parameter);
} | php | {
"resource": ""
} |
q262526 | WebServer.start | test | public static function start(WebServerConfig $config, string $pidFile = null): int
{
$pidFile = $pidFile ?? self::getDefaultPidFile();
if (self::isRunning($pidFile)) {
throw new RuntimeException(\sprintf('A process is already listening on http://%s.', $config->getAddress()));
}
... | php | {
"resource": ""
} |
q262527 | WebServer.stop | test | public static function stop(string $pidFile = null): void
{
$pidFile = $pidFile ?? self::getDefaultPidFile();
if (! \file_exists($pidFile)) {
throw new RuntimeException('No web server is listening.');
}
\unlink($pidFile);
} | php | {
"resource": ""
} |
q262528 | WebServer.getAddress | test | public static function getAddress(string $pidFile = null)
{
$pidFile = $pidFile ?? self::getDefaultPidFile();
if (! \file_exists($pidFile)) {
return false;
}
return \file_get_contents($pidFile);
} | php | {
"resource": ""
} |
q262529 | WebServer.isRunning | test | public static function isRunning(string $pidFile = null): bool
{
$pidFile = $pidFile ?? self::getDefaultPidFile();
if (! \file_exists($pidFile)) {
return false;
}
$address = \file_get_contents($pidFile);
$pos = \mb_strrpos($address, ':');
$hostname... | php | {
"resource": ""
} |
q262530 | WebServer.createServerProcess | test | private static function createServerProcess(WebServerConfig $config): Process
{
$finder = new PhpExecutableFinder();
if (($binary = $finder->find(false)) === false) {
throw new RuntimeException('Unable to find the PHP binary.');
}
$xdebugArgs = [];
if ($config-... | php | {
"resource": ""
} |
q262531 | EventManager.getListeners | test | public function getListeners(string $eventName = null): array
{
if ($eventName === null) {
foreach ($this->listeners as $name => $eventListeners) {
if (! isset($this->sorted[$name])) {
$this->sortListeners($name);
}
}
r... | php | {
"resource": ""
} |
q262532 | EventManager.removeListenerPattern | test | protected function removeListenerPattern(string $eventPattern, $listener): void
{
if (empty($this->patterns[$eventPattern])) {
return;
}
/** @var ListenerPattern $pattern */
foreach ($this->patterns[$eventPattern] as $key => $pattern) {
if ($listener === $pat... | php | {
"resource": ""
} |
q262533 | EventManager.hasWildcards | test | private function hasWildcards(string $subject): bool
{
return \mb_strpos($subject, '*') !== false || \mb_strpos($subject, '#') !== false;
} | php | {
"resource": ""
} |
q262534 | EventManager.addListenerPattern | test | private function addListenerPattern(ListenerPattern $pattern): void
{
$this->patterns[$pattern->getEventPattern()][] = $pattern;
foreach ($this->syncedEvents as $eventName => $value) {
if ($pattern->test($eventName)) {
unset($this->syncedEvents[$eventName]);
... | php | {
"resource": ""
} |
q262535 | OptionsReader.readMandatoryOption | test | protected function readMandatoryOption(string $className, array $dimensions, array $mandatoryOptions): array
{
$options = [];
foreach ($mandatoryOptions as $key => $mandatoryOption) {
if (! \is_scalar($mandatoryOption)) {
$options[$key] = $this->readMandatoryOption($clas... | php | {
"resource": ""
} |
q262536 | OptionsReader.buildMultidimensionalArray | test | private function buildMultidimensionalArray(array $dimensions, $value): array
{
$config = [];
$index = \array_shift($dimensions);
if (! isset($dimensions[0])) {
$config[$index] = $value;
} else {
$config[$index] = $this->buildMultidimensionalArray($dimension... | php | {
"resource": ""
} |
q262537 | Handler.getPreparedResponse | test | protected function getPreparedResponse(
?ServerRequestInterface $request,
Throwable $exception,
Throwable $transformed
): ResponseInterface {
try {
$response = $this->getResponse(
$request,
$exception,
$transformed
... | php | {
"resource": ""
} |
q262538 | Handler.getResponse | test | protected function getResponse(
?ServerRequestInterface $request,
Throwable $exception,
Throwable $transformed
): ResponseInterface {
$id = ExceptionIdentifier::identify($exception);
$flattened = FlattenException::create($exception);
$code = $flattened->ge... | php | {
"resource": ""
} |
q262539 | Handler.getDisplayer | test | protected function getDisplayer(
?ServerRequestInterface $request,
Throwable $original,
Throwable $transformed,
int $code
): DisplayerContract {
$sortedDisplayers = [];
\ksort($this->displayers);
\array_walk_recursive($this->displayers, static function ($dis... | php | {
"resource": ""
} |
q262540 | Handler.getFiltered | test | protected function getFiltered(
array $displayers,
ServerRequestInterface $request,
Throwable $original,
Throwable $transformed,
int $code
): array {
/** @var \Viserio\Component\Contract\Exception\Filter[] $sortedFilters */
$sortedFilters = [];
\ksort... | php | {
"resource": ""
} |
q262541 | Handler.sortedFilter | test | private function sortedFilter(array $filtered, ServerRequestInterface $request): DisplayerContract
{
$accepts = self::getHeaderValuesFromString($request->getHeaderLine('Accept'));
foreach ($accepts as $accept) {
foreach ($filtered as $filter) {
if ($filter->getContentTyp... | php | {
"resource": ""
} |
q262542 | Collection.addLookups | test | protected function addLookups(RouteContract $route): void
{
// If the route has a name, we will add it to the name look-up table so that we
// will quickly be able to find any route associate with a name and not have
// to iterate through every route every time we need to perform a look-up.
... | php | {
"resource": ""
} |
q262543 | Message.addAddresses | test | protected function addAddresses($address, string $name, string $type): void
{
if (\is_array($address)) {
$set = \sprintf('set%s', $type);
$this->swift->{$set}($address, $name);
return;
}
$add = \sprintf('add%s', $type);
$this->swift->{$add}($addr... | php | {
"resource": ""
} |
q262544 | ProfilerServiceProvider.createAssetsRenderer | test | public static function createAssetsRenderer(ContainerInterface $container): AssetsRenderer
{
$options = self::resolveOptions($container->get('config'));
return new AssetsRenderer($options['jquery_is_used'], $options['path']);
} | php | {
"resource": ""
} |
q262545 | ProfilerServiceProvider.registerBaseCollectors | test | protected static function registerBaseCollectors(
ContainerInterface $container,
ProfilerContract $profiler,
array $options
): void {
if ($options['collector']['time']) {
$profiler->addCollector(new TimeDataCollector(
$container->get(ServerRequestInterface... | php | {
"resource": ""
} |
q262546 | ProfilerServiceProvider.registerCollectorsFromConfig | test | private static function registerCollectorsFromConfig(
ContainerInterface $container,
ProfilerContract $profiler,
array $options
): void {
if ($collectors = $options['collectors']) {
foreach ($collectors as $collector) {
$profiler->addCollector($container->... | php | {
"resource": ""
} |
q262547 | SessionServiceProvider.extendEventManager | test | public static function extendEventManager(
ContainerInterface $container,
?EventManagerContract $eventManager = null
): ?EventManagerContract {
if ($eventManager !== null) {
$eventManager->attach(TerminableContract::TERMINATE, static function (EventContract $event): void {
... | php | {
"resource": ""
} |
q262548 | SessionServiceProvider.createSessionManager | test | public static function createSessionManager(ContainerInterface $container): SessionManager
{
$manager = new SessionManager($container->get('config'));
if ($container->has(CacheManagerContract::class)) {
$manager->setCacheManager($container->get(CacheManagerContract::class));
}
... | php | {
"resource": ""
} |
q262549 | RoutingServiceProvider.createRouteDispatcher | test | public static function createRouteDispatcher(
ContainerInterface $container,
?callable $getPrevious = null
): DispatcherContract {
// @codeCoverageIgnoreStart
if (\is_callable($getPrevious)) {
$dispatcher = $getPrevious();
} elseif (\class_exists(Pipeline::class))... | php | {
"resource": ""
} |
q262550 | RoutingServiceProvider.createRouter | test | public static function createRouter(ContainerInterface $container): RouterContract
{
$router = new Router($container->get(DispatcherContract::class));
$router->setContainer($container);
return $router;
} | php | {
"resource": ""
} |
q262551 | RoutingServiceProvider.createUrlGenerator | test | public static function createUrlGenerator(ContainerInterface $container): ?UrlGeneratorContract
{
if (! $container->has(UriFactoryInterface::class)) {
return null;
}
return new UrlGenerator(
$container->get(RouterContract::class)->getRoutes(),
$container-... | php | {
"resource": ""
} |
q262552 | EnvironmentDetector.detectConsoleEnvironment | test | protected function detectConsoleEnvironment(Closure $callback, array $args): string
{
// First we will check if an environment argument was passed via console arguments
// and if it was that automatically overrides as the environment. Otherwise, we
// will check the environment as a "web" re... | php | {
"resource": ""
} |
q262553 | EnvironmentDetector.getEnvironmentArgument | test | protected function getEnvironmentArgument(array $args): ?string
{
$callback = static function ($v) {
return self::startsWith($v, '--env');
};
foreach ($args as $key => $value) {
if ($callback($value)) {
return $value;
}
}
... | php | {
"resource": ""
} |
q262554 | AssetController.js | test | public function js(): ResponseInterface
{
$renderer = $this->profiler->getAssetsRenderer();
$stream = $this->streamFactory->createStream(
$renderer->dumpAssetsToString('js')
);
$response = $this->responseFactory->createResponse();
$response = $response->withHead... | php | {
"resource": ""
} |
q262555 | TomlDumper.fromArray | test | private function fromArray(array $data, TomlBuilder $builder, string $parent = ''): TomlBuilder
{
foreach ($data as $key => $value) {
if (\is_array($value)) {
if ($this->hasStringKeys($value)) {
$key = $parent !== '' ? "${parent}.${key}" : $key;
... | php | {
"resource": ""
} |
q262556 | TomlDumper.processArrayOfArrays | test | private function processArrayOfArrays(array $values, string $parent, TomlBuilder $builder): TomlBuilder
{
$array = [];
foreach ($values as $value) {
if ($this->hasStringKeys($value)) {
$builder->addArrayOfTable($parent);
foreach ($value as $key => $val) ... | php | {
"resource": ""
} |
q262557 | DebugCommand.getPrettyMetadata | test | private function getPrettyMetadata(string $type, object $entity): string
{
if ($type === 'tests') {
return '';
}
try {
$meta = $this->getMetadata($type, $entity);
if ($meta === null) {
return '(unknown?)';
}
} catch (U... | php | {
"resource": ""
} |
q262558 | DebugCommand.getLoaderPaths | test | private function getLoaderPaths(Environment $twig): array
{
/** @var \Twig\Loader\FilesystemLoader $loader */
$loader = $twig->getLoader();
if (! $loader instanceof FilesystemLoader) {
return [];
}
$loaderPaths = [];
foreach ($loader->getNamespaces() as... | php | {
"resource": ""
} |
q262559 | DebugCommand.buildTableRows | test | private function buildTableRows(array $loaderPaths): array
{
$rows = [];
$firstNamespace = true;
$prevHasSeparator = false;
foreach ($loaderPaths as $namespace => $paths) {
if (! $firstNamespace && ! $prevHasSeparator && \count($paths) > 1) {
... | php | {
"resource": ""
} |
q262560 | AbstractWhoopsDisplayer.getWhoops | test | private function getWhoops(): Whoops
{
$whoops = new Whoops();
$whoops->allowQuit(false);
$whoops->writeToOutput(false);
$whoops->pushHandler($this->getHandler());
return $whoops;
} | php | {
"resource": ""
} |
q262561 | Router.addWhereClausesToRoute | test | protected function addWhereClausesToRoute(RouteContract $route): void
{
$where = $route->getAction()['where'] ?? [];
$pattern = \array_merge($this->patterns, $where);
foreach ($pattern as $name => $value) {
$route->where($name, $value);
}
} | php | {
"resource": ""
} |
q262562 | Router.mergeGroupAttributesIntoRoute | test | protected function mergeGroupAttributesIntoRoute(RouteContract $route): void
{
$action = $this->mergeWithLastGroup($route->getAction());
$route->setAction($action);
} | php | {
"resource": ""
} |
q262563 | Router.convertToControllerAction | test | protected function convertToControllerAction($action): array
{
if (\is_string($action)) {
$action = ['uses' => $action];
}
if ($this->hasGroupStack()) {
$action['uses'] = $this->prependGroupNamespace($action['uses']);
}
$action['controller'] = $actio... | php | {
"resource": ""
} |
q262564 | Router.prependGroupNamespace | test | protected function prependGroupNamespace(string $uses): string
{
$group = \end($this->groupStack);
return isset($group['namespace']) && \strpos($uses, '\\') !== 0 ?
$group['namespace'] . '\\' . $uses :
$uses;
} | php | {
"resource": ""
} |
q262565 | Router.prefix | test | protected function prefix(string $uri): string
{
$trimmed = \trim($this->getLastGroupPrefix(), '/') . '/' . \trim($uri, '/');
if (! $trimmed) {
return '/';
}
if (\strpos($trimmed, '/') === 0) {
return $trimmed;
}
return '/' . $trimmed;
} | php | {
"resource": ""
} |
q262566 | Router.updateGroupStack | test | protected function updateGroupStack(array $attributes): void
{
if ($this->hasGroupStack()) {
$attributes = RouteGroup::merge($attributes, \end($this->groupStack));
}
$this->groupStack[] = $attributes;
} | php | {
"resource": ""
} |
q262567 | SanitizerServiceProvider.createSanitizer | test | public static function createSanitizer(ContainerInterface $container): Sanitizer
{
$sanitizer = new Sanitizer();
$sanitizer->setContainer($container);
return $sanitizer;
} | php | {
"resource": ""
} |
q262568 | BootstrapManager.addBeforeBootstrapping | test | public function addBeforeBootstrapping(string $bootstrapper, callable $callback): void
{
$key = 'bootstrapping: ' . \str_replace('\\', '', $bootstrapper);
$this->bootstrappingCallbacks[$key][] = $callback;
} | php | {
"resource": ""
} |
q262569 | BootstrapManager.addAfterBootstrapping | test | public function addAfterBootstrapping(string $bootstrapper, callable $callback): void
{
$key = 'bootstrapped: ' . \str_replace('\\', '', $bootstrapper);
$this->bootstrappedCallbacks[$key][] = $callback;
} | php | {
"resource": ""
} |
q262570 | BootstrapManager.bootstrapWith | test | public function bootstrapWith(array $bootstraps): void
{
foreach ($bootstraps as $bootstrap) {
$this->callCallbacks(
$this->bootstrappingCallbacks,
$this->kernel,
'bootstrapping: ',
$bootstrap
);
$bootstrap:... | php | {
"resource": ""
} |
q262571 | BootstrapManager.callCallbacks | test | private function callCallbacks(array $bootCallbacks, KernelContract $kernel, string $type, string $bootstrap): void
{
foreach ($bootCallbacks as $name => $callbacks) {
if ($type . \str_replace('\\', '', $bootstrap) === $name) {
/** @var callable $callback */
forea... | php | {
"resource": ""
} |
q262572 | Store.generateSessionId | test | protected function generateSessionId(): string
{
return \hash('ripemd160', \uniqid(Str::random(23), true) . Str::random(25) . \microtime(true));
} | php | {
"resource": ""
} |
q262573 | Store.mergeNewFlashes | test | private function mergeNewFlashes(array $keys): void
{
$values = \array_unique(\array_merge($this->get('_flash.new', []), $keys));
$this->set('_flash.new', $values);
} | php | {
"resource": ""
} |
q262574 | Store.loadSession | test | private function loadSession(): bool
{
$values = $this->readFromHandler();
if (\count($values) === 0) {
return false;
}
$metadata = $values[self::METADATA_NAMESPACE];
$this->firstTrace = $metadata['firstTrace'];
$this->lastTrace = $metada... | php | {
"resource": ""
} |
q262575 | Store.readFromHandler | test | private function readFromHandler(): array
{
$data = $this->handler->read($this->id);
if ($data === '') {
return [];
}
return $this->prepareForReadFromHandler($data);
} | php | {
"resource": ""
} |
q262576 | Store.writeToHandler | test | private function writeToHandler(): void
{
$values = $this->values;
$values[self::METADATA_NAMESPACE] = [
'firstTrace' => $this->firstTrace,
'lastTrace' => $this->lastTrace,
'regenerationTrace' => $this->regenerationTrace,
'requestsCount... | php | {
"resource": ""
} |
q262577 | AbstractPaginator.resolveCurrentPage | test | protected function resolveCurrentPage(): int
{
$query = $this->request->getQueryParams();
if (\array_key_exists($this->pageName, $query)) {
$query = $this->secureInput($query);
$page = $query[$this->pageName];
if ((int) $page >= 1 && \filter_var($page, \FILTER_... | php | {
"resource": ""
} |
q262578 | AbstractPaginator.secureInput | test | private function secureInput(array $query): array
{
$secure = static function (&$v): void {
if (! \is_string($v) && ! \is_numeric($v)) {
$v = '';
} elseif (\mb_strpos($v, "\0") !== false) {
$v = '';
} elseif (! \mb_check_encoding($v, 'UTF-8... | php | {
"resource": ""
} |
q262579 | EventsDataCollectorServiceProvider.extendEventManager | test | public static function extendEventManager(
ContainerInterface $container,
?EventManager $eventManager = null
): ?TraceableEventManager {
if ($eventManager !== null) {
$options = self::resolveOptions($container->get('config'));
if ($options['collector']['events']) {
... | php | {
"resource": ""
} |
q262580 | LintCommand.getFiles | test | protected function getFiles(array $files, array $directories): array
{
$foundFiles = [];
/** @var \SplFileInfo $file */
foreach ($this->getFinder($directories) as $file) {
if (\count($files) !== 0 && ! \in_array($file->getFilename(), $files, true)) {
continue;
... | php | {
"resource": ""
} |
q262581 | LintCommand.getFinder | test | protected function getFinder(array $paths): iterable
{
$foundFiles = [];
$baseDir = (array) $this->argument('dir');
foreach ($baseDir as $dir) {
if (\count($paths) !== 0) {
foreach ($paths as $path) {
$this->findTwigFiles($dir . \DIRECTORY_... | php | {
"resource": ""
} |
q262582 | LintCommand.validate | test | protected function validate(string $template, string $file): array
{
$realLoader = $this->environment->getLoader();
try {
$temporaryLoader = new ArrayLoader([$file => $template]);
$this->environment->setLoader($temporaryLoader);
$nodeTree = $this->environment->p... | php | {
"resource": ""
} |
q262583 | LintCommand.display | test | protected function display(array $details, string $format = 'txt'): int
{
$verbose = $this->getOutput()->isVerbose();
switch ($format) {
case 'txt':
return $this->displayText($details, $verbose);
case 'json':
return $this->displayJson($details... | php | {
"resource": ""
} |
q262584 | LintCommand.displayText | test | protected function displayText(array $details, bool $verbose = false): int
{
$errors = 0;
foreach ($details as $info) {
if ($verbose && $info['valid']) {
$file = ' in ' . $info['file'];
$this->line('<info>OK</info>' . $file);
} elseif (! $info... | php | {
"resource": ""
} |
q262585 | MiddlewareNameResolver.parseMiddlewareGroup | test | protected static function parseMiddlewareGroup(
string $name,
array $map,
array $middlewareGroups,
array $disabledMiddleware
): array {
$results = [];
foreach ($middlewareGroups[$name] as $middleware) {
$name = \is_object($middleware) ? \get_class($middle... | php | {
"resource": ""
} |
q262586 | OptionsResolverTrait.checkMandatoryOptions | test | private static function checkMandatoryOptions(
string $configClass,
array $mandatoryOptions,
$config,
array $interfaces
): void {
foreach ($mandatoryOptions as $key => $mandatoryOption) {
$useRecursion = ! \is_scalar($mandatoryOption);
if (! $useRecur... | php | {
"resource": ""
} |
q262587 | OptionsResolverTrait.getConfigurationDimensions | test | private static function getConfigurationDimensions(
array $dimensions,
$config,
string $configClass,
array $interfaces,
?string $configId
) {
foreach ($dimensions as $dimension) {
if ((array) $config !== $config && ! $config instanceof ArrayAccess) {
... | php | {
"resource": ""
} |
q262588 | OptionsResolverTrait.validateOptions | test | private static function validateOptions(array $validators, $config, string $configClass): void
{
foreach ($validators as $key => $values) {
if (! \array_key_exists($key, (array) $config)) {
continue;
}
if (\is_array($values) && isset($values[0]) && \is_st... | php | {
"resource": ""
} |
q262589 | OptionsResolverTrait.checkDeprecatedOptions | test | private static function checkDeprecatedOptions(string $configClass, array $deprecatedOptions, $config): void
{
foreach ($deprecatedOptions as $key => $deprecationMessage) {
if (\is_array($deprecationMessage)) {
self::checkDeprecatedOptions($configClass, $deprecationMessage, $conf... | php | {
"resource": ""
} |
q262590 | ResourceRegistrar.register | test | public function register(string $name, string $controller, array $options = []): void
{
if (isset($options['parameters']) && \count($this->parameters) === 0) {
$this->parameters = (array) $options['parameters'];
}
// If the resource name contains a slash, we will assume the deve... | php | {
"resource": ""
} |
q262591 | ResourceRegistrar.getResourceUri | test | public function getResourceUri(string $resource, array $options): string
{
if (\strpos($resource, '.') === false) {
return $resource;
}
// Once we have built the base URI, we'll remove the parameter holder for this
// base resource name so that the individual route adder... | php | {
"resource": ""
} |
q262592 | ResourceRegistrar.getResourceWildcard | test | public function getResourceWildcard(string $value): string
{
if (isset($this->parameters[$value])) {
$value = $this->parameters[$value];
} elseif (isset(static::$parameterMap[$value])) {
$value = static::$parameterMap[$value];
} elseif (static::$singularParameters || ... | php | {
"resource": ""
} |
q262593 | ResourceRegistrar.getResourcePrefix | test | protected function getResourcePrefix(string $name): array
{
$segments = \explode('/', $name);
// To get the prefix, we will take all of the name segments and implode them on
// a slash. This will generate a proper URI prefix for us. Then we take this
// last segment, which will be c... | php | {
"resource": ""
} |
q262594 | ResourceRegistrar.addResourceDestroy | test | protected function addResourceDestroy(string $name, string $base, string $controller, array $options): RouteContract
{
$uri = $this->getResourceUri($name, $options) . '/{' . $base . '}';
$action = $this->getResourceAction($name, $controller, 'destroy', $options);
return $this->router->dele... | php | {
"resource": ""
} |
q262595 | ResourceRegistrar.getNestedResourceUri | test | protected function getNestedResourceUri(array $segments, array $options): string
{
// We will spin through the segments and create a place-holder for each of the
// resource segments, as well as the resource itself. Then we should get an
// entire string for the resource URI that contains al... | php | {
"resource": ""
} |
q262596 | ResourceRegistrar.getResourceAction | test | protected function getResourceAction(string $resource, string $controller, string $method, array $options): array
{
$name = $this->getResourceRouteName($resource, $method, $options);
$action = ['as' => $name, 'uses' => $controller . '@' . $method];
if (isset($options['middleware'])) {
... | php | {
"resource": ""
} |
q262597 | ResourceRegistrar.getResourceRouteName | test | protected function getResourceRouteName(string $resource, string $method, array $options): string
{
$name = $resource;
// If the names array has been provided to us we will check for an entry in the
// array first. We will also check for the specific method within this array
// so t... | php | {
"resource": ""
} |
q262598 | Pipeline.sliceThroughContainer | test | protected function sliceThroughContainer($traveler, $stack, string $stage)
{
[$name, $parameters] = $this->parseStageString($stage);
$parameters = \array_merge([$traveler, $stack], $parameters);
$class = null;
if ($this->container->has($name)) {
$c... | php | {
"resource": ""
} |
q262599 | Pipeline.getRequestHandlerMiddleware | test | private function getRequestHandlerMiddleware(callable $middleware): RequestHandlerInterface
{
return new class($middleware) implements RequestHandlerInterface {
/**
* @var callable
*/
private $middleware;
/**
* Create a new delegate... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.