_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q22400
LazyFeatureIterator.getSuiteFilters
train
private function getSuiteFilters(Suite $suite) { if (!$suite->hasSetting('filters') || !is_array($suite->getSetting('filters'))) { return array();
php
{ "resource": "" }
q22401
LazyFeatureIterator.createFilter
train
private function createFilter($type, $filterString, Suite $suite) { if ('role' === $type) { return new RoleFilter($filterString); } if ('name' === $type) { return new NameFilter($filterString); } if ('tags' === $type) { return new TagFilt...
php
{ "resource": "" }
q22402
LazyFeatureIterator.moveToNextAvailableFeature
train
private function moveToNextAvailableFeature() { while (!count($this->features) && $this->position < count($this->paths)) { $this->features = $this->parseFeature($this->paths[$this->position]);
php
{ "resource": "" }
q22403
GherkinExtension.loadParameters
train
private function loadParameters(ContainerBuilder $container) { $container->setParameter('gherkin.paths.lib', $this->getLibPath()); $container->setParameter('gherkin.paths.i18n', '%gherkin.paths.lib%/i18n.php'); $container->setParameter( 'suite.generic.default_settings', ...
php
{ "resource": "" }
q22404
GherkinExtension.getLibPath
train
private function getLibPath() { $reflection = new ReflectionClass('Behat\Gherkin\Gherkin'); $libPath
php
{ "resource": "" }
q22405
GherkinExtension.loadGherkin
train
private function loadGherkin(ContainerBuilder $container) { $definition = new Definition('Behat\Gherkin\Gherkin');
php
{ "resource": "" }
q22406
GherkinExtension.loadKeywords
train
private function loadKeywords(ContainerBuilder $container) { $definition = new Definition('Behat\Gherkin\Keywords\CachedArrayKeywords', array( '%gherkin.paths.i18n%' )); $container->setDefinition(self::KEYWORDS_ID, $definition);
php
{ "resource": "" }
q22407
GherkinExtension.loadParser
train
private function loadParser(ContainerBuilder $container) { $definition = new Definition('Behat\Gherkin\Parser', array( new Reference('gherkin.lexer') )); $container->setDefinition('gherkin.parser', $definition);
php
{ "resource": "" }
q22408
GherkinExtension.loadDefaultLoaders
train
private function loadDefaultLoaders(ContainerBuilder $container, $cachePath) { $definition = new Definition('Behat\Gherkin\Loader\GherkinFileLoader', array( new Reference('gherkin.parser') )); if ($cachePath) { $cacheDefinition = new Definition('Behat\Gherkin\Cache\F...
php
{ "resource": "" }
q22409
GherkinExtension.loadProfileFilters
train
private function loadProfileFilters(ContainerBuilder $container, array $filters) { $gherkin = $container->getDefinition(self::MANAGER_ID); foreach ($filters as $type => $filterString) {
php
{ "resource": "" }
q22410
GherkinExtension.loadSyntaxController
train
private function loadSyntaxController(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Gherkin\Cli\SyntaxController', array( new Reference(self::KEYWORDS_DUMPER_ID),
php
{ "resource": "" }
q22411
GherkinExtension.loadFilterController
train
private function loadFilterController(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Gherkin\Cli\FilterController', array( new Reference(self::MANAGER_ID)
php
{ "resource": "" }
q22412
GherkinExtension.loadSuiteWithPathsSetup
train
private function loadSuiteWithPathsSetup(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Gherkin\Suite\Setup\SuiteWithPathsSetup', array( '%paths.base%', new Reference(FilesystemExtension::LOGGER_ID) ));
php
{ "resource": "" }
q22413
GherkinExtension.loadFilesystemFeatureLocator
train
private function loadFilesystemFeatureLocator(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Gherkin\Specification\Locator\FilesystemFeatureLocator', array( new Reference(self::MANAGER_ID), '%paths.base%' ));
php
{ "resource": "" }
q22414
GherkinExtension.processLoaders
train
private function processLoaders(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::LOADER_TAG); $definition = $container->getDefinition(self::MANAGER_ID);
php
{ "resource": "" }
q22415
GherkinExtension.createFilterDefinition
train
private function createFilterDefinition($type, $filterString) { if ('role' === $type) { return new Definition('Behat\Gherkin\Filter\RoleFilter', array($filterString)); } if ('name' === $type) { return new Definition('Behat\Gherkin\Filter\NameFilter', array($filterStr...
php
{ "resource": "" }
q22416
FilesystemFeatureLocator.getSuitePaths
train
private function getSuitePaths(Suite $suite) { if (!is_array($suite->getSetting('paths'))) { throw new SuiteConfigurationException( sprintf('`paths` setting of the "%s" suite is expected to be an array, %s given.', $suite->getName(),
php
{ "resource": "" }
q22417
FilesystemFeatureLocator.findFeatureFiles
train
private function findFeatureFiles($path) { $absolutePath = $this->findAbsolutePath($path); if (!$absolutePath) { return array($path); } if (is_file($absolutePath)) { return array($absolutePath); } $iterator = new RegexIterator( n...
php
{ "resource": "" }
q22418
TranslatableContextReader.addTranslationResource
train
private function addTranslationResource($path, $assetsId) { switch ($ext = pathinfo($path, PATHINFO_EXTENSION)) { case 'yml': $this->addTranslatorResource('yaml', $path, basename($path, '.' . $ext), $assetsId); break; case 'xliff': $thi...
php
{ "resource": "" }
q22419
TranslatableContextReader.addTranslatorResource
train
private function addTranslatorResource($type, $path, $language, $assetsId) {
php
{ "resource": "" }
q22420
ConsoleSnippetPrinter.printSnippets
train
public function printSnippets($targetName, array $snippets) { $message = $this->translator->trans('snippet_proposal_title', array('%1%' => $targetName), 'output'); $this->output->writeln('--- ' . $message . PHP_EOL); foreach ($snippets as $snippet) {
php
{ "resource": "" }
q22421
ConsoleSnippetPrinter.printUndefinedSteps
train
public function printUndefinedSteps($suiteName, array $steps) { $message = $this->translator->trans('snippet_missing_title', array('%1%' => $suiteName), 'output'); $this->output->writeln('--- ' .
php
{ "resource": "" }
q22422
ContextEnvironmentReader.readContextCallees
train
private function readContextCallees(ContextEnvironment $environment, $contextClass) { $callees = array(); foreach ($this->contextReaders as $loader) { $callees = array_merge( $callees,
php
{ "resource": "" }
q22423
StepListener.printStepOnAfterEvent
train
private function printStepOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepTested) { return; } $this->stepPrinter->printStep($formatter, $this->scenario, $event->getStep(), $event->getTestResult());
php
{ "resource": "" }
q22424
AvailableDefinitionsController.getDefinitionPrinter
train
private function getDefinitionPrinter($argument) { if ('l' === $argument) { return $this->listPrinter;
php
{ "resource": "" }
q22425
JUnitFormatterFactory.loadRootNodeListener
train
private function loadRootNodeListener(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Output\Node\EventListener\JUnit\JUnitOutlineStoreListener', array( new Reference('output.node.printer.junit.suite') ) ); $container->setDefinition('outp...
php
{ "resource": "" }
q22426
JUnitFormatterFactory.loadFormatter
train
private function loadFormatter(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Output\Statistics\PhaseStatistics'); $container->setDefinition('output.junit.statistics', $definition); $definition = new Definition('Behat\Testwork\Output\NodeEventListeningFormatter', a...
php
{ "resource": "" }
q22427
ContextEnvironmentHandler.getNormalizedContextSettings
train
private function getNormalizedContextSettings(Suite $suite) { return array_map( function ($context) { $class = $context; $arguments = array();
php
{ "resource": "" }
q22428
ScenarioStatsListener.captureCurrentFeaturePathOnBeforeFeatureEvent
train
private function captureCurrentFeaturePathOnBeforeFeatureEvent(Event $event) { if (!$event instanceof BeforeFeatureTested) { return;
php
{ "resource": "" }
q22429
ScenarioStatsListener.captureScenarioOrExampleStatsOnAfterEvent
train
private function captureScenarioOrExampleStatsOnAfterEvent(Event $event) { if (!$event instanceof AfterScenarioTested) { return; } $scenario = $event->getScenario();
php
{ "resource": "" }
q22430
EventDispatcherExtension.loadStopOnFailureController
train
protected function loadStopOnFailureController(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\EventDispatcher\Cli\StopOnFailureController', array(
php
{ "resource": "" }
q22431
ServicesResolverFactory.createContainer
train
private function createContainer($settings) { if (is_string($settings)) { return $this->createContainerFromString($settings); } if (is_array($settings)) {
php
{ "resource": "" }
q22432
ServicesResolverFactory.loadContainerFromContainer
train
private function loadContainerFromContainer($name) { $services = $this->container->findTaggedServiceIds(HelperContainerExtension::HELPER_CONTAINER_TAG); if (!array_key_exists($name, $services)) { throw new WrongServicesConfigurationException(
php
{ "resource": "" }
q22433
ServicesResolverFactory.createContainerFromClassSpec
train
private function createContainerFromClassSpec($classSpec) { $constructor = explode('::', $classSpec); if (2 === count($constructor)) {
php
{ "resource": "" }
q22434
ServicesResolverFactory.createResolvers
train
private function createResolvers($container, $autowire) { if (!$container instanceof ContainerInterface) { throw new WrongContainerClassException( sprintf( 'Service container is expected to implement `Psr\Container\ContainerInterface`, but `%s` does not.', ...
php
{ "resource": "" }
q22435
RuntimeScenarioHook.isMatchTagFilter
train
protected function isMatchTagFilter(FeatureNode $feature, ScenarioInterface $scenario, $filterString) { $filter = new TagFilter($filterString); if ($filter->isFeatureMatch($feature)) {
php
{ "resource": "" }
q22436
RuntimeScenarioHook.isMatchNameFilter
train
protected function isMatchNameFilter(ScenarioInterface $scenario, $filterString)
php
{ "resource": "" }
q22437
RuntimeFeatureHook.isMatchTagFilter
train
private function isMatchTagFilter(FeatureNode $feature, $filterString)
php
{ "resource": "" }
q22438
RuntimeFeatureHook.isMatchNameFilter
train
private function isMatchNameFilter(FeatureNode $feature, $filterString)
php
{ "resource": "" }
q22439
FirstBackgroundFiresFirstListener.isEventDelayedUntilFirstBackgroundPrinted
train
private function isEventDelayedUntilFirstBackgroundPrinted(Event $event) { if (!$event instanceof ScenarioTested && !$event instanceof OutlineTested && !$event instanceof ExampleTested) {
php
{ "resource": "" }
q22440
FirstBackgroundFiresFirstListener.fireDelayedEventsOnAfterBackground
train
private function fireDelayedEventsOnAfterBackground(Formatter $formatter, $eventName) { if (BackgroundTested::AFTER !== $eventName) { return; } foreach ($this->delayedUntilBackgroundEnd as $eventInfo) { list($event, $eventName) = $eventInfo;
php
{ "resource": "" }
q22441
OutlineListener.printAndCaptureOutlineHeaderOnBeforeEvent
train
private function printAndCaptureOutlineHeaderOnBeforeEvent(Formatter $formatter, Event $event) { if (!$event instanceof BeforeOutlineTested)
php
{ "resource": "" }
q22442
OutlineListener.printAndForgetOutlineFooterOnAfterEvent
train
private function printAndForgetOutlineFooterOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof
php
{ "resource": "" }
q22443
OutlineListener.printExampleHeaderOnBeforeExampleEvent
train
private function printExampleHeaderOnBeforeExampleEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterScenarioSetup) { return; }
php
{ "resource": "" }
q22444
OutlineListener.printExampleFooterOnAfterExampleEvent
train
private function printExampleFooterOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName) { if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName)
php
{ "resource": "" }
q22445
OutlineListener.printStepSetupOnBeforeStepEvent
train
private function printStepSetupOnBeforeStepEvent(Formatter $formatter, Event $event) { if (!$event instanceof
php
{ "resource": "" }
q22446
OutlineListener.printStepOnAfterStepEvent
train
private function printStepOnAfterStepEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepTested) { return; }
php
{ "resource": "" }
q22447
PatternTransformation.supportsDefinitionAndArgument
train
public function supportsDefinitionAndArgument( RegexGenerator $regexGenerator, DefinitionCall $definitionCall, $argumentValue ) { $regex = $regexGenerator->generateRegex( $definitionCall->getEnvironment()->getSuite()->getName(),
php
{ "resource": "" }
q22448
PatternTransformation.transformArgument
train
public function transformArgument( RegexGenerator $regexGenerator, CallCenter $callCenter, DefinitionCall $definitionCall, $argumentValue ) { $regex = $regexGenerator->generateRegex( $definitionCall->getEnvironment()->getSuite()->getName(), $this->patt...
php
{ "resource": "" }
q22449
SnippetRegistry.registerUndefinedStep
train
public function registerUndefinedStep(Environment $environment, StepNode $step) {
php
{ "resource": "" }
q22450
SnippetRegistry.generateSnippets
train
private function generateSnippets() { if ($this->snippetsGenerated) { return null; } $snippetsSet = array(); foreach ($this->undefinedSteps as $i => $undefinedStep) { $snippet = $this->generateSnippet($undefinedStep->getEnvironment(), $undefinedStep->getStep(...
php
{ "resource": "" }
q22451
StepStatsListener.captureScenarioOnBeforeFeatureEvent
train
private function captureScenarioOnBeforeFeatureEvent(Event $event) { if (!$event instanceof BeforeScenarioTested) { return; } $this->scenarioTitle
php
{ "resource": "" }
q22452
StepStatsListener.captureStepStatsOnAfterEvent
train
private function captureStepStatsOnAfterEvent(Event $event) { if (!$event instanceof AfterStepTested) { return; } $result = $event->getTestResult(); $step = $event->getStep(); $text = sprintf('%s %s', $step->getKeyword(), $step->getText()); $exception = $...
php
{ "resource": "" }
q22453
StepStatsListener.getStepPath
train
private function getStepPath(AfterStepTested $event, Exception $exception = null) { $path = sprintf('%s:%d', $this->currentFeaturePath, $event->getStep()->getLine()); if ($exception && $exception instanceof PendingException) {
php
{ "resource": "" }
q22454
ArgumentAutowirer.autowireArguments
train
public function autowireArguments(ReflectionFunctionAbstract $reflection, array $arguments) { $newArguments = $arguments; foreach ($reflection->getParameters() as $index => $parameter) { if ($this->isArgumentWireable($newArguments, $index, $parameter)) {
php
{ "resource": "" }
q22455
ArgumentAutowirer.isArgumentWireable
train
private function isArgumentWireable(array $arguments, $index, ReflectionParameter $parameter) { if (isset($arguments[$index]) || array_key_exists($index, $arguments)) { return false; } if (isset($arguments[$parameter->getName()]) || array_key_exists($parameter->getName(), $argum...
php
{ "resource": "" }
q22456
BeforeStepTeardown.resultCallHasOutput
train
private function resultCallHasOutput() { if (!$this->result instanceof ExecutedStepResult) {
php
{ "resource": "" }
q22457
DefinitionExtension.loadFinder
train
private function loadFinder(ContainerBuilder $container) { $definition = new
php
{ "resource": "" }
q22458
DefinitionExtension.loadWriter
train
private function loadWriter(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\DefinitionWriter', array( new Reference(EnvironmentExtension::MANAGER_ID),
php
{ "resource": "" }
q22459
DefinitionExtension.loadPatternTransformer
train
private function loadPatternTransformer(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Pattern\PatternTransformer');
php
{ "resource": "" }
q22460
DefinitionExtension.loadDefinitionTranslator
train
private function loadDefinitionTranslator(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Translator\DefinitionTranslator', array(
php
{ "resource": "" }
q22461
DefinitionExtension.loadDefaultSearchEngines
train
private function loadDefaultSearchEngines(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Search\RepositorySearchEngine', array( new Reference(self::REPOSITORY_ID), new Reference(self::PATTERN_TRANSFORMER_ID),
php
{ "resource": "" }
q22462
DefinitionExtension.loadDefaultPatternPolicies
train
private function loadDefaultPatternPolicies(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Pattern\Policy\TurnipPatternPolicy'); $definition->addTag(self::PATTERN_POLICY_TAG, array('priority' => 50)); $container->setDefinition(self::PATTERN_POLICY_TAG . '...
php
{ "resource": "" }
q22463
DefinitionExtension.loadDefinitionPrinters
train
private function loadDefinitionPrinters(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Printer\ConsoleDefinitionInformationPrinter', array( new Reference(CliExtension::OUTPUT_ID), new Reference(self::PATTERN_TRANSFORMER_ID), new Refere...
php
{ "resource": "" }
q22464
DefinitionExtension.loadController
train
private function loadController(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Cli\AvailableDefinitionsController', array( new Reference(SuiteExtension::REGISTRY_ID), new Reference(self::WRITER_ID), new Reference($this->getListPrinterI...
php
{ "resource": "" }
q22465
DefinitionExtension.processPatternPolicies
train
private function processPatternPolicies(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::PATTERN_POLICY_TAG); $definition = $container->getDefinition(self::PATTERN_TRANSFORMER_ID);
php
{ "resource": "" }
q22466
RepositorySearchEngine.match
train
private function match(Definition $definition, $stepText, array $multiline) { $regex = $this->patternTransformer->transformPatternToRegex($definition->getPattern()); if (!preg_match($regex, $stepText, $match)) { return null; } $function =
php
{ "resource": "" }
q22467
StopOnFailureController.exitOnFailure
train
public function exitOnFailure(AfterScenarioTested $event) { if (!$this->resultInterpretation->isFailure($event->getTestResult())) { return; }
php
{ "resource": "" }
q22468
JUnitStepPrinter.printStep
train
public function printStep(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result) { /** @var JUnitOutputPrinter $outputPrinter */ $outputPrinter = $formatter->getOutputPrinter(); $message = $step->getKeyword() . ' ' . $step->getText(); if ($result instanceof E...
php
{ "resource": "" }
q22469
BuiltInServiceContainer.createInstance
train
private function createInstance($id) { $schema = $this->getAndValidateServiceSchema($id); $reflection = new ReflectionClass($schema['class']); $arguments = $schema['arguments']; if ($factoryMethod = $this->getAndValidateFactoryMethod($reflection, $schema)) {
php
{ "resource": "" }
q22470
BuiltInServiceContainer.getAndValidateServiceSchema
train
private function getAndValidateServiceSchema($id) { $schema = $this->schema[$id]; if (null === $schema) { $schema = array('class' => $id); } if (is_string($schema)) { $schema = array('class' => $schema);
php
{ "resource": "" }
q22471
BuiltInServiceContainer.getAndValidateFactoryMethod
train
private function getAndValidateFactoryMethod(ReflectionClass $reflection, array $schema) { if (!isset($schema['factory_method'])) { return null; } $factoryMethod = $schema['factory_method'];
php
{ "resource": "" }
q22472
BuiltInServiceContainer.assertFactoryMethodIsStatic
train
private function assertFactoryMethodIsStatic(ReflectionMethod $method) { if (!$method->isStatic()) { throw new WrongServicesConfigurationException(sprintf(
php
{ "resource": "" }
q22473
HookStatsListener.captureHookStatsOnEvent
train
private function captureHookStatsOnEvent(Event $event) { if ($event instanceof AfterSetup && $event->getSetup() instanceof HookedSetup) { $this->captureBeforeHookStats($event->getSetup()); }
php
{ "resource": "" }
q22474
HookStatsListener.captureHookStat
train
private function captureHookStat(CallResult $hookCallResult) { $callee = $hookCallResult->getCall()->getCallee(); $hook = (string) $callee; $path = $callee->getPath(); $stdOut = $hookCallResult->getStdOut(); $error = $hookCallResult->getException()
php
{ "resource": "" }
q22475
TransformationAnnotationReader.simpleTransformations
train
private function simpleTransformations() { $transformations = array(); $transformations[] = 'Behat\Behat\Transformation\Transformation\RowBasedTableTransformation'; $transformations[] = 'Behat\Behat\Transformation\Transformation\ColumnBasedTableTransformation'; $transformations[] = '...
php
{ "resource": "" }
q22476
PrettyFeaturePrinter.printTags
train
private function printTags(OutputPrinter $printer, array $tags) { if (!count($tags)) { return; } $tags = array_map(array($this,
php
{ "resource": "" }
q22477
PrettyFeaturePrinter.printTitle
train
private function printTitle(OutputPrinter $printer, FeatureNode $feature) { $printer->write(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText,
php
{ "resource": "" }
q22478
PrettyFeaturePrinter.printDescription
train
private function printDescription(OutputPrinter $printer, FeatureNode $feature) { if (!$feature->getDescription()) { $printer->writeln(); return; } foreach (explode("\n", $feature->getDescription()) as $descriptionLine) {
php
{ "resource": "" }
q22479
SnippetsController.registerUndefinedStep
train
public function registerUndefinedStep(AfterStepTested $event) { if (StepResult::UNDEFINED === $event->getTestResult()->getResultCode()) {
php
{ "resource": "" }
q22480
SnippetsController.appendAllSnippets
train
public function appendAllSnippets() { $snippets = $this->registry->getSnippets(); count($snippets)
php
{ "resource": "" }
q22481
SnippetsController.printAllSnippets
train
public function printAllSnippets() { $snippets = $this->registry->getSnippets();
php
{ "resource": "" }
q22482
SnippetsController.printUndefinedSteps
train
public function printUndefinedSteps() { $undefined = $this->registry->getUndefinedSteps(); count($undefined) && $this->output->writeln('');
php
{ "resource": "" }
q22483
InteractiveContextIdentifier.askQuestion
train
private function askQuestion($message, $choices, $default) { $this->output->writeln(''); $helper = new QuestionHelper(); $question = new ChoiceQuestion(' ' . $message . "\n",
php
{ "resource": "" }
q22484
AggregateSnippet.getSteps
train
public function getSteps() { return array_unique( array_map( function (Snippet $snippet) { return $snippet->getStep();
php
{ "resource": "" }
q22485
AggregateSnippet.getUsedClasses
train
public function getUsedClasses() { if (empty($this->snippets)) { return array(); } return array_unique( call_user_func_array( 'array_merge', array_map( function (Snippet $snippet) { if (!$sni...
php
{ "resource": "" }
q22486
UninitializedContextEnvironment.registerContextClass
train
public function registerContextClass($contextClass, array $arguments = null) { if (!class_exists($contextClass)) { throw new ContextNotFoundException(sprintf( '`%s` context class not found and can not be used.', $contextClass ), $contextClass);
php
{ "resource": "" }
q22487
PrettyExampleRowPrinter.getWrapperClosure
train
private function getWrapperClosure(OutlineNode $outline, ExampleNode $example, array $stepEvents) { $resultConverter = $this->resultConverter; return function ($value, $column) use ($outline, $example, $stepEvents, $resultConverter) { $results = array(); foreach ($stepEvents...
php
{ "resource": "" }
q22488
ContextSnippetGenerator.getMethodName
train
private function getMethodName($contextClass, $canonicalText, $pattern) { $methodName = $this->deduceMethodName($canonicalText); $methodName
php
{ "resource": "" }
q22489
ContextSnippetGenerator.getMethodArguments
train
private function getMethodArguments(StepNode $step, $tokenCount) { $args = array(); for ($i = 0; $i < $tokenCount; $i++) { $args[] = '$arg' . ($i + 1); }
php
{ "resource": "" }
q22490
ContextSnippetGenerator.getUsedClasses
train
private function getUsedClasses(StepNode $step) { $usedClasses = array('Behat\Behat\Tester\Exception\PendingException'); foreach ($step->getArguments() as $argument) { if ($argument instanceof TableNode) { $usedClasses[] = 'Behat\Gherkin\Node\TableNode';
php
{ "resource": "" }
q22491
ContextSnippetGenerator.getSnippetTemplate
train
private function getSnippetTemplate($pattern, $methodName, array $methodArguments) { return sprintf( self::$templateTemplate,
php
{ "resource": "" }
q22492
ContextSnippetGenerator.getUniqueMethodName
train
private function getUniqueMethodName($contextClass, $stepPattern, $name) { $reflection = new ReflectionClass($contextClass); $number = $this->getMethodNumberFromTheMethodName($name); list($name,
php
{ "resource": "" }
q22493
ContextSnippetGenerator.getMethodNumberFromTheMethodName
train
private function getMethodNumberFromTheMethodName($methodName) { $methodNumber = 2; if (preg_match('/(\d+)$/', $methodName, $matches)) {
php
{ "resource": "" }
q22494
ContextSnippetGenerator.getMethodNameNotExistentInContext
train
private function getMethodNameNotExistentInContext(ReflectionClass $reflection, $methodName, $methodNumber) { while ($reflection->hasMethod($methodName)) { $methodName = preg_replace('/\d+$/', '', $methodName);
php
{ "resource": "" }
q22495
ContextSnippetGenerator.getMethodNameNotProposedEarlier
train
private function getMethodNameNotProposedEarlier($contextClass, $stepPattern, $name, $number) { foreach ($this->getAlreadyProposedMethods($contextClass) as $proposedPattern => $proposedMethod) { if ($proposedPattern === $stepPattern) {
php
{ "resource": "" }
q22496
ContextSnippetGenerator.getMethodArgument
train
private function getMethodArgument($argument) { $arg = '__unknown__'; if ($argument instanceof PyStringNode) { $arg = 'PyStringNode $string';
php
{ "resource": "" }
q22497
FeatureListener.printHeaderOnBeforeEvent
train
private function printHeaderOnBeforeEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureSetup) {
php
{ "resource": "" }
q22498
FeatureListener.printFooterOnAfterEvent
train
private function printFooterOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureTested) {
php
{ "resource": "" }
q22499
DefinitionFinder.findDefinition
train
public function findDefinition(Environment $environment, FeatureNode $feature, StepNode $step) { foreach ($this->engines as $engine) { $result = $engine->searchDefinition($environment, $feature, $step);
php
{ "resource": "" }