_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q262900
ViewServiceProvider.registerMarkdownEngine
test
protected static function registerMarkdownEngine(EngineResolver $engines, ContainerInterface $container): void { $markdown = null; if ($container->has(ParsedownExtra::class)) { $markdown = $container->get(ParsedownExtra::class); } elseif ($container->has(Parsedown::class)) { ...
php
{ "resource": "" }
q262901
PoDumper.cleanExport
test
protected function cleanExport(string $string): string { $replaces = [ '\\' => '\\\\', '"' => '\"', "\t" => '\t', ]; $string = \str_replace(\array_keys($replaces), \array_values($replaces), $string); $po = '"' . \implode('$' . "\n" . '"' . $t...
php
{ "resource": "" }
q262902
PoDumper.addTCommentToOutput
test
private function addTCommentToOutput(array $entry, string $output): array { if (isset($entry['tcomment']) && \count($entry['tcomment']) !== 0) { foreach ($entry['tcomment'] as $comment) { $output .= '# ' . $comment . $this->eol; } } return [$entry, $o...
php
{ "resource": "" }
q262903
PoDumper.addReferencesToOutput
test
private function addReferencesToOutput(array $entry, string $output): array { if (isset($entry['references']) && \count($entry['references']) !== 0) { foreach ($entry['references'] as $ref => $value) { $output .= '#: ' . \str_replace(['{', '}'], '', $ref) . $this->eol; ...
php
{ "resource": "" }
q262904
PoDumper.addFlagsToOutput
test
private function addFlagsToOutput(array $entry, string $output): array { if (isset($entry['flags']) && \count($entry['flags']) !== 0) { $output .= '#, ' . \implode(', ', $entry['flags']) . $this->eol; } return [$entry, $output]; }
php
{ "resource": "" }
q262905
PoDumper.addPreviousToOutput
test
private function addPreviousToOutput(array $entry, string $output): array { if (isset($entry['previous']) && \count($entry['previous']) !== 0) { foreach ((array) $entry['previous'] as $key => $value) { if (\is_string($value)) { $output .= '#| ' . $key . ' ' . ...
php
{ "resource": "" }
q262906
PoDumper.addMsgidToOutput
test
private function addMsgidToOutput(array $entry, string $output, bool $isObsolete): array { if (isset($entry['msgid'])) { // Special clean for msgid if (\is_string($entry['msgid'])) { $msgid = \explode($this->eol, $entry['msgid']); } elseif (\is_array($entr...
php
{ "resource": "" }
q262907
PoDumper.addMsgidPluralToOutput
test
private function addMsgidPluralToOutput(array $entry, string $output): array { if (isset($entry['msgid_plural'])) { // Special clean for msgid_plural if (\is_string($entry['msgid_plural'])) { $msgidPlural = \explode($this->eol, $entry['msgid_plural']); } e...
php
{ "resource": "" }
q262908
PoDumper.addMsgstrToOutput
test
private function addMsgstrToOutput(array $entry, bool $isPlural, string $output, bool $isObsolete): string { // checks if there is a key starting with msgstr if (\count(\preg_grep('/^msgstr/', \array_keys($entry))) !== 0) { if ($isPlural) { $noTranslation = true; ...
php
{ "resource": "" }
q262909
PoDumper.addHeaderToOutput
test
private function addHeaderToOutput(array $data, string $output): array { if (isset($data['headers']) && \count($data['headers']) !== 0) { $output .= 'msgid ""' . $this->eol; $output .= 'msgstr ""' . $this->eol; foreach ($data['headers'] as $key => $value) { ...
php
{ "resource": "" }
q262910
SemanticUi.getPaginationsLinks
test
private function getPaginationsLinks(array $items, $pagination): void { foreach ($items as $item) { if (\is_string($item)) { $pagination .= '<a class="icon item disabled">' . $item . '</a>'; } // Array Of Links if (\is_array($item)) { ...
php
{ "resource": "" }
q262911
CachedFactory.createConnector
test
protected function createConnector(array $config): CacheInterface { $cacheConfig = $config['cache']; if (($cache = $this->cacheManager) !== null) { if ($cache->hasDriver($cacheConfig['driver'])) { return new Psr6Cache( $cache->getDriver($cacheConfig['...
php
{ "resource": "" }
q262912
Cron.ensureCorrectUser
test
protected function ensureCorrectUser(string $command): string { if ($this->user && ! $this->isWindows()) { return 'sudo -u ' . $this->user . ' -- sh -c \'' . $command . '\''; } // http://de2.php.net/manual/en/function.exec.php#56599 // The "start" command will start a de...
php
{ "resource": "" }
q262913
Cron.expressionPasses
test
protected function expressionPasses(): bool { $date = Chronos::now(); if ($this->timezone !== null) { $date->setTimezone($this->timezone); } return CronExpression::factory($this->expression)->isDue($date->toDateTimeString()); }
php
{ "resource": "" }
q262914
Cron.runCommandInForeground
test
protected function runCommandInForeground(): int { $this->callBeforeCallbacks(); $process = Process::fromShellCommandline( \trim($this->buildCommand(), ' &'), $this->path, null, null, null ); $run = $process->run(); ...
php
{ "resource": "" }
q262915
Cron.runCommandInBackground
test
protected function runCommandInBackground(): int { $process = Process::fromShellCommandline( $this->buildCommand(), $this->path, null, null, null ); return $process->run(); }
php
{ "resource": "" }
q262916
Cron.callBeforeCallbacks
test
protected function callBeforeCallbacks(): void { foreach ($this->beforeCallbacks as $callback) { $this->getInvoker()->call($callback); } }
php
{ "resource": "" }
q262917
Cron.callAfterCallbacks
test
protected function callAfterCallbacks(): void { foreach ($this->afterCallbacks as $callback) { $this->getInvoker()->call($callback); } }
php
{ "resource": "" }
q262918
Cron.inTimeInterval
test
protected function inTimeInterval(string $startTime, string $endTime): Closure { if ($this->isMidnightBetween($startTime, $endTime)) { $endTime .= ' +1 day'; } return function () use ($startTime, $endTime) { return Chronos::now($this->timezone)->between( ...
php
{ "resource": "" }
q262919
Cron.isMidnightBetween
test
private function isMidnightBetween(string $startTime, string $endTime): bool { return \strtotime($startTime) > \strtotime($endTime); }
php
{ "resource": "" }
q262920
MatcherOptimizer.mergeMatchers
test
public static function mergeMatchers(array $parentMatchers, array $childMatchers): array { $mergedMatchers = $parentMatchers; foreach ($childMatchers as $segment => $childMatcher) { if (isset($mergedMatchers[$segment])) { $mergedMatchers[$segment] = new CompoundMatcher([...
php
{ "resource": "" }
q262921
MatcherOptimizer.optimizeMatchers
test
public static function optimizeMatchers(array $matchers): array { foreach ($matchers as $key => $matcher) { $matchers[$key] = self::optimizeMatcher($matcher); } return self::optimizeMatcherOrder($matchers); }
php
{ "resource": "" }
q262922
MatcherOptimizer.optimizeMatcher
test
private static function optimizeMatcher(SegmentMatcherContract $matcher): SegmentMatcherContract { if ($matcher instanceof RegexMatcher && $matcher->getGroupCount() === 1) { $parameterKeys = $matcher->getParameterKeys(); switch ($matcher->getRegex()) { case '/^(' . P...
php
{ "resource": "" }
q262923
MatcherOptimizer.optimizeMatcherOrder
test
private static function optimizeMatcherOrder(array $matchers): array { $computationalCostOrder = [ AnyMatcher::class, StaticMatcher::class, ExpressionMatcher::class, RegexMatcher::class, // Unknown types last SegmentMatcherContract::cla...
php
{ "resource": "" }
q262924
HttpExceptionServiceProvider.createHtmlDisplayer
test
public static function createHtmlDisplayer(ContainerInterface $container): HtmlDisplayer { return new HtmlDisplayer( $container->get(ResponseFactoryInterface::class), $container->get('config') ); }
php
{ "resource": "" }
q262925
HttpExceptionServiceProvider.createViewDisplayer
test
public static function createViewDisplayer(ContainerInterface $container): ViewDisplayer { return new ViewDisplayer( $container->get(ResponseFactoryInterface::class), $container->get(FactoryContract::class) ); }
php
{ "resource": "" }
q262926
HttpExceptionServiceProvider.createWhoopsPrettyDisplayer
test
public static function createWhoopsPrettyDisplayer(ContainerInterface $container): WhoopsPrettyDisplayer { return new WhoopsPrettyDisplayer( $container->get(ResponseFactoryInterface::class), $container->get('config') ); }
php
{ "resource": "" }
q262927
AbstractTransport.numberOfRecipients
test
protected function numberOfRecipients(Swift_Mime_SimpleMessage $message): int { $to = $message->getTo() ?? []; $cc = $message->getCc() ?? []; $bcc = $message->getBcc() ?? []; return \count(\array_merge($to, $cc, $bcc)); }
php
{ "resource": "" }
q262928
Kernel.bootstrap
test
public function bootstrap(): void { $container = $this->getContainer(); $bootstrapManager = $container->get(BootstrapManager::class); if (! $bootstrapManager->hasBeenBootstrapped()) { $bootstraps = []; foreach ($this->getPreparedBootstraps() as $classes) { ...
php
{ "resource": "" }
q262929
Kernel.handleRequest
test
protected function handleRequest( ServerRequestInterface $serverRequest, ?EventManagerContract $events ): ResponseInterface { try { if ($events !== null) { $events->trigger(new KernelFinishRequestEvent($this, $serverRequest)); } $response ...
php
{ "resource": "" }
q262930
Kernel.renderException
test
protected function renderException(ServerRequestInterface $request, Throwable $exception): ResponseInterface { $container = $this->getContainer(); if ($container->has(HttpHandlerContract::class)) { return $container->get(HttpHandlerContract::class)->render($request, $exception); ...
php
{ "resource": "" }
q262931
Kernel.pipeRequestThroughMiddlewareAndRouter
test
protected function pipeRequestThroughMiddlewareAndRouter( ServerRequestInterface $request, RouterContract $router ): ResponseInterface { $container = $this->getContainer(); return (new RoutingPipeline()) ->setContainer($container) ->send($request) ...
php
{ "resource": "" }
q262932
Schedule.compileParameters
test
protected function compileParameters(array $parameters): string { $keys = \array_keys($parameters); $items = \array_map(static function ($value, $key) { if (\is_array($value)) { $value = \array_map('escapeshellarg', $value); $value = \implode(' ', $value...
php
{ "resource": "" }
q262933
Container.offsetSet
test
public function offsetSet($offset, $value): void { if (\is_string($value)) { $this->bindPlain($offset, $value); } else { $this->bindService($offset, $value); } }
php
{ "resource": "" }
q262934
Container.getInvoker
test
protected function getInvoker(): InvokerInterface { if (! $this->invoker) { $parameterResolver = [ new NumericArrayResolver(), new AssociativeArrayResolver(), new DefaultValueResolver(), new TypeHintContainerResolver($this), ...
php
{ "resource": "" }
q262935
Container.bindPlain
test
protected function bindPlain(string $abstract, $concrete): void { $this->bindings[$abstract] = [ TypesContract::VALUE => $concrete, TypesContract::IS_RESOLVED => false, TypesContract::BINDING_TYPE => TypesContract::PLAIN, ]; }
php
{ "resource": "" }
q262936
Container.bindService
test
protected function bindService(string $abstract, $concrete): void { $this->bindings[$abstract] = [ TypesContract::VALUE => $concrete, TypesContract::IS_RESOLVED => false, TypesContract::BINDING_TYPE => TypesContract::SERVICE, ]; }
php
{ "resource": "" }
q262937
Container.bindSingleton
test
protected function bindSingleton(string $abstract, $concrete): void { $this->bindings[$abstract] = [ TypesContract::VALUE => $concrete, TypesContract::IS_RESOLVED => false, TypesContract::BINDING_TYPE => TypesContract::SINGLETON, ]; }
php
{ "resource": "" }
q262938
Container.resolvePlain
test
protected function resolvePlain(string $abstract) { $binding = &$this->bindings[$abstract]; $binding[TypesContract::IS_RESOLVED] = true; return $binding[TypesContract::VALUE]; }
php
{ "resource": "" }
q262939
Container.resolveService
test
protected function resolveService(string $abstract, array $parameters = []) { $binding = &$this->bindings[$abstract]; $binding[TypesContract::IS_RESOLVED] = true; return parent::resolve($binding[TypesContract::VALUE], $parameters); }
php
{ "resource": "" }
q262940
Container.resolveSingleton
test
protected function resolveSingleton(string $abstract, array $parameters = []) { $binding = &$this->bindings[$abstract]; $binding[TypesContract::VALUE] = parent::resolve($binding[TypesContract::VALUE], $parameters); $binding[TypesContract::IS_RESOLVED] = true; return $binding[...
php
{ "resource": "" }
q262941
Container.extendResolved
test
protected function extendResolved($abstract, &$resolved): void { if (! isset($this->extenders[$abstract])) { return; } $binding = $this->bindings[$abstract]; foreach ($this->extenders[$abstract] as $extender) { $resolved = $this->extendConcrete($resolved, $e...
php
{ "resource": "" }
q262942
Container.contextualBindingFormat
test
protected function contextualBindingFormat($implementation, ReflectionClass $parameterClass) { if ($implementation instanceof Closure || $implementation instanceof $parameterClass->name) { return $implementation; } return static function (ContainerContract $container) use ($impl...
php
{ "resource": "" }
q262943
PostmarkTransport.getMessageId
test
protected function getMessageId(?ResponseInterface $response): string { if ($response === null) { return ''; } $content = \json_decode($response->getBody()->getContents(), true); return $content['MessageID']; }
php
{ "resource": "" }
q262944
PostmarkTransport.convertEmailsArray
test
protected function convertEmailsArray(array $emails): array { $convertedEmails = []; foreach ($emails as $email => $name) { $convertedEmails[] = $name ? '"' . \str_replace('"', '\\"', $name) . "\" <{$email}>" : $email; } return $convertedEmails; ...
php
{ "resource": "" }
q262945
PostmarkTransport.getMIMEPart
test
protected function getMIMEPart(Swift_Mime_SimpleMessage $message, $mimeType): ?Swift_Mime_SimpleMimeEntity { foreach ($message->getChildren() as $part) { if (! ($part instanceof Swift_Mime_Attachment) && \mb_strpos($part->getContentType(), $mimeType) === 0) { return $part; ...
php
{ "resource": "" }
q262946
PostmarkTransport.getMessagePayload
test
protected function getMessagePayload(Swift_Mime_SimpleMessage $message): array { $payload = []; $payload = $this->processRecipients($payload, $message); $payload = $this->processMessageParts($payload, $message); return $this->processHeaders($payload, $message); }
php
{ "resource": "" }
q262947
PostmarkTransport.processRecipients
test
protected function processRecipients(array $payload, Swift_Mime_SimpleMessage $message): array { $payload['From'] = \implode(',', $this->convertEmailsArray($message->getFrom())); $payload['To'] = \implode(',', $this->convertEmailsArray($message->getTo())); $payload['Subject'] = $mess...
php
{ "resource": "" }
q262948
PostmarkTransport.processMessageParts
test
protected function processMessageParts(array $payload, Swift_Mime_SimpleMessage $message): array { //Get the primary message. switch ($message->getContentType()) { case 'text/html': case 'multipart/mixed': case 'multipart/related': case 'multipart/alte...
php
{ "resource": "" }
q262949
PostmarkTransport.processHeaders
test
protected function processHeaders(array $payload, Swift_Mime_SimpleMessage $message): array { $headers = []; foreach ($message->getHeaders()->getAll() as $key => $value) { $fieldName = $value->getFieldName(); $excludedHeaders = ['Subject', 'Content-Type', 'MIME-Version...
php
{ "resource": "" }
q262950
ServerCommandRequirementsCheckTrait.checkRequirements
test
protected function checkRequirements(): int { if ($this->documentRoot === null) { if ($this->hasOption('docroot')) { $this->documentRoot = $this->option('docroot'); } else { $this->error('The document root directory must be either passed as first argum...
php
{ "resource": "" }
q262951
ViewFactory.getExtension
test
protected function getExtension(string $path): ?string { $callback = function ($value) use ($path) { return $this->endsWith($path, $value); }; foreach (\array_keys(self::$extensions) as $key => $value) { if ($callback($value)) { return $value; ...
php
{ "resource": "" }
q262952
ViewFactory.getView
test
protected function getView( FactoryContract $factory, EngineContract $engine, string $view, array $fileInfo, $data = [] ): View { return new View($factory, $engine, $view, $fileInfo, $data); }
php
{ "resource": "" }
q262953
ViewFactory.endsWith
test
private function endsWith(string $haystack, string $needle): bool { $length = \mb_strlen($needle); if ($length === 0) { return true; } return \mb_substr($haystack, -$length) === $needle; }
php
{ "resource": "" }
q262954
RequestCookies.renderIntoCookieHeader
test
public function renderIntoCookieHeader(ServerRequestInterface $request): ServerRequestInterface { $cookieString = \implode('; ', $this->cookies); return $request->withHeader('cookie', $cookieString); }
php
{ "resource": "" }
q262955
RequestCookies.listFromCookieString
test
protected static function listFromCookieString(string $string): array { $cookies = self::splitOnAttributeDelimiter($string); return \array_map(static function ($cookiePair) { return self::oneFromCookiePair($cookiePair); }, $cookies); }
php
{ "resource": "" }
q262956
ConsoleErrorEvent.setError
test
public function setError(Throwable $error): void { $this->parameters['error'] = $error; $this->parameters['exit_code'] = $error->getCode() ?: 1; }
php
{ "resource": "" }
q262957
ConsoleErrorEvent.setExitCode
test
public function setExitCode(int $exitCode): void { $this->parameters['exit_code'] = $exitCode; $r = new ReflectionProperty($this->parameters['error'], 'code'); $r->setAccessible(true); $r->setValue($this->parameters['error'], $this->parameters['exit_code']); }
php
{ "resource": "" }
q262958
UrlGenerator.toRoute
test
protected function toRoute(RouteContract $route, array $parameters, int $referenceType): string { $path = $this->prepareRoutePath($route, $parameters); $uri = $this->uriFactory->createUri('/' . \ltrim($path, '/')); if (($host = $route->getDomain()) !== null) { $uri = $uri->with...
php
{ "resource": "" }
q262959
UrlGenerator.prepareRoutePath
test
protected function prepareRoutePath(RouteContract $route, array $parameters): string { $parameters = \array_replace($route->getParameters(), $parameters); // First we will construct the entire URI including the root and query string. Once it // has been constructed, we'll make sure we don't...
php
{ "resource": "" }
q262960
UrlGenerator.isSchemeRequired
test
protected function isSchemeRequired(RouteContract $route): bool { $requiredSchemes = false; $requestScheme = $this->request->getUri()->getScheme(); if ($route->isHttpOnly()) { $requiredSchemes = $requestScheme !== 'http'; } elseif ($route->isHttpsOnly()) { ...
php
{ "resource": "" }
q262961
UrlGenerator.addPortAndSchemeToUri
test
protected function addPortAndSchemeToUri(UriInterface $uri, RouteContract $route): UriInterface { if ($route->isHttpOnly()) { $secure = 'http'; $port = 80; } elseif ($route->isHttpsOnly()) { $secure = 'https'; $port = 443; } else { ...
php
{ "resource": "" }
q262962
UrlGenerator.replaceRouteParameters
test
protected function replaceRouteParameters(string $path, array &$parameters): string { $path = $this->replaceNamedParameters($path, $parameters); $path = \preg_replace_callback('/\{.*?\}/', static function ($match) use (&$parameters) { if (\count($parameters) === 0 && ! (\substr($match[0...
php
{ "resource": "" }
q262963
UrlGenerator.replaceNamedParameters
test
protected function replaceNamedParameters(string $path, array &$parameters): string { return \preg_replace_callback('/\{(.*?)\??\}/', static function ($m) use (&$parameters) { if (isset($parameters[$m[1]]) && $parameters[$m[1]] !== '') { $parameter = $parameters[$m[1]]; ...
php
{ "resource": "" }
q262964
UrlGenerator.addQueryString
test
protected function addQueryString(string $uri, array $parameters): string { // If the URI has a fragment we will move it to the end of this URI since it will // need to come after any query string that may be added to the URL else it is // not going to be available. We will remove it then ap...
php
{ "resource": "" }
q262965
UrlGenerator.getRouteQueryString
test
protected function getRouteQueryString(array $parameters): string { // First we will get all of the string parameters that are remaining after we // have replaced the route wildcards. We'll then build a query string from // these string parameters then use it as a starting point for the rest...
php
{ "resource": "" }
q262966
Route.parseWhere
test
protected function parseWhere($name, ?string $expression): array { if (\is_string($name)) { return [$name => $expression]; } $arr = []; foreach ($name as $paramName) { $arr[$paramName] = $expression; } return $arr; }
php
{ "resource": "" }
q262967
Route.getControllerMiddleware
test
protected function getControllerMiddleware(): array { if (! $this->isControllerAction()) { return []; } $controller = $this->getController(); if (\method_exists($controller, 'gatherMiddleware')) { return $controller->gatherMiddleware(); } re...
php
{ "resource": "" }
q262968
Route.getControllerDisabledMiddleware
test
protected function getControllerDisabledMiddleware(): array { if (! $this->isControllerAction()) { return []; } $controller = $this->getController(); if (\method_exists($controller, 'gatherDisabledMiddleware')) { return $controller->gatherDisabledMiddleware(...
php
{ "resource": "" }
q262969
AbstractCookieCollector.add
test
public function add($cookie): self { if ($cookie instanceof Cookie || $cookie instanceof SetCookie) { $clone = clone $this; $clone->cookies[$cookie->getName()] = $cookie; return $clone; } throw new InvalidArgumentException(\s...
php
{ "resource": "" }
q262970
AbstractCookieCollector.splitCookiePair
test
protected static function splitCookiePair(string $string): array { $pairParts = \explode('=', $string, 2); if (\count($pairParts) === 1) { $pairParts[1] = ''; } return \array_map(static function ($part) { if ($part === null) { return ''; ...
php
{ "resource": "" }
q262971
InjectContentTypeTrait.injectContentType
test
private function injectContentType(string $contentType, array $headers): array { $hasContentType = \array_reduce(\array_keys($headers), static function ($carry, $item) { return $carry ?: (\strtolower($item) === 'content-type'); }, false); if (! $hasContentType) { $he...
php
{ "resource": "" }
q262972
Str.words
test
public static function words(string $value, int $words = 100, string $end = '...'): string { \preg_match('/^\s*+(?:\S++\s*+){1,' . $words . '}/u', $value, $matches); if (! isset($matches[0]) || \mb_strlen($value) === \mb_strlen($matches[0])) { return $value; } return \r...
php
{ "resource": "" }
q262973
Str.random
test
public static function random(int $length = 64, string $characters = CharacterType::PRINTABLE_ASCII): string { $str = ''; $l = self::length($characters) - 1; for ($i = 0; $i < $length; $i++) { $r = \random_int(0, $l); $str .= $characters[$r]; } ret...
php
{ "resource": "" }
q262974
Str.replaceFirst
test
public static function replaceFirst(string $search, string $replace, string $subject): string { if ($search === '') { return $subject; } $position = \mb_strpos($subject, $search); return self::replaceByPosition($subject, $replace, $position, $search); }
php
{ "resource": "" }
q262975
Str.replaceLast
test
public static function replaceLast(string $search, string $replace, string $subject): string { $position = \mb_strrpos($subject, $search); return self::replaceByPosition($subject, $replace, $position, $search); }
php
{ "resource": "" }
q262976
Str.replaceByPosition
test
private static function replaceByPosition(string $subject, string $replace, $position, string $search): string { if ($position !== false) { return \substr_replace($subject, $replace, $position, \mb_strlen($search)); } return $subject; }
php
{ "resource": "" }
q262977
AbstractCommand.getVerbosity
test
public function getVerbosity($level = null): int { if ($level === null) { return $this->verbosity; } if (isset($this->verbosityMap[$level])) { return $this->verbosityMap[$level]; } return (int) $level; }
php
{ "resource": "" }
q262978
AbstractCommand.run
test
public function run(InputInterface $input, OutputInterface $output): int { $this->input = $input; $this->output = new SymfonyStyle( $input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output ); return parent::run($input, $output)...
php
{ "resource": "" }
q262979
AbstractCommand.call
test
public function call(string $command, array $arguments = []): int { return $this->getApplication()->call($command, $arguments, $this->getOutput()); }
php
{ "resource": "" }
q262980
AbstractCommand.callSilent
test
public function callSilent(string $command, array $arguments = []): int { return $this->getApplication()->call($command, $arguments, new NullOutput()); }
php
{ "resource": "" }
q262981
AbstractCommand.argument
test
public function argument(?string $key = null) { if ($key === null) { return $this->input->getArguments(); } return $this->input->getArgument($key); }
php
{ "resource": "" }
q262982
AbstractCommand.option
test
public function option(?string $key = null) { if ($key === null) { return $this->input->getOptions(); } return $this->input->getOption($key); }
php
{ "resource": "" }
q262983
AbstractCommand.ask
test
public function ask(string $question, ?string $default = null): ?string { return $this->getOutput()->ask($question, $default); }
php
{ "resource": "" }
q262984
AbstractCommand.anticipate
test
public function anticipate(string $question, array $choices, string $default = null): ?string { return $this->askWithCompletion($question, $choices, $default); }
php
{ "resource": "" }
q262985
AbstractCommand.choice
test
public function choice( string $question, array $choices, ?string $default = null, $attempts = null, bool $multiple = false ): ?string { $question = new ChoiceQuestion($question, $choices, $default); $question->setMaxAttempts($attempts)->setMultisele...
php
{ "resource": "" }
q262986
AbstractCommand.table
test
public function table(array $headers, $rows, string $style = 'default', array $columnStyles = []): void { $table = new Table($this->output); if ($rows instanceof Arrayable) { $rows = $rows->toArray(); } $table->setHeaders($headers)->setRows($rows)->setStyle($style); ...
php
{ "resource": "" }
q262987
AbstractCommand.line
test
public function line(string $string, ?string $style = null, $verbosityLevel = null): void { $styledString = $style ? "<${style}>${string}</${style}>" : $string; $this->getOutput()->writeln($styledString, $this->getVerbosity($verbosityLevel)); }
php
{ "resource": "" }
q262988
AbstractCommand.info
test
public function info(string $string, $verbosityLevel = null): void { $this->line($string, 'info', $verbosityLevel); }
php
{ "resource": "" }
q262989
AbstractCommand.comment
test
public function comment(string $string, $verbosityLevel = null): void { $this->line($string, 'comment', $verbosityLevel); }
php
{ "resource": "" }
q262990
AbstractCommand.question
test
public function question(string $string, $verbosityLevel = null): void { $this->line($string, 'question', $verbosityLevel); }
php
{ "resource": "" }
q262991
AbstractCommand.error
test
public function error(string $string, $verbosityLevel = null): void { $this->line($string, 'error', $verbosityLevel); }
php
{ "resource": "" }
q262992
AbstractCommand.warn
test
public function warn(string $string, $verbosityLevel = null): void { if (! $this->getOutput()->getFormatter()->hasStyle('warning')) { $style = new OutputFormatterStyle('yellow'); $this->getOutput()->getFormatter()->setStyle('warning', $style); } $this->line($string, ...
php
{ "resource": "" }
q262993
AbstractCommand.configureUsingFluentDefinition
test
private function configureUsingFluentDefinition(): void { $data = ExpressionParser::parse($this->signature); parent::__construct($data['name']); foreach ($data['arguments'] as $argument) { $this->getDefinition()->addArgument($argument); } foreach ($data['option...
php
{ "resource": "" }
q262994
AbstractCommand.specifyParameters
test
private function specifyParameters(): void { // We will loop through all of the arguments and options for the command and // set them all on the base command instance. This specifies what can get // passed into these commands as "parameters" to control the execution. foreach ($this->...
php
{ "resource": "" }
q262995
SparkPostTransport.getTransmissionId
test
protected function getTransmissionId(ResponseInterface $response): ?string { $object = \json_decode($response->getBody()->getContents()); foreach (['results', 'id'] as $segment) { if (! \is_object($object) || ! isset($object->{$segment})) { return null; } ...
php
{ "resource": "" }
q262996
SparkPostTransport.getRecipients
test
protected function getRecipients(Swift_Mime_SimpleMessage $message): array { $recipients = []; if ($message->getTo() !== null) { foreach ($message->getTo() as $email => $name) { $recipients[] = ['address' => \compact('name', 'email')]; } } if...
php
{ "resource": "" }
q262997
HtmlDisplayer.render
test
protected function render(array $info): string { $content = \file_get_contents($this->resolvedOptions['template_path']); foreach ($info as $key => $val) { $content = \str_replace("{{ $${key} }}", $val, $content); } return $content; }
php
{ "resource": "" }
q262998
ErrorHandler.addShouldntReport
test
public function addShouldntReport(Throwable $exception): HandlerContract { $this->dontReport[\get_class($exception)] = $exception; return $this; }
php
{ "resource": "" }
q262999
ErrorHandler.report
test
public function report(Throwable $exception): void { if ($this->shouldntReport($exception)) { return; } $level = $this->getLevel($exception); $id = ExceptionIdentifier::identify($exception); if ($exception instanceof FatalErrorException) { if ($ex...
php
{ "resource": "" }