_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q22300
Html.addBoleto
train
public function addBoleto(BoletoContract $boleto) { $dados = $boleto->toArray(); $dados['codigo_barras'] = $this->getImagemCodigoDeBarras($dados['codigo_barras']); $this->boleto[] = $dados; return $this; }
php
{ "resource": "" }
q22301
AbstractRetorno.toArray
train
public function toArray() { $array = [ 'header' => $this->header->toArray(), 'trailer' => $this->trailer->toArray(), 'detalhes' => new Collection() ]; foreach ($this->detalhe as $detalhe) { $array['detalhes']->push($detalhe->toArray()); ...
php
{ "resource": "" }
q22302
Bradesco.getCodigoCliente
train
public function getCodigoCliente() { if (empty($this->codigoCliente)) { $this->codigoCliente = Util::formatCnab('9', $this->getCarteiraNumero(), 4) . Util::formatCnab('9', $this->getAgencia(), 5) . Util::formatCnab('9', $this->getConta(), 7) . Util...
php
{ "resource": "" }
q22303
Pdf.addBoletos
train
public function addBoletos(array $boletos, $withGroup = true) { if ($withGroup) { $this->StartPageGroup(); } foreach ($boletos as $boleto) { $this->addBoleto($boleto); } return $this; }
php
{ "resource": "" }
q22304
AbstractBoleto.setJurosApos
train
public function setJurosApos($jurosApos) { $jurosApos = (int)$jurosApos; $this->jurosApos = $jurosApos > 0 ? $jurosApos : 0; return $this; }
php
{ "resource": "" }
q22305
AbstractBoleto.getCodigoBarras
train
public function getCodigoBarras() { if (!empty($this->campoCodigoBarras)) { return $this->campoCodigoBarras; } if (!$this->isValid($messages)) { throw new \Exception('Campos requeridos pelo banco, aparentam estar ausentes ' . $messages); } $codigo = ...
php
{ "resource": "" }
q22306
AbstractRemessa.getDataRemessa
train
public function getDataRemessa($format){ if(is_null($this->dataRemessa)){ return Carbon::now()->format($format); } return $this->dataRemessa->format($format); }
php
{ "resource": "" }
q22307
AbstractRemessa.download
train
public function download($filename = null) { if ($filename === null) { $filename = 'remessa.txt'; } header('Content-type: text/plain'); header('Content-Disposition: attachment; filename="' . $filename . '"'); echo $this->gerar(); }
php
{ "resource": "" }
q22308
AbstractRemessa.gerar
train
public function gerar() { if (!$this->isValid($messages)) { throw new \Exception('Campos requeridos pelo banco, aparentam estar ausentes ' . $messages); } $stringRemessa = ''; if ($this->iRegistros < 1) { throw new \Exception('Nenhuma linha detalhe foi adicio...
php
{ "resource": "" }
q22309
Bradesco.setCip
train
public function setCip($cip) { $this->cip = $cip; $this->variaveis_adicionais['cip'] = $this->getCip(); return $this; }
php
{ "resource": "" }
q22310
MangaReview.fromParser
train
public static function fromParser(MangaReviewParser $parser): MangaReview { $instance = new self(); $instance->malId = $parser->getId(); $instance->url = $parser->getUrl(); $instance->helpfulCount= $parser->getHelpfulCount(); $instance->date = $parser->getDate(); $in...
php
{ "resource": "" }
q22311
Parser.removeChildNodes
train
public static function removeChildNodes(Crawler $crawler): Crawler { if (!$crawler->count()) { return $crawler; } $crawler->children()->each( function (Crawler $crawler) { $node = $crawler->getNode(0); if ($node === null || $node->nodeT...
php
{ "resource": "" }
q22312
Manga.fromParser
train
public static function fromParser(MangaParser $parser): Manga { $instance = new self(); $instance->title = $parser->getMangaTitle(); $instance->url = $parser->getMangaURL(); $instance->malId = $parser->getMangaId(); $instance->imageUrl = $parser->getMangaImageURL(); ...
php
{ "resource": "" }
q22313
RegexPatternPolicy.generateRegex
train
private function generateRegex($stepText) { return preg_replace( array_keys(self::$replacePatterns), array_values(self::$replacePatterns), $this->escapeStepText($stepText) ); }
php
{ "resource": "" }
q22314
RegexPatternPolicy.countPlaceholders
train
private function countPlaceholders($stepText, $stepRegex) { preg_match('/^' . $stepRegex . '$/', $stepText, $matches); return count($matches) ? count($matches) - 1 : 0; }
php
{ "resource": "" }
q22315
ConsoleOutputFactory.getDefaultStyles
train
private function getDefaultStyles() { return array( 'keyword' => new OutputFormatterStyle(null, null, array('bold')), 'stdout' => new OutputFormatterStyle(null, null, array()), 'exception' => new OutputFormatterStyle('red'), 'undefined' =>...
php
{ "resource": "" }
q22316
OutlineTableListener.printExampleRowOnAfterExampleEvent
train
private function printExampleRowOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName) { if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) { return; } $example = $event->getScenario(); $this->exampleSetupPrinter->printSetup(...
php
{ "resource": "" }
q22317
OutlineTableListener.printFooterOnAfterEvent
train
private function printFooterOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterOutlineTested) { return; } $this->tablePrinter->printFooter($formatter, $event->getTestResult()); }
php
{ "resource": "" }
q22318
StepTextPainter.paintText
train
public function paintText($text, Definition $definition, TestResult $result) { $regex = $this->patternTransformer->transformPatternToRegex($definition->getPattern()); $style = $this->resultConverter->convertResultToString($result); $paramStyle = $style . '_param'; // If it's just a ...
php
{ "resource": "" }
q22319
PrettyOutlinePrinter.printExamplesSteps
train
private function printExamplesSteps(Formatter $formatter, OutlineNode $outline, array $steps) { foreach ($steps as $step) { $this->stepPrinter->printStep($formatter, $outline, $step, new UndefinedStepResult()); } $formatter->getOutputPrinter()->writeln(); }
php
{ "resource": "" }
q22320
PrettyOutlinePrinter.printExamplesTableHeader
train
private function printExamplesTableHeader(OutputPrinter $printer, ExampleTableNode $table) { $printer->writeln(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $table->getKeyword())); $rowNum = 0; $wrapper = $this->getWrapperClosure(); $row = $table->getRowAsStringWithWrapped...
php
{ "resource": "" }
q22321
PrettyOutlinePrinter.getWrapperClosure
train
private function getWrapperClosure() { $style = $this->resultConverter->convertResultCodeToString(TestResult::SKIPPED); return function ($col) use ($style) { return sprintf('{+%s_param}%s{-%s_param}', $style, $col, $style); }; }
php
{ "resource": "" }
q22322
ResultToStringConverter.convertResultCodeToString
train
public function convertResultCodeToString($resultCode) { switch ($resultCode) { case TestResult::SKIPPED: return 'skipped'; case TestResult::PENDING: return 'pending'; case TestResult::FAILED: return 'failed'; ca...
php
{ "resource": "" }
q22323
WidthCalculator.calculateScenarioWidth
train
public function calculateScenarioWidth(Scenario $scenario, $indentation, $subIndentation) { $length = $this->calculateScenarioHeaderWidth($scenario, $indentation); foreach ($scenario->getSteps() as $step) { $stepLength = $this->calculateStepWidth($step, $indentation + $subIndentation); ...
php
{ "resource": "" }
q22324
WidthCalculator.calculateExampleWidth
train
public function calculateExampleWidth(ExampleNode $example, $indentation, $subIndentation) { $length = $this->calculateScenarioHeaderWidth($example, $indentation); foreach ($example->getSteps() as $step) { $stepLength = $this->calculateStepWidth($step, $indentation + $subIndentation); ...
php
{ "resource": "" }
q22325
WidthCalculator.calculateScenarioHeaderWidth
train
public function calculateScenarioHeaderWidth(Scenario $scenario, $indentation) { $indentText = str_repeat(' ', intval($indentation)); if ($scenario instanceof ExampleNode) { $header = sprintf('%s%s', $indentText, $scenario->getTitle()); } else { $title = $scenario->g...
php
{ "resource": "" }
q22326
WidthCalculator.calculateStepWidth
train
public function calculateStepWidth(StepNode $step, $indentation) { $indentText = str_repeat(' ', intval($indentation)); $text = sprintf('%s%s %s', $indentText, $step->getKeyword(), $step->getText()); return mb_strlen($text, 'utf8'); }
php
{ "resource": "" }
q22327
TransformationExtension.loadDefinitionArgumentsTransformer
train
protected function loadDefinitionArgumentsTransformer(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Transformation\Call\Filter\DefinitionArgumentsTransformer'); $definition->addTag(CallExtension::CALL_FILTER_TAG, array('priority' => 200)); $container->setDefinition...
php
{ "resource": "" }
q22328
TransformationExtension.loadDefaultTransformers
train
protected function loadDefaultTransformers(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Transformation\Transformer\RepositoryArgumentTransformer', array( new Reference(self::REPOSITORY_ID), new Reference(CallExtension::CALL_CENTER_ID), new Refe...
php
{ "resource": "" }
q22329
TransformationExtension.loadRepository
train
protected function loadRepository(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Transformation\TransformationRepository', array( new Reference(EnvironmentExtension::MANAGER_ID) )); $container->setDefinition(self::REPOSITORY_ID, $definition); }
php
{ "resource": "" }
q22330
TransformationExtension.processArgumentsTransformers
train
protected function processArgumentsTransformers(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::ARGUMENT_TRANSFORMER_TAG); $definition = $container->getDefinition($this->getDefinitionArgumentTransformerId()); foreach ($references as...
php
{ "resource": "" }
q22331
FeatureContext.iRunBehatInteractively
train
public function iRunBehatInteractively($answerString, $argumentsString) { $env = $this->process->getEnv(); $env['SHELL_INTERACTIVE'] = true; $this->process->setEnv($env); $this->process->setInput($answerString); $this->options = '--format-settings=\'{"timer": false}\''; ...
php
{ "resource": "" }
q22332
FeatureContext.itShouldPassWith
train
public function itShouldPassWith($success, PyStringNode $text) { $this->itShouldFail($success); $this->theOutputShouldContain($text); }
php
{ "resource": "" }
q22333
FeatureContext.fileXmlShouldBeLike
train
public function fileXmlShouldBeLike($path, PyStringNode $text) { $path = $this->workingDir . '/' . $path; Assert::assertFileExists($path); $fileContent = trim(file_get_contents($path)); $fileContent = preg_replace('/time="(.*)"/', 'time="-IGNORE-VALUE-"', $fileContent); $d...
php
{ "resource": "" }
q22334
FeatureContext.xmlShouldBeValid
train
public function xmlShouldBeValid($xmlFile, $schemaPath) { $dom = new DomDocument(); $dom->load($this->workingDir . '/' . $xmlFile); $dom->schemaValidate(__DIR__ . '/schema/' . $schemaPath); }
php
{ "resource": "" }
q22335
HookExtension.loadAnnotationReader
train
private function loadAnnotationReader(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Hook\Context\Annotation\HookAnnotationReader'); $definition->addTag(ContextExtension::ANNOTATION_READER_TAG, array('priority' => 50)); $container->setDefinition(ContextExtension::AN...
php
{ "resource": "" }
q22336
PrettyFormatterFactory.loadRootNodeListener
train
protected function loadRootNodeListener(ContainerBuilder $container) { $definition = new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( array( new Definition('Behat\Behat\Output\Node\EventListener\AST\SuiteListener', array( ne...
php
{ "resource": "" }
q22337
PrettyFormatterFactory.loadTableOutlinePrinter
train
protected function loadTableOutlinePrinter(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyOutlineTablePrinter', array( new Reference('output.node.printer.pretty.scenario'), new Reference('output.node.printer.pretty.skipped_st...
php
{ "resource": "" }
q22338
PrettyFormatterFactory.loadHookPrinters
train
protected function loadHookPrinters(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array( new Reference(self::RESULT_TO_STRING_CONVERTER_ID), new Reference(ExceptionExtension::PRESENTER_ID), 0, ...
php
{ "resource": "" }
q22339
PrettyFormatterFactory.processListenerWrappers
train
protected function processListenerWrappers(ContainerBuilder $container) { $this->processor->processWrapperServices($container, self::ROOT_LISTENER_ID, self::ROOT_LISTENER_WRAPPER_TAG); }
php
{ "resource": "" }
q22340
TotalStatistics.registerScenarioStat
train
public function registerScenarioStat(ScenarioStat $stat) { if (TestResults::NO_TESTS === $stat->getResultCode()) { return; } $this->scenarioCounters[$stat->getResultCode()]++; if (TestResult::FAILED === $stat->getResultCode()) { $this->failedScenarioStats[] ...
php
{ "resource": "" }
q22341
TotalStatistics.registerStepStat
train
public function registerStepStat(StepStat $stat) { $this->stepCounters[$stat->getResultCode()]++; if (TestResult::FAILED === $stat->getResultCode()) { $this->failedStepStats[] = $stat; } if (TestResult::PENDING === $stat->getResultCode()) { $this->pendingSte...
php
{ "resource": "" }
q22342
HelperContainerExtension.isDefinitionShared
train
private function isDefinitionShared(Definition $definition) { if (method_exists($definition, 'isShared')) { return $definition->isShared(); } else if (method_exists($definition, 'getScope')) { return $definition->getScope() !== ContainerBuilder::SCOPE_PROTOTYPE; } ...
php
{ "resource": "" }
q22343
ConsoleDefinitionInformationPrinter.extractHeader
train
private function extractHeader(Suite $suite, Definition $definition) { $pattern = $definition->getPattern(); $lines = array(); $lines[] = strtr( '{suite} <def_dimmed>|</def_dimmed> <info>{type}</info> <def_regex>{regex}</def_regex>', array( '{suite}' => $suite->ge...
php
{ "resource": "" }
q22344
ConsoleDefinitionInformationPrinter.extractDescription
train
private function extractDescription(Suite $suite, Definition $definition) { $definition = $this->translateDefinition($suite, $definition); $lines = array(); if ($description = $definition->getDescription()) { foreach (explode("\n", $description) as $descriptionLine) { ...
php
{ "resource": "" }
q22345
ConsoleDefinitionInformationPrinter.extractFooter
train
private function extractFooter(Suite $suite, Definition $definition) { $lines = array(); $lines[] = strtr( '{space}<def_dimmed>|</def_dimmed> at `{path}`', array( '{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1), '{path}' => $definition-...
php
{ "resource": "" }
q22346
CounterPrinter.printCounters
train
public function printCounters(OutputPrinter $printer, $intro, array $stats) { $stats = array_filter($stats, function ($count) { return 0 !== $count; }); if (0 === count($stats)) { $totalCount = 0; } else { $totalCount = array_sum($stats); } $detailed...
php
{ "resource": "" }
q22347
ConsoleDefinitionPrinter.translateDefinition
train
final protected function translateDefinition(Suite $suite, Definition $definition) { return $this->translator->translateDefinition($suite, $definition); }
php
{ "resource": "" }
q22348
PrettyPathPrinter.printScenarioPath
train
public function printScenarioPath(Formatter $formatter, FeatureNode $feature, Scenario $scenario, $indentation) { $printer = $formatter->getOutputPrinter(); if (!$formatter->getParameter('paths')) { $printer->writeln(); return; } $fileAndLine = sprintf('%s:...
php
{ "resource": "" }
q22349
PrettyPathPrinter.printStepPath
train
public function printStepPath( Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result, $indentation ) { $printer = $formatter->getOutputPrinter(); if (!$result instanceof DefinedStepResult || !$result->getStepDefinition() || !$formatter-...
php
{ "resource": "" }
q22350
PrettyPathPrinter.printDefinedStepPath
train
private function printDefinedStepPath(OutputPrinter $printer, DefinedStepResult $result, $scenarioWidth, $stepWidth) { $path = $result->getStepDefinition()->getPath(); $spacing = str_repeat(' ', max(0, $scenarioWidth - $stepWidth)); $printer->writeln(sprintf('%s {+comment}# %s{-comment}', $...
php
{ "resource": "" }
q22351
PrettyPathPrinter.relativizePaths
train
private function relativizePaths($path) { if (!$this->basePath) { return $path; } return str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path); }
php
{ "resource": "" }
q22352
ReturnTypeTransformation.getReturnClass
train
static private function getReturnClass(ReflectionFunctionAbstract $reflection) { $type = $reflection->getReturnType(); if (null === $type || $type->isBuiltin()) { return null; } return (string) $type; }
php
{ "resource": "" }
q22353
ReturnTypeTransformation.hasIndex
train
private function hasIndex($index) { return is_string($index) ? $this->hasName($index) : $this->hasPosition($index); }
php
{ "resource": "" }
q22354
DefinitionTranslator.translateDefinition
train
public function translateDefinition(Suite $suite, Definition $definition, $language = null) { $assetsId = $suite->getName(); $pattern = $definition->getPattern(); $translatedPattern = $this->translator->trans($pattern, array(), $assetsId, $language); if ($pattern != $translatedPatte...
php
{ "resource": "" }
q22355
PrettySkippedStepPrinter.getArgumentString
train
private function getArgumentString(ArgumentInterface $argument, $collapse = false) { if ($collapse) { return '...'; } if ($argument instanceof PyStringNode) { $text = '"""' . "\n" . $argument . "\n" . '"""'; return $text; } return (strin...
php
{ "resource": "" }
q22356
ContextFactory.createContext
train
public function createContext($class, array $arguments = array(), array $singleUseResolvers = array()) { $reflection = new ReflectionClass($class); $resolvers = array_merge($singleUseResolvers, $this->argumentResolvers); $resolvedArguments = $this->resolveArguments($reflection, $arguments, $...
php
{ "resource": "" }
q22357
ContextFactory.resolveArguments
train
private function resolveArguments(ReflectionClass $reflection, array $arguments, array $resolvers) { $newArguments = $arguments; foreach ($resolvers as $resolver) { $newArguments = $resolver->resolveArguments($reflection, $newArguments); } if (!$reflection->hasMethod('_...
php
{ "resource": "" }
q22358
ContextFactory.createInstance
train
private function createInstance(ReflectionClass $reflection, array $arguments) { if (count($arguments)) { return $reflection->newInstanceArgs($arguments); } return $reflection->newInstance(); }
php
{ "resource": "" }
q22359
ContextFactory.initializeInstance
train
private function initializeInstance(Context $context) { foreach ($this->contextInitializers as $initializer) { $initializer->initializeContext($context); } }
php
{ "resource": "" }
q22360
TurnipPatternPolicy.replaceTokensWithRegexCaptureGroups
train
private function replaceTokensWithRegexCaptureGroups($regex) { $tokenRegex = self::TOKEN_REGEX; return preg_replace_callback( self::PLACEHOLDER_REGEXP, array($this, 'replaceTokenWithRegexCaptureGroup'), $regex ); }
php
{ "resource": "" }
q22361
TurnipPatternPolicy.replaceTurnipAlternativeWordsWithRegex
train
private function replaceTurnipAlternativeWordsWithRegex($regex) { $regex = preg_replace(self::ALTERNATIVE_WORD_REGEXP, '(?:\1|\2)', $regex); $regex = $this->removeEscapingOfAlternationSyntax($regex); return $regex; }
php
{ "resource": "" }
q22362
PrettyExamplePrinter.printTitle
train
private function printTitle(OutputPrinter $printer, ExampleNode $example) { $printer->write(sprintf('%s%s', $this->indentText, $example->getTitle())); }
php
{ "resource": "" }
q22363
DefinitionWriter.printSuiteDefinitions
train
public function printSuiteDefinitions(DefinitionPrinter $printer, $suite) { $environment = $this->environmentManager->buildEnvironment($suite); $definitions = $this->repository->getEnvironmentDefinitions($environment); $printer->printDefinitions($suite, $definitions); }
php
{ "resource": "" }
q22364
OnlyFirstBackgroundFiresListener.flushStatesIfBeginningOfTheFeature
train
private function flushStatesIfBeginningOfTheFeature($eventName) { if (FeatureTested::BEFORE !== $eventName) { return; } $this->firstBackgroundEnded = false; $this->inBackground = false; }
php
{ "resource": "" }
q22365
OnlyFirstBackgroundFiresListener.markBeginningOrEndOfTheBackground
train
private function markBeginningOrEndOfTheBackground($eventName) { if (BackgroundTested::BEFORE === $eventName) { $this->inBackground = true; } if (BackgroundTested::AFTER === $eventName) { $this->inBackground = false; } }
php
{ "resource": "" }
q22366
OnlyFirstBackgroundFiresListener.isSkippableEvent
train
private function isSkippableEvent(Event $event) { if (!$this->firstBackgroundEnded) { return false; } return $event instanceof BackgroundTested || $this->isNonFailingConsequentBackgroundStep($event); }
php
{ "resource": "" }
q22367
OnlyFirstBackgroundFiresListener.isBeforeStepEventWithOutput
train
private function isBeforeStepEventWithOutput(Event $event) { if ($event instanceof AfterStepSetup && $event->hasOutput()) { $this->stepSetupHadOutput = true; return true; } return false; }
php
{ "resource": "" }
q22368
OnlyFirstBackgroundFiresListener.isAfterStepWithOutput
train
private function isAfterStepWithOutput(Event $event) { if ($event instanceof AfterStepTested && ($this->stepSetupHadOutput || $event->hasOutput())) { $this->stepSetupHadOutput = false; return true; } return false; }
php
{ "resource": "" }
q22369
AnnotatedContextReader.readMethodCallees
train
private function readMethodCallees($class, ReflectionMethod $method) { $callees = array(); // read parent annotations try { $prototype = $method->getPrototype(); // error occurs on every second PHP stable release - getPrototype() returns itself if ($proto...
php
{ "resource": "" }
q22370
AnnotatedContextReader.readDocBlockCallees
train
private function readDocBlockCallees($class, ReflectionMethod $method, $docBlock) { $callees = array(); $description = $this->readDescription($docBlock); $docBlock = $this->mergeMultilines($docBlock); foreach (explode("\n", $docBlock) as $docLine) { $docLine = preg_repla...
php
{ "resource": "" }
q22371
AnnotatedContextReader.readDescription
train
private function readDescription($docBlock) { // Remove indentation $description = preg_replace('/^[\s\t]*/m', '', $docBlock); // Remove block comment syntax $description = preg_replace('/^\/\*\*\s*|^\s*\*\s|^\s*\*\/$/m', '', $description); // Remove annotations $de...
php
{ "resource": "" }
q22372
AnnotatedContextReader.readDocLineCallee
train
private function readDocLineCallee($class, ReflectionMethod $method, $docLine, $description = null) { if ($this->isIgnoredAnnotation($docLine)) { return null; } foreach ($this->readers as $reader) { if ($callee = $reader->readCallee($class, $method, $docLine, $descri...
php
{ "resource": "" }
q22373
AnnotatedContextReader.isIgnoredAnnotation
train
private function isIgnoredAnnotation($docLine) { $lowDocLine = strtolower($docLine); foreach (self::$ignoreAnnotations as $ignoredAnnotation) { if ($ignoredAnnotation == substr($lowDocLine, 0, strlen($ignoredAnnotation))) { return true; } } re...
php
{ "resource": "" }
q22374
ContextExtension.loadFactory
train
private function loadFactory(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Context\ContextFactory', array( new Reference(ArgumentExtension::CONSTRUCTOR_ARGUMENT_ORGANISER_ID) )); $container->setDefinition(self::FACTORY_ID, $definition); }
php
{ "resource": "" }
q22375
ContextExtension.loadArgumentResolverFactory
train
private function loadArgumentResolverFactory(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Context\Argument\CompositeArgumentResolverFactory'); $container->setDefinition(self::AGGREGATE_RESOLVER_FACTORY_ID, $definition); }
php
{ "resource": "" }
q22376
ContextExtension.loadEnvironmentHandler
train
private function loadEnvironmentHandler(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler', array( new Reference(self::FACTORY_ID), new Reference(self::AGGREGATE_RESOLVER_FACTORY_ID) )); $def...
php
{ "resource": "" }
q22377
ContextExtension.loadEnvironmentReader
train
private function loadEnvironmentReader(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Context\Environment\Reader\ContextEnvironmentReader'); $definition->addTag(EnvironmentExtension::READER_TAG, array('priority' => 50)); $container->setDefinition(self::getEnvironmen...
php
{ "resource": "" }
q22378
ContextExtension.loadSuiteSetup
train
private function loadSuiteSetup(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Context\Suite\Setup\SuiteWithContextsSetup', array( new Reference(AutoloaderExtension::CLASS_LOADER_ID), new Reference(FilesystemExtension::LOGGER_ID) )); $definit...
php
{ "resource": "" }
q22379
ContextExtension.loadSnippetAppender
train
private function loadSnippetAppender(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Context\Snippet\Appender\ContextSnippetAppender', array( new Reference(FilesystemExtension::LOGGER_ID) )); $definition->addTag(SnippetExtension::APPENDER_TAG, array('prio...
php
{ "resource": "" }
q22380
ContextExtension.loadSnippetGenerators
train
private function loadSnippetGenerators(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Context\Snippet\Generator\ContextSnippetGenerator', array( new Reference(DefinitionExtension::PATTERN_TRANSFORMER_ID) )); $definition->addTag(SnippetExtension::GENERATO...
php
{ "resource": "" }
q22381
ContextExtension.loadDefaultClassGenerators
train
private function loadDefaultClassGenerators(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Context\ContextClass\SimpleClassGenerator'); $definition->addTag(self::CLASS_GENERATOR_TAG, array('priority' => 50)); $container->setDefinition(self::CLASS_GENERATOR_TAG . '.s...
php
{ "resource": "" }
q22382
ContextExtension.loadDefaultContextReaders
train
private function loadDefaultContextReaders(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Context\Reader\AnnotatedContextReader'); $container->setDefinition(self::getAnnotatedContextReaderId(), $definition); $definition = new Definition('Behat\Behat\Context\Reader\...
php
{ "resource": "" }
q22383
ContextExtension.processClassResolvers
train
private function processClassResolvers(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::CLASS_RESOLVER_TAG); $definition = $container->getDefinition(self::getEnvironmentHandlerId()); foreach ($references as $reference) { ...
php
{ "resource": "" }
q22384
ContextExtension.processArgumentResolverFactories
train
private function processArgumentResolverFactories($container) { $references = $this->processor->findAndSortTaggedServices($container, self::SUITE_SCOPED_RESOLVER_FACTORY_TAG); $definition = $container->getDefinition(self::AGGREGATE_RESOLVER_FACTORY_ID); foreach ($references as $reference) {...
php
{ "resource": "" }
q22385
ContextExtension.processArgumentResolvers
train
private function processArgumentResolvers(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::ARGUMENT_RESOLVER_TAG); $definition = $container->getDefinition(self::FACTORY_ID); foreach ($references as $reference) { $definiti...
php
{ "resource": "" }
q22386
ContextExtension.processContextInitializers
train
private function processContextInitializers(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::INITIALIZER_TAG); $definition = $container->getDefinition(self::FACTORY_ID); foreach ($references as $reference) { $definition->...
php
{ "resource": "" }
q22387
ContextExtension.processContextReaders
train
private function processContextReaders(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::READER_TAG); $definition = $container->getDefinition(self::getEnvironmentReaderId()); foreach ($references as $reference) { $definiti...
php
{ "resource": "" }
q22388
ContextExtension.processClassGenerators
train
private function processClassGenerators(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::CLASS_GENERATOR_TAG); $definition = $container->getDefinition(self::getSuiteSetupId()); foreach ($references as $reference) { $defin...
php
{ "resource": "" }
q22389
ContextExtension.processAnnotationReaders
train
private function processAnnotationReaders(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::ANNOTATION_READER_TAG); $definition = $container->getDefinition(self::getAnnotatedContextReaderId()); foreach ($references as $reference) { ...
php
{ "resource": "" }
q22390
PatternTransformer.generatePattern
train
public function generatePattern($type, $stepText) { foreach ($this->policies as $policy) { if ($policy->supportsPatternType($type)) { return $policy->generatePattern($stepText); } } throw new UnsupportedPatternTypeException(sprintf('Can not find polic...
php
{ "resource": "" }
q22391
PatternTransformer.transformPatternToRegex
train
public function transformPatternToRegex($pattern) { if (!isset($this->patternToRegexpCache[$pattern])) { $this->patternToRegexpCache[$pattern] = $this->transformPatternToRegexWithSupportedPolicy($pattern); } return $this->patternToRegexpCache[$pattern]; }
php
{ "resource": "" }
q22392
SuiteWithPathsSetup.createFeatureDirectory
train
private function createFeatureDirectory($path) { mkdir($path, 0777, true); if ($this->logger) { $this->logger->directoryCreated($path, 'place your *.feature files here'); } }
php
{ "resource": "" }
q22393
SuiteWithPathsSetup.locatePath
train
private function locatePath($path) { if ($this->isAbsolutePath($path)) { return $path; } return $this->basePath . DIRECTORY_SEPARATOR . $path; }
php
{ "resource": "" }
q22394
ServicesResolver.filterCall
train
public function filterCall(Call $call) { if ($container = $this->getContainer($call)) { $autowirer = new ArgumentAutowirer($container); $newArguments = $autowirer->autowireArguments($call->getCallee()->getReflection(), $call->getArguments()); return $this->repackageCallI...
php
{ "resource": "" }
q22395
ServicesResolver.getContainer
train
private function getContainer(Call $call) { if (!$call instanceof EnvironmentCall) { throw new UnsupportedCallException(sprintf( 'ServicesResolver can not filter `%s` call.', get_class($call) ), $call); } $environment = $call->getEnvir...
php
{ "resource": "" }
q22396
ServicesResolver.repackageCallIfNewArguments
train
private function repackageCallIfNewArguments(Call $call, array $arguments) { if ($arguments === $call->getArguments()) { return $call; } return $this->repackageCallWithNewArguments($call, $arguments); }
php
{ "resource": "" }
q22397
ServicesResolver.repackageCallWithNewArguments
train
private function repackageCallWithNewArguments(Call $call, array $newArguments) { if ($call instanceof DefinitionCall) { return $this->repackageDefinitionCall($call, $newArguments); } if ($call instanceof TransformationCall) { return $this->repackageTransformationCal...
php
{ "resource": "" }
q22398
ServicesResolver.repackageDefinitionCall
train
private function repackageDefinitionCall(DefinitionCall $call, array $newArguments) { $definition = $call->getCallee(); if (!$definition instanceof Definition) { throw new UnsupportedCallException( sprintf( 'Something is wrong in callee associated wit...
php
{ "resource": "" }
q22399
ServicesResolver.repackageTransformationCall
train
private function repackageTransformationCall(TransformationCall $call, array $newArguments) { $transformation = $call->getCallee(); if (!$transformation instanceof Transformation) { throw new UnsupportedCallException( sprintf( 'Something is wrong in c...
php
{ "resource": "" }