repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
Behat/Behat
src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php
GherkinExtension.processLoaders
private function processLoaders(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::LOADER_TAG); $definition = $container->getDefinition(self::MANAGER_ID); foreach ($references as $reference) { $definition->addMethodCall('addLoader', array($reference)); } }
php
private function processLoaders(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::LOADER_TAG); $definition = $container->getDefinition(self::MANAGER_ID); foreach ($references as $reference) { $definition->addMethodCall('addLoader', array($reference)); } }
[ "private", "function", "processLoaders", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "references", "=", "$", "this", "->", "processor", "->", "findAndSortTaggedServices", "(", "$", "container", ",", "self", "::", "LOADER_TAG", ")", ";", "$", "definition", "=", "$", "container", "->", "getDefinition", "(", "self", "::", "MANAGER_ID", ")", ";", "foreach", "(", "$", "references", "as", "$", "reference", ")", "{", "$", "definition", "->", "addMethodCall", "(", "'addLoader'", ",", "array", "(", "$", "reference", ")", ")", ";", "}", "}" ]
Processes all available gherkin loaders. @param ContainerBuilder $container
[ "Processes", "all", "available", "gherkin", "loaders", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L340-L348
train
Behat/Behat
src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php
GherkinExtension.createFilterDefinition
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($filterString)); } if ('tags' === $type) { return new Definition('Behat\Gherkin\Filter\TagFilter', array($filterString)); } if ('narrative' === $type) { return new Definition('Behat\Gherkin\Filter\NarrativeFilter', array($filterString)); } throw new ExtensionException(sprintf( '`%s` filter is not supported by the `filters` option of gherkin extension. Supported types are `%s`.', $type, implode('`, `', array('narrative', 'role', 'name', 'tags')) ), 'gherkin'); }
php
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($filterString)); } if ('tags' === $type) { return new Definition('Behat\Gherkin\Filter\TagFilter', array($filterString)); } if ('narrative' === $type) { return new Definition('Behat\Gherkin\Filter\NarrativeFilter', array($filterString)); } throw new ExtensionException(sprintf( '`%s` filter is not supported by the `filters` option of gherkin extension. Supported types are `%s`.', $type, implode('`, `', array('narrative', 'role', 'name', 'tags')) ), 'gherkin'); }
[ "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", "(", "$", "filterString", ")", ")", ";", "}", "if", "(", "'tags'", "===", "$", "type", ")", "{", "return", "new", "Definition", "(", "'Behat\\Gherkin\\Filter\\TagFilter'", ",", "array", "(", "$", "filterString", ")", ")", ";", "}", "if", "(", "'narrative'", "===", "$", "type", ")", "{", "return", "new", "Definition", "(", "'Behat\\Gherkin\\Filter\\NarrativeFilter'", ",", "array", "(", "$", "filterString", ")", ")", ";", "}", "throw", "new", "ExtensionException", "(", "sprintf", "(", "'`%s` filter is not supported by the `filters` option of gherkin extension. Supported types are `%s`.'", ",", "$", "type", ",", "implode", "(", "'`, `'", ",", "array", "(", "'narrative'", ",", "'role'", ",", "'name'", ",", "'tags'", ")", ")", ")", ",", "'gherkin'", ")", ";", "}" ]
Creates filter definition of provided type. @param string $type @param string $filterString @return Definition @throws ExtensionException If filter type is not recognised
[ "Creates", "filter", "definition", "of", "provided", "type", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L360-L383
train
Behat/Behat
src/Behat/Behat/Gherkin/Specification/Locator/FilesystemFeatureLocator.php
FilesystemFeatureLocator.getSuitePaths
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(), gettype($suite->getSetting('paths')) ), $suite->getName() ); } return $suite->getSetting('paths'); }
php
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(), gettype($suite->getSetting('paths')) ), $suite->getName() ); } return $suite->getSetting('paths'); }
[ "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", "(", ")", ",", "gettype", "(", "$", "suite", "->", "getSetting", "(", "'paths'", ")", ")", ")", ",", "$", "suite", "->", "getName", "(", ")", ")", ";", "}", "return", "$", "suite", "->", "getSetting", "(", "'paths'", ")", ";", "}" ]
Returns array of feature paths configured for the provided suite. @param Suite $suite @return string[] @throws SuiteConfigurationException If `paths` setting is not an array
[ "Returns", "array", "of", "feature", "paths", "configured", "for", "the", "provided", "suite", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemFeatureLocator.php#L100-L113
train
Behat/Behat
src/Behat/Behat/Gherkin/Specification/Locator/FilesystemFeatureLocator.php
FilesystemFeatureLocator.findFeatureFiles
private function findFeatureFiles($path) { $absolutePath = $this->findAbsolutePath($path); if (!$absolutePath) { return array($path); } if (is_file($absolutePath)) { return array($absolutePath); } $iterator = new RegexIterator( new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $absolutePath, RecursiveDirectoryIterator::FOLLOW_SYMLINKS | RecursiveDirectoryIterator::SKIP_DOTS ) ), '/^.+\.feature$/i', RegexIterator::MATCH ); $paths = array_map('strval', iterator_to_array($iterator)); uasort($paths, 'strnatcasecmp'); return $paths; }
php
private function findFeatureFiles($path) { $absolutePath = $this->findAbsolutePath($path); if (!$absolutePath) { return array($path); } if (is_file($absolutePath)) { return array($absolutePath); } $iterator = new RegexIterator( new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $absolutePath, RecursiveDirectoryIterator::FOLLOW_SYMLINKS | RecursiveDirectoryIterator::SKIP_DOTS ) ), '/^.+\.feature$/i', RegexIterator::MATCH ); $paths = array_map('strval', iterator_to_array($iterator)); uasort($paths, 'strnatcasecmp'); return $paths; }
[ "private", "function", "findFeatureFiles", "(", "$", "path", ")", "{", "$", "absolutePath", "=", "$", "this", "->", "findAbsolutePath", "(", "$", "path", ")", ";", "if", "(", "!", "$", "absolutePath", ")", "{", "return", "array", "(", "$", "path", ")", ";", "}", "if", "(", "is_file", "(", "$", "absolutePath", ")", ")", "{", "return", "array", "(", "$", "absolutePath", ")", ";", "}", "$", "iterator", "=", "new", "RegexIterator", "(", "new", "RecursiveIteratorIterator", "(", "new", "RecursiveDirectoryIterator", "(", "$", "absolutePath", ",", "RecursiveDirectoryIterator", "::", "FOLLOW_SYMLINKS", "|", "RecursiveDirectoryIterator", "::", "SKIP_DOTS", ")", ")", ",", "'/^.+\\.feature$/i'", ",", "RegexIterator", "::", "MATCH", ")", ";", "$", "paths", "=", "array_map", "(", "'strval'", ",", "iterator_to_array", "(", "$", "iterator", ")", ")", ";", "uasort", "(", "$", "paths", ",", "'strnatcasecmp'", ")", ";", "return", "$", "paths", ";", "}" ]
Loads feature files paths from provided path. @param string $path @return string[]
[ "Loads", "feature", "files", "paths", "from", "provided", "path", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemFeatureLocator.php#L122-L149
train
Behat/Behat
src/Behat/Behat/Context/Reader/TranslatableContextReader.php
TranslatableContextReader.addTranslationResource
private function addTranslationResource($path, $assetsId) { switch ($ext = pathinfo($path, PATHINFO_EXTENSION)) { case 'yml': $this->addTranslatorResource('yaml', $path, basename($path, '.' . $ext), $assetsId); break; case 'xliff': $this->addTranslatorResource('xliff', $path, basename($path, '.' . $ext), $assetsId); break; case 'php': $this->addTranslatorResource('php', $path, basename($path, '.' . $ext), $assetsId); break; default: throw new UnknownTranslationResourceException(sprintf( 'Can not read translations from `%s`. File type is not supported.', $path ), $path); } }
php
private function addTranslationResource($path, $assetsId) { switch ($ext = pathinfo($path, PATHINFO_EXTENSION)) { case 'yml': $this->addTranslatorResource('yaml', $path, basename($path, '.' . $ext), $assetsId); break; case 'xliff': $this->addTranslatorResource('xliff', $path, basename($path, '.' . $ext), $assetsId); break; case 'php': $this->addTranslatorResource('php', $path, basename($path, '.' . $ext), $assetsId); break; default: throw new UnknownTranslationResourceException(sprintf( 'Can not read translations from `%s`. File type is not supported.', $path ), $path); } }
[ "private", "function", "addTranslationResource", "(", "$", "path", ",", "$", "assetsId", ")", "{", "switch", "(", "$", "ext", "=", "pathinfo", "(", "$", "path", ",", "PATHINFO_EXTENSION", ")", ")", "{", "case", "'yml'", ":", "$", "this", "->", "addTranslatorResource", "(", "'yaml'", ",", "$", "path", ",", "basename", "(", "$", "path", ",", "'.'", ".", "$", "ext", ")", ",", "$", "assetsId", ")", ";", "break", ";", "case", "'xliff'", ":", "$", "this", "->", "addTranslatorResource", "(", "'xliff'", ",", "$", "path", ",", "basename", "(", "$", "path", ",", "'.'", ".", "$", "ext", ")", ",", "$", "assetsId", ")", ";", "break", ";", "case", "'php'", ":", "$", "this", "->", "addTranslatorResource", "(", "'php'", ",", "$", "path", ",", "basename", "(", "$", "path", ",", "'.'", ".", "$", "ext", ")", ",", "$", "assetsId", ")", ";", "break", ";", "default", ":", "throw", "new", "UnknownTranslationResourceException", "(", "sprintf", "(", "'Can not read translations from `%s`. File type is not supported.'", ",", "$", "path", ")", ",", "$", "path", ")", ";", "}", "}" ]
Adds translation resource. @param string $path @param string $assetsId @throws UnknownTranslationResourceException
[ "Adds", "translation", "resource", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Reader/TranslatableContextReader.php#L69-L87
train
Behat/Behat
src/Behat/Behat/Context/Reader/TranslatableContextReader.php
TranslatableContextReader.addTranslatorResource
private function addTranslatorResource($type, $path, $language, $assetsId) { $this->translator->addResource($type, $path, $language, $assetsId); }
php
private function addTranslatorResource($type, $path, $language, $assetsId) { $this->translator->addResource($type, $path, $language, $assetsId); }
[ "private", "function", "addTranslatorResource", "(", "$", "type", ",", "$", "path", ",", "$", "language", ",", "$", "assetsId", ")", "{", "$", "this", "->", "translator", "->", "addResource", "(", "$", "type", ",", "$", "path", ",", "$", "language", ",", "$", "assetsId", ")", ";", "}" ]
Adds resource to translator instance. @param string $type @param string $path @param string $language @param string $assetsId
[ "Adds", "resource", "to", "translator", "instance", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Reader/TranslatableContextReader.php#L97-L100
train
Behat/Behat
src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
ConsoleSnippetPrinter.printSnippets
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) { $this->output->writeln(sprintf('<snippet_undefined>%s</snippet_undefined>', $snippet->getSnippet()) . PHP_EOL); } }
php
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) { $this->output->writeln(sprintf('<snippet_undefined>%s</snippet_undefined>', $snippet->getSnippet()) . PHP_EOL); } }
[ "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", ")", "{", "$", "this", "->", "output", "->", "writeln", "(", "sprintf", "(", "'<snippet_undefined>%s</snippet_undefined>'", ",", "$", "snippet", "->", "getSnippet", "(", ")", ")", ".", "PHP_EOL", ")", ";", "}", "}" ]
Prints snippets of specific target. @param string $targetName @param AggregateSnippet[] $snippets
[ "Prints", "snippets", "of", "specific", "target", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php#L58-L67
train
Behat/Behat
src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
ConsoleSnippetPrinter.printUndefinedSteps
public function printUndefinedSteps($suiteName, array $steps) { $message = $this->translator->trans('snippet_missing_title', array('%1%' => $suiteName), 'output'); $this->output->writeln('--- ' . $message . PHP_EOL); foreach ($steps as $step) { $this->output->writeln(sprintf(' <snippet_undefined>%s %s</snippet_undefined>', $step->getKeyword(), $step->getText())); } $this->output->writeln(''); }
php
public function printUndefinedSteps($suiteName, array $steps) { $message = $this->translator->trans('snippet_missing_title', array('%1%' => $suiteName), 'output'); $this->output->writeln('--- ' . $message . PHP_EOL); foreach ($steps as $step) { $this->output->writeln(sprintf(' <snippet_undefined>%s %s</snippet_undefined>', $step->getKeyword(), $step->getText())); } $this->output->writeln(''); }
[ "public", "function", "printUndefinedSteps", "(", "$", "suiteName", ",", "array", "$", "steps", ")", "{", "$", "message", "=", "$", "this", "->", "translator", "->", "trans", "(", "'snippet_missing_title'", ",", "array", "(", "'%1%'", "=>", "$", "suiteName", ")", ",", "'output'", ")", ";", "$", "this", "->", "output", "->", "writeln", "(", "'--- '", ".", "$", "message", ".", "PHP_EOL", ")", ";", "foreach", "(", "$", "steps", "as", "$", "step", ")", "{", "$", "this", "->", "output", "->", "writeln", "(", "sprintf", "(", "' <snippet_undefined>%s %s</snippet_undefined>'", ",", "$", "step", "->", "getKeyword", "(", ")", ",", "$", "step", "->", "getText", "(", ")", ")", ")", ";", "}", "$", "this", "->", "output", "->", "writeln", "(", "''", ")", ";", "}" ]
Prints undefined steps of specific suite. @param string $suiteName @param StepNode[] $steps
[ "Prints", "undefined", "steps", "of", "specific", "suite", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php#L75-L86
train
Behat/Behat
src/Behat/Behat/Context/Environment/Reader/ContextEnvironmentReader.php
ContextEnvironmentReader.readContextCallees
private function readContextCallees(ContextEnvironment $environment, $contextClass) { $callees = array(); foreach ($this->contextReaders as $loader) { $callees = array_merge( $callees, $loader->readContextCallees($environment, $contextClass) ); } return $callees; }
php
private function readContextCallees(ContextEnvironment $environment, $contextClass) { $callees = array(); foreach ($this->contextReaders as $loader) { $callees = array_merge( $callees, $loader->readContextCallees($environment, $contextClass) ); } return $callees; }
[ "private", "function", "readContextCallees", "(", "ContextEnvironment", "$", "environment", ",", "$", "contextClass", ")", "{", "$", "callees", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "contextReaders", "as", "$", "loader", ")", "{", "$", "callees", "=", "array_merge", "(", "$", "callees", ",", "$", "loader", "->", "readContextCallees", "(", "$", "environment", ",", "$", "contextClass", ")", ")", ";", "}", "return", "$", "callees", ";", "}" ]
Reads callees from a specific suite's context. @param ContextEnvironment $environment @param string $contextClass @return Callee[]
[ "Reads", "callees", "from", "a", "specific", "suite", "s", "context", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Environment/Reader/ContextEnvironmentReader.php#L81-L92
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php
StepListener.printStepOnAfterEvent
private function printStepOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepTested) { return; } $this->stepPrinter->printStep($formatter, $this->scenario, $event->getStep(), $event->getTestResult()); if ($this->setupPrinter) { $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); } }
php
private function printStepOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepTested) { return; } $this->stepPrinter->printStep($formatter, $this->scenario, $event->getStep(), $event->getTestResult()); if ($this->setupPrinter) { $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); } }
[ "private", "function", "printStepOnAfterEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterStepTested", ")", "{", "return", ";", "}", "$", "this", "->", "stepPrinter", "->", "printStep", "(", "$", "formatter", ",", "$", "this", "->", "scenario", ",", "$", "event", "->", "getStep", "(", ")", ",", "$", "event", "->", "getTestResult", "(", ")", ")", ";", "if", "(", "$", "this", "->", "setupPrinter", ")", "{", "$", "this", "->", "setupPrinter", "->", "printTeardown", "(", "$", "formatter", ",", "$", "event", "->", "getTeardown", "(", ")", ")", ";", "}", "}" ]
Prints step on AFTER event. @param Formatter $formatter @param Event $event
[ "Prints", "step", "on", "AFTER", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php#L113-L124
train
Behat/Behat
src/Behat/Behat/Definition/Cli/AvailableDefinitionsController.php
AvailableDefinitionsController.getDefinitionPrinter
private function getDefinitionPrinter($argument) { if ('l' === $argument) { return $this->listPrinter; } if ('i' !== $argument) { $this->infoPrinter->setSearchCriterion($argument); } return $this->infoPrinter; }
php
private function getDefinitionPrinter($argument) { if ('l' === $argument) { return $this->listPrinter; } if ('i' !== $argument) { $this->infoPrinter->setSearchCriterion($argument); } return $this->infoPrinter; }
[ "private", "function", "getDefinitionPrinter", "(", "$", "argument", ")", "{", "if", "(", "'l'", "===", "$", "argument", ")", "{", "return", "$", "this", "->", "listPrinter", ";", "}", "if", "(", "'i'", "!==", "$", "argument", ")", "{", "$", "this", "->", "infoPrinter", "->", "setSearchCriterion", "(", "$", "argument", ")", ";", "}", "return", "$", "this", "->", "infoPrinter", ";", "}" ]
Returns definition printer for provided option argument. @param string $argument @return DefinitionPrinter
[ "Returns", "definition", "printer", "for", "provided", "option", "argument", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Cli/AvailableDefinitionsController.php#L106-L117
train
Behat/Behat
src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php
JUnitFormatterFactory.loadRootNodeListener
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('output.node.listener.junit.outline', $definition); $definition = new Definition( 'Behat\Behat\Output\Node\EventListener\JUnit\JUnitDurationListener' ); $container->setDefinition('output.node.listener.junit.duration', $definition); $definition = new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( array( new Reference('output.node.listener.junit.duration'), new Reference('output.node.listener.junit.outline'), new Definition('Behat\Behat\Output\Node\EventListener\JUnit\JUnitFeatureElementListener', array( new Reference('output.node.printer.junit.feature'), new Reference('output.node.printer.junit.scenario'), new Reference('output.node.printer.junit.step'), new Reference('output.node.printer.junit.setup'), )), ), )); $container->setDefinition(self::ROOT_LISTENER_ID, $definition); }
php
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('output.node.listener.junit.outline', $definition); $definition = new Definition( 'Behat\Behat\Output\Node\EventListener\JUnit\JUnitDurationListener' ); $container->setDefinition('output.node.listener.junit.duration', $definition); $definition = new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( array( new Reference('output.node.listener.junit.duration'), new Reference('output.node.listener.junit.outline'), new Definition('Behat\Behat\Output\Node\EventListener\JUnit\JUnitFeatureElementListener', array( new Reference('output.node.printer.junit.feature'), new Reference('output.node.printer.junit.scenario'), new Reference('output.node.printer.junit.step'), new Reference('output.node.printer.junit.setup'), )), ), )); $container->setDefinition(self::ROOT_LISTENER_ID, $definition); }
[ "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", "(", "'output.node.listener.junit.outline'", ",", "$", "definition", ")", ";", "$", "definition", "=", "new", "Definition", "(", "'Behat\\Behat\\Output\\Node\\EventListener\\JUnit\\JUnitDurationListener'", ")", ";", "$", "container", "->", "setDefinition", "(", "'output.node.listener.junit.duration'", ",", "$", "definition", ")", ";", "$", "definition", "=", "new", "Definition", "(", "'Behat\\Testwork\\Output\\Node\\EventListener\\ChainEventListener'", ",", "array", "(", "array", "(", "new", "Reference", "(", "'output.node.listener.junit.duration'", ")", ",", "new", "Reference", "(", "'output.node.listener.junit.outline'", ")", ",", "new", "Definition", "(", "'Behat\\Behat\\Output\\Node\\EventListener\\JUnit\\JUnitFeatureElementListener'", ",", "array", "(", "new", "Reference", "(", "'output.node.printer.junit.feature'", ")", ",", "new", "Reference", "(", "'output.node.printer.junit.scenario'", ")", ",", "new", "Reference", "(", "'output.node.printer.junit.step'", ")", ",", "new", "Reference", "(", "'output.node.printer.junit.setup'", ")", ",", ")", ")", ",", ")", ",", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "self", "::", "ROOT_LISTENER_ID", ",", "$", "definition", ")", ";", "}" ]
Loads the node listeners required for JUnit printers to work. @param ContainerBuilder $container
[ "Loads", "the", "node", "listeners", "required", "for", "JUnit", "printers", "to", "work", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php#L105-L133
train
Behat/Behat
src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php
JUnitFormatterFactory.loadFormatter
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', array( 'junit', 'Outputs the failures in JUnit compatible files.', array( 'timer' => true, ), $this->createOutputPrinterDefinition(), new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( array( new Reference(self::ROOT_LISTENER_ID), new Definition('Behat\Behat\Output\Node\EventListener\Statistics\ScenarioStatsListener', array( new Reference('output.junit.statistics') )), new Definition('Behat\Behat\Output\Node\EventListener\Statistics\StepStatsListener', array( new Reference('output.junit.statistics'), new Reference(ExceptionExtension::PRESENTER_ID) )), new Definition('Behat\Behat\Output\Node\EventListener\Statistics\HookStatsListener', array( new Reference('output.junit.statistics'), new Reference(ExceptionExtension::PRESENTER_ID) )), ), )), )); $definition->addTag(OutputExtension::FORMATTER_TAG, array('priority' => 100)); $container->setDefinition(OutputExtension::FORMATTER_TAG . '.junit', $definition); }
php
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', array( 'junit', 'Outputs the failures in JUnit compatible files.', array( 'timer' => true, ), $this->createOutputPrinterDefinition(), new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( array( new Reference(self::ROOT_LISTENER_ID), new Definition('Behat\Behat\Output\Node\EventListener\Statistics\ScenarioStatsListener', array( new Reference('output.junit.statistics') )), new Definition('Behat\Behat\Output\Node\EventListener\Statistics\StepStatsListener', array( new Reference('output.junit.statistics'), new Reference(ExceptionExtension::PRESENTER_ID) )), new Definition('Behat\Behat\Output\Node\EventListener\Statistics\HookStatsListener', array( new Reference('output.junit.statistics'), new Reference(ExceptionExtension::PRESENTER_ID) )), ), )), )); $definition->addTag(OutputExtension::FORMATTER_TAG, array('priority' => 100)); $container->setDefinition(OutputExtension::FORMATTER_TAG . '.junit', $definition); }
[ "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'", ",", "array", "(", "'junit'", ",", "'Outputs the failures in JUnit compatible files.'", ",", "array", "(", "'timer'", "=>", "true", ",", ")", ",", "$", "this", "->", "createOutputPrinterDefinition", "(", ")", ",", "new", "Definition", "(", "'Behat\\Testwork\\Output\\Node\\EventListener\\ChainEventListener'", ",", "array", "(", "array", "(", "new", "Reference", "(", "self", "::", "ROOT_LISTENER_ID", ")", ",", "new", "Definition", "(", "'Behat\\Behat\\Output\\Node\\EventListener\\Statistics\\ScenarioStatsListener'", ",", "array", "(", "new", "Reference", "(", "'output.junit.statistics'", ")", ")", ")", ",", "new", "Definition", "(", "'Behat\\Behat\\Output\\Node\\EventListener\\Statistics\\StepStatsListener'", ",", "array", "(", "new", "Reference", "(", "'output.junit.statistics'", ")", ",", "new", "Reference", "(", "ExceptionExtension", "::", "PRESENTER_ID", ")", ")", ")", ",", "new", "Definition", "(", "'Behat\\Behat\\Output\\Node\\EventListener\\Statistics\\HookStatsListener'", ",", "array", "(", "new", "Reference", "(", "'output.junit.statistics'", ")", ",", "new", "Reference", "(", "ExceptionExtension", "::", "PRESENTER_ID", ")", ")", ")", ",", ")", ",", ")", ")", ",", ")", ")", ";", "$", "definition", "->", "addTag", "(", "OutputExtension", "::", "FORMATTER_TAG", ",", "array", "(", "'priority'", "=>", "100", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "OutputExtension", "::", "FORMATTER_TAG", ".", "'.junit'", ",", "$", "definition", ")", ";", "}" ]
Loads formatter itself. @param ContainerBuilder $container
[ "Loads", "formatter", "itself", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php#L140-L171
train
Behat/Behat
src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
ContextEnvironmentHandler.getNormalizedContextSettings
private function getNormalizedContextSettings(Suite $suite) { return array_map( function ($context) { $class = $context; $arguments = array(); if (is_array($context)) { $class = current(array_keys($context)); $arguments = $context[$class]; } return array($class, $arguments); }, $this->getSuiteContexts($suite) ); }
php
private function getNormalizedContextSettings(Suite $suite) { return array_map( function ($context) { $class = $context; $arguments = array(); if (is_array($context)) { $class = current(array_keys($context)); $arguments = $context[$class]; } return array($class, $arguments); }, $this->getSuiteContexts($suite) ); }
[ "private", "function", "getNormalizedContextSettings", "(", "Suite", "$", "suite", ")", "{", "return", "array_map", "(", "function", "(", "$", "context", ")", "{", "$", "class", "=", "$", "context", ";", "$", "arguments", "=", "array", "(", ")", ";", "if", "(", "is_array", "(", "$", "context", ")", ")", "{", "$", "class", "=", "current", "(", "array_keys", "(", "$", "context", ")", ")", ";", "$", "arguments", "=", "$", "context", "[", "$", "class", "]", ";", "}", "return", "array", "(", "$", "class", ",", "$", "arguments", ")", ";", "}", ",", "$", "this", "->", "getSuiteContexts", "(", "$", "suite", ")", ")", ";", "}" ]
Returns normalized suite context settings. @param Suite $suite @return array
[ "Returns", "normalized", "suite", "context", "settings", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php#L135-L151
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php
ScenarioStatsListener.captureCurrentFeaturePathOnBeforeFeatureEvent
private function captureCurrentFeaturePathOnBeforeFeatureEvent(Event $event) { if (!$event instanceof BeforeFeatureTested) { return; } $this->currentFeaturePath = $event->getFeature()->getFile(); }
php
private function captureCurrentFeaturePathOnBeforeFeatureEvent(Event $event) { if (!$event instanceof BeforeFeatureTested) { return; } $this->currentFeaturePath = $event->getFeature()->getFile(); }
[ "private", "function", "captureCurrentFeaturePathOnBeforeFeatureEvent", "(", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "BeforeFeatureTested", ")", "{", "return", ";", "}", "$", "this", "->", "currentFeaturePath", "=", "$", "event", "->", "getFeature", "(", ")", "->", "getFile", "(", ")", ";", "}" ]
Captures current feature file path to the ivar on feature BEFORE event. @param Event $event
[ "Captures", "current", "feature", "file", "path", "to", "the", "ivar", "on", "feature", "BEFORE", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php#L63-L70
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php
ScenarioStatsListener.captureScenarioOrExampleStatsOnAfterEvent
private function captureScenarioOrExampleStatsOnAfterEvent(Event $event) { if (!$event instanceof AfterScenarioTested) { return; } $scenario = $event->getScenario(); $title = $scenario->getTitle(); $path = sprintf('%s:%d', $this->currentFeaturePath, $scenario->getLine()); $resultCode = $event->getTestResult()->getResultCode(); $stat = new ScenarioStat($title, $path, $resultCode); $this->statistics->registerScenarioStat($stat); }
php
private function captureScenarioOrExampleStatsOnAfterEvent(Event $event) { if (!$event instanceof AfterScenarioTested) { return; } $scenario = $event->getScenario(); $title = $scenario->getTitle(); $path = sprintf('%s:%d', $this->currentFeaturePath, $scenario->getLine()); $resultCode = $event->getTestResult()->getResultCode(); $stat = new ScenarioStat($title, $path, $resultCode); $this->statistics->registerScenarioStat($stat); }
[ "private", "function", "captureScenarioOrExampleStatsOnAfterEvent", "(", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterScenarioTested", ")", "{", "return", ";", "}", "$", "scenario", "=", "$", "event", "->", "getScenario", "(", ")", ";", "$", "title", "=", "$", "scenario", "->", "getTitle", "(", ")", ";", "$", "path", "=", "sprintf", "(", "'%s:%d'", ",", "$", "this", "->", "currentFeaturePath", ",", "$", "scenario", "->", "getLine", "(", ")", ")", ";", "$", "resultCode", "=", "$", "event", "->", "getTestResult", "(", ")", "->", "getResultCode", "(", ")", ";", "$", "stat", "=", "new", "ScenarioStat", "(", "$", "title", ",", "$", "path", ",", "$", "resultCode", ")", ";", "$", "this", "->", "statistics", "->", "registerScenarioStat", "(", "$", "stat", ")", ";", "}" ]
Captures scenario or example stats on their AFTER event. @param Event $event
[ "Captures", "scenario", "or", "example", "stats", "on", "their", "AFTER", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php#L91-L104
train
Behat/Behat
src/Behat/Behat/EventDispatcher/ServiceContainer/EventDispatcherExtension.php
EventDispatcherExtension.loadStopOnFailureController
protected function loadStopOnFailureController(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\EventDispatcher\Cli\StopOnFailureController', array( new Reference(EventDispatcherExtension::DISPATCHER_ID) )); $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 100)); $container->setDefinition(CliExtension::CONTROLLER_TAG . '.stop_on_failure', $definition); }
php
protected function loadStopOnFailureController(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\EventDispatcher\Cli\StopOnFailureController', array( new Reference(EventDispatcherExtension::DISPATCHER_ID) )); $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 100)); $container->setDefinition(CliExtension::CONTROLLER_TAG . '.stop_on_failure', $definition); }
[ "protected", "function", "loadStopOnFailureController", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "definition", "=", "new", "Definition", "(", "'Behat\\Behat\\EventDispatcher\\Cli\\StopOnFailureController'", ",", "array", "(", "new", "Reference", "(", "EventDispatcherExtension", "::", "DISPATCHER_ID", ")", ")", ")", ";", "$", "definition", "->", "addTag", "(", "CliExtension", "::", "CONTROLLER_TAG", ",", "array", "(", "'priority'", "=>", "100", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "CliExtension", "::", "CONTROLLER_TAG", ".", "'.stop_on_failure'", ",", "$", "definition", ")", ";", "}" ]
Loads stop on failure controller. @param ContainerBuilder $container
[ "Loads", "stop", "on", "failure", "controller", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/EventDispatcher/ServiceContainer/EventDispatcherExtension.php#L51-L58
train
Behat/Behat
src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
ServicesResolverFactory.createContainer
private function createContainer($settings) { if (is_string($settings)) { return $this->createContainerFromString($settings); } if (is_array($settings)) { return $this->createContainerFromArray($settings); } throw new WrongServicesConfigurationException( sprintf('`services` must be either string or an array, but `%s` given.', gettype($settings)) ); }
php
private function createContainer($settings) { if (is_string($settings)) { return $this->createContainerFromString($settings); } if (is_array($settings)) { return $this->createContainerFromArray($settings); } throw new WrongServicesConfigurationException( sprintf('`services` must be either string or an array, but `%s` given.', gettype($settings)) ); }
[ "private", "function", "createContainer", "(", "$", "settings", ")", "{", "if", "(", "is_string", "(", "$", "settings", ")", ")", "{", "return", "$", "this", "->", "createContainerFromString", "(", "$", "settings", ")", ";", "}", "if", "(", "is_array", "(", "$", "settings", ")", ")", "{", "return", "$", "this", "->", "createContainerFromArray", "(", "$", "settings", ")", ";", "}", "throw", "new", "WrongServicesConfigurationException", "(", "sprintf", "(", "'`services` must be either string or an array, but `%s` given.'", ",", "gettype", "(", "$", "settings", ")", ")", ")", ";", "}" ]
Creates container from the setting passed. @param string $settings @return mixed @throws WrongServicesConfigurationException
[ "Creates", "container", "from", "the", "setting", "passed", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php#L107-L120
train
Behat/Behat
src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
ServicesResolverFactory.loadContainerFromContainer
private function loadContainerFromContainer($name) { $services = $this->container->findTaggedServiceIds(HelperContainerExtension::HELPER_CONTAINER_TAG); if (!array_key_exists($name, $services)) { throw new WrongServicesConfigurationException( sprintf('Service container `@%s` was not found.', $name) ); } return $this->container->get($name); }
php
private function loadContainerFromContainer($name) { $services = $this->container->findTaggedServiceIds(HelperContainerExtension::HELPER_CONTAINER_TAG); if (!array_key_exists($name, $services)) { throw new WrongServicesConfigurationException( sprintf('Service container `@%s` was not found.', $name) ); } return $this->container->get($name); }
[ "private", "function", "loadContainerFromContainer", "(", "$", "name", ")", "{", "$", "services", "=", "$", "this", "->", "container", "->", "findTaggedServiceIds", "(", "HelperContainerExtension", "::", "HELPER_CONTAINER_TAG", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "name", ",", "$", "services", ")", ")", "{", "throw", "new", "WrongServicesConfigurationException", "(", "sprintf", "(", "'Service container `@%s` was not found.'", ",", "$", "name", ")", ")", ";", "}", "return", "$", "this", "->", "container", "->", "get", "(", "$", "name", ")", ";", "}" ]
Loads container from string. @param string $name @return mixed @throws WrongServicesConfigurationException
[ "Loads", "container", "from", "string", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php#L161-L172
train
Behat/Behat
src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
ServicesResolverFactory.createContainerFromClassSpec
private function createContainerFromClassSpec($classSpec) { $constructor = explode('::', $classSpec); if (2 === count($constructor)) { return call_user_func($constructor); } return new $constructor[0]; }
php
private function createContainerFromClassSpec($classSpec) { $constructor = explode('::', $classSpec); if (2 === count($constructor)) { return call_user_func($constructor); } return new $constructor[0]; }
[ "private", "function", "createContainerFromClassSpec", "(", "$", "classSpec", ")", "{", "$", "constructor", "=", "explode", "(", "'::'", ",", "$", "classSpec", ")", ";", "if", "(", "2", "===", "count", "(", "$", "constructor", ")", ")", "{", "return", "call_user_func", "(", "$", "constructor", ")", ";", "}", "return", "new", "$", "constructor", "[", "0", "]", ";", "}" ]
Creates container from string-based class spec. @param string $classSpec @return mixed
[ "Creates", "container", "from", "string", "-", "based", "class", "spec", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php#L181-L190
train
Behat/Behat
src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
ServicesResolverFactory.createResolvers
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.', get_class($container) ), get_class($container) ); } if ($autowire) { return array(new ServicesResolver($container), new AutowiringResolver($container)); } return array(new ServicesResolver($container)); }
php
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.', get_class($container) ), get_class($container) ); } if ($autowire) { return array(new ServicesResolver($container), new AutowiringResolver($container)); } return array(new ServicesResolver($container)); }
[ "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.'", ",", "get_class", "(", "$", "container", ")", ")", ",", "get_class", "(", "$", "container", ")", ")", ";", "}", "if", "(", "$", "autowire", ")", "{", "return", "array", "(", "new", "ServicesResolver", "(", "$", "container", ")", ",", "new", "AutowiringResolver", "(", "$", "container", ")", ")", ";", "}", "return", "array", "(", "new", "ServicesResolver", "(", "$", "container", ")", ")", ";", "}" ]
Checks if container implements the correct interface and creates resolver using it. @param mixed $container @param bool $autowire @return ArgumentResolver[] @throws WrongContainerClassException
[ "Checks", "if", "container", "implements", "the", "correct", "interface", "and", "creates", "resolver", "using", "it", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php#L202-L219
train
Behat/Behat
src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php
RuntimeScenarioHook.isMatchTagFilter
protected function isMatchTagFilter(FeatureNode $feature, ScenarioInterface $scenario, $filterString) { $filter = new TagFilter($filterString); if ($filter->isFeatureMatch($feature)) { return true; } return $filter->isScenarioMatch($feature, $scenario); }
php
protected function isMatchTagFilter(FeatureNode $feature, ScenarioInterface $scenario, $filterString) { $filter = new TagFilter($filterString); if ($filter->isFeatureMatch($feature)) { return true; } return $filter->isScenarioMatch($feature, $scenario); }
[ "protected", "function", "isMatchTagFilter", "(", "FeatureNode", "$", "feature", ",", "ScenarioInterface", "$", "scenario", ",", "$", "filterString", ")", "{", "$", "filter", "=", "new", "TagFilter", "(", "$", "filterString", ")", ";", "if", "(", "$", "filter", "->", "isFeatureMatch", "(", "$", "feature", ")", ")", "{", "return", "true", ";", "}", "return", "$", "filter", "->", "isScenarioMatch", "(", "$", "feature", ",", "$", "scenario", ")", ";", "}" ]
Checks if node match tag filter. @param FeatureNode $feature @param ScenarioInterface $scenario @param string $filterString @return Boolean
[ "Checks", "if", "node", "match", "tag", "filter", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php#L75-L84
train
Behat/Behat
src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php
RuntimeScenarioHook.isMatchNameFilter
protected function isMatchNameFilter(ScenarioInterface $scenario, $filterString) { $filter = new NameFilter($filterString); return $filter->isScenarioMatch($scenario); }
php
protected function isMatchNameFilter(ScenarioInterface $scenario, $filterString) { $filter = new NameFilter($filterString); return $filter->isScenarioMatch($scenario); }
[ "protected", "function", "isMatchNameFilter", "(", "ScenarioInterface", "$", "scenario", ",", "$", "filterString", ")", "{", "$", "filter", "=", "new", "NameFilter", "(", "$", "filterString", ")", ";", "return", "$", "filter", "->", "isScenarioMatch", "(", "$", "scenario", ")", ";", "}" ]
Checks if scenario matches name filter. @param ScenarioInterface $scenario @param string $filterString @return Boolean
[ "Checks", "if", "scenario", "matches", "name", "filter", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php#L94-L99
train
Behat/Behat
src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php
RuntimeFeatureHook.isMatchTagFilter
private function isMatchTagFilter(FeatureNode $feature, $filterString) { $filter = new TagFilter($filterString); return $filter->isFeatureMatch($feature); }
php
private function isMatchTagFilter(FeatureNode $feature, $filterString) { $filter = new TagFilter($filterString); return $filter->isFeatureMatch($feature); }
[ "private", "function", "isMatchTagFilter", "(", "FeatureNode", "$", "feature", ",", "$", "filterString", ")", "{", "$", "filter", "=", "new", "TagFilter", "(", "$", "filterString", ")", ";", "return", "$", "filter", "->", "isFeatureMatch", "(", "$", "feature", ")", ";", "}" ]
Checks if feature matches tag filter. @param FeatureNode $feature @param string $filterString @return Boolean
[ "Checks", "if", "feature", "matches", "tag", "filter", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php#L94-L99
train
Behat/Behat
src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php
RuntimeFeatureHook.isMatchNameFilter
private function isMatchNameFilter(FeatureNode $feature, $filterString) { $filter = new NameFilter($filterString); return $filter->isFeatureMatch($feature); }
php
private function isMatchNameFilter(FeatureNode $feature, $filterString) { $filter = new NameFilter($filterString); return $filter->isFeatureMatch($feature); }
[ "private", "function", "isMatchNameFilter", "(", "FeatureNode", "$", "feature", ",", "$", "filterString", ")", "{", "$", "filter", "=", "new", "NameFilter", "(", "$", "filterString", ")", ";", "return", "$", "filter", "->", "isFeatureMatch", "(", "$", "feature", ")", ";", "}" ]
Checks if feature matches name filter. @param FeatureNode $feature @param string $filterString @return Boolean
[ "Checks", "if", "feature", "matches", "name", "filter", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php#L109-L114
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
FirstBackgroundFiresFirstListener.isEventDelayedUntilFirstBackgroundPrinted
private function isEventDelayedUntilFirstBackgroundPrinted(Event $event) { if (!$event instanceof ScenarioTested && !$event instanceof OutlineTested && !$event instanceof ExampleTested) { return false; } return !$this->firstBackgroundEnded && $event->getFeature()->hasBackground(); }
php
private function isEventDelayedUntilFirstBackgroundPrinted(Event $event) { if (!$event instanceof ScenarioTested && !$event instanceof OutlineTested && !$event instanceof ExampleTested) { return false; } return !$this->firstBackgroundEnded && $event->getFeature()->hasBackground(); }
[ "private", "function", "isEventDelayedUntilFirstBackgroundPrinted", "(", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "ScenarioTested", "&&", "!", "$", "event", "instanceof", "OutlineTested", "&&", "!", "$", "event", "instanceof", "ExampleTested", ")", "{", "return", "false", ";", "}", "return", "!", "$", "this", "->", "firstBackgroundEnded", "&&", "$", "event", "->", "getFeature", "(", ")", "->", "hasBackground", "(", ")", ";", "}" ]
Checks if provided event should be postponed until background is printed. @param Event $event @return Boolean
[ "Checks", "if", "provided", "event", "should", "be", "postponed", "until", "background", "is", "printed", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php#L108-L115
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
FirstBackgroundFiresFirstListener.fireDelayedEventsOnAfterBackground
private function fireDelayedEventsOnAfterBackground(Formatter $formatter, $eventName) { if (BackgroundTested::AFTER !== $eventName) { return; } foreach ($this->delayedUntilBackgroundEnd as $eventInfo) { list($event, $eventName) = $eventInfo; $this->descendant->listenEvent($formatter, $event, $eventName); } $this->delayedUntilBackgroundEnd = array(); }
php
private function fireDelayedEventsOnAfterBackground(Formatter $formatter, $eventName) { if (BackgroundTested::AFTER !== $eventName) { return; } foreach ($this->delayedUntilBackgroundEnd as $eventInfo) { list($event, $eventName) = $eventInfo; $this->descendant->listenEvent($formatter, $event, $eventName); } $this->delayedUntilBackgroundEnd = array(); }
[ "private", "function", "fireDelayedEventsOnAfterBackground", "(", "Formatter", "$", "formatter", ",", "$", "eventName", ")", "{", "if", "(", "BackgroundTested", "::", "AFTER", "!==", "$", "eventName", ")", "{", "return", ";", "}", "foreach", "(", "$", "this", "->", "delayedUntilBackgroundEnd", "as", "$", "eventInfo", ")", "{", "list", "(", "$", "event", ",", "$", "eventName", ")", "=", "$", "eventInfo", ";", "$", "this", "->", "descendant", "->", "listenEvent", "(", "$", "formatter", ",", "$", "event", ",", "$", "eventName", ")", ";", "}", "$", "this", "->", "delayedUntilBackgroundEnd", "=", "array", "(", ")", ";", "}" ]
Fires delayed events on AFTER background event. @param Formatter $formatter @param string $eventName
[ "Fires", "delayed", "events", "on", "AFTER", "background", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php#L123-L136
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
OutlineListener.printAndCaptureOutlineHeaderOnBeforeEvent
private function printAndCaptureOutlineHeaderOnBeforeEvent(Formatter $formatter, Event $event) { if (!$event instanceof BeforeOutlineTested) { return; } $this->outlinePrinter->printHeader($formatter, $event->getFeature(), $event->getOutline()); }
php
private function printAndCaptureOutlineHeaderOnBeforeEvent(Formatter $formatter, Event $event) { if (!$event instanceof BeforeOutlineTested) { return; } $this->outlinePrinter->printHeader($formatter, $event->getFeature(), $event->getOutline()); }
[ "private", "function", "printAndCaptureOutlineHeaderOnBeforeEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "BeforeOutlineTested", ")", "{", "return", ";", "}", "$", "this", "->", "outlinePrinter", "->", "printHeader", "(", "$", "formatter", ",", "$", "event", "->", "getFeature", "(", ")", ",", "$", "event", "->", "getOutline", "(", ")", ")", ";", "}" ]
Prints outline header and captures outline into ivar on BEFORE event. @param Formatter $formatter @param Event $event
[ "Prints", "outline", "header", "and", "captures", "outline", "into", "ivar", "on", "BEFORE", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php#L103-L110
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
OutlineListener.printAndForgetOutlineFooterOnAfterEvent
private function printAndForgetOutlineFooterOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterOutlineTested) { return; } $this->outlinePrinter->printFooter($formatter, $event->getTestResult()); }
php
private function printAndForgetOutlineFooterOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterOutlineTested) { return; } $this->outlinePrinter->printFooter($formatter, $event->getTestResult()); }
[ "private", "function", "printAndForgetOutlineFooterOnAfterEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterOutlineTested", ")", "{", "return", ";", "}", "$", "this", "->", "outlinePrinter", "->", "printFooter", "(", "$", "formatter", ",", "$", "event", "->", "getTestResult", "(", ")", ")", ";", "}" ]
Prints outline footer and removes outline from ivar on AFTER event. @param Formatter $formatter @param Event $event
[ "Prints", "outline", "footer", "and", "removes", "outline", "from", "ivar", "on", "AFTER", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php#L118-L125
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
OutlineListener.printExampleHeaderOnBeforeExampleEvent
private function printExampleHeaderOnBeforeExampleEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterScenarioSetup) { return; } $this->example = $event->getScenario(); $this->exampleSetupPrinter->printSetup($formatter, $event->getSetup()); $this->examplePrinter->printHeader($formatter, $event->getFeature(), $this->example); }
php
private function printExampleHeaderOnBeforeExampleEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterScenarioSetup) { return; } $this->example = $event->getScenario(); $this->exampleSetupPrinter->printSetup($formatter, $event->getSetup()); $this->examplePrinter->printHeader($formatter, $event->getFeature(), $this->example); }
[ "private", "function", "printExampleHeaderOnBeforeExampleEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterScenarioSetup", ")", "{", "return", ";", "}", "$", "this", "->", "example", "=", "$", "event", "->", "getScenario", "(", ")", ";", "$", "this", "->", "exampleSetupPrinter", "->", "printSetup", "(", "$", "formatter", ",", "$", "event", "->", "getSetup", "(", ")", ")", ";", "$", "this", "->", "examplePrinter", "->", "printHeader", "(", "$", "formatter", ",", "$", "event", "->", "getFeature", "(", ")", ",", "$", "this", "->", "example", ")", ";", "}" ]
Prints example header on example BEFORE event. @param Formatter $formatter @param Event $event
[ "Prints", "example", "header", "on", "example", "BEFORE", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php#L133-L143
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
OutlineListener.printExampleFooterOnAfterExampleEvent
private function printExampleFooterOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName) { if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) { return; } $this->examplePrinter->printFooter($formatter, $event->getTestResult()); $this->exampleSetupPrinter->printTeardown($formatter, $event->getTeardown()); $this->example = null; }
php
private function printExampleFooterOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName) { if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) { return; } $this->examplePrinter->printFooter($formatter, $event->getTestResult()); $this->exampleSetupPrinter->printTeardown($formatter, $event->getTeardown()); $this->example = null; }
[ "private", "function", "printExampleFooterOnAfterExampleEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ",", "$", "eventName", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterScenarioTested", "||", "ExampleTested", "::", "AFTER", "!==", "$", "eventName", ")", "{", "return", ";", "}", "$", "this", "->", "examplePrinter", "->", "printFooter", "(", "$", "formatter", ",", "$", "event", "->", "getTestResult", "(", ")", ")", ";", "$", "this", "->", "exampleSetupPrinter", "->", "printTeardown", "(", "$", "formatter", ",", "$", "event", "->", "getTeardown", "(", ")", ")", ";", "$", "this", "->", "example", "=", "null", ";", "}" ]
Prints example footer on example AFTER event. @param Formatter $formatter @param Event $event @param string $eventName
[ "Prints", "example", "footer", "on", "example", "AFTER", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php#L152-L162
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
OutlineListener.printStepSetupOnBeforeStepEvent
private function printStepSetupOnBeforeStepEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepSetup) { return; } $this->stepSetupPrinter->printSetup($formatter, $event->getSetup()); }
php
private function printStepSetupOnBeforeStepEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepSetup) { return; } $this->stepSetupPrinter->printSetup($formatter, $event->getSetup()); }
[ "private", "function", "printStepSetupOnBeforeStepEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterStepSetup", ")", "{", "return", ";", "}", "$", "this", "->", "stepSetupPrinter", "->", "printSetup", "(", "$", "formatter", ",", "$", "event", "->", "getSetup", "(", ")", ")", ";", "}" ]
Prints step setup on step BEFORE event. @param Formatter $formatter @param Event $event
[ "Prints", "step", "setup", "on", "step", "BEFORE", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php#L170-L177
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
OutlineListener.printStepOnAfterStepEvent
private function printStepOnAfterStepEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepTested) { return; } $this->stepPrinter->printStep($formatter, $this->example, $event->getStep(), $event->getTestResult()); $this->stepSetupPrinter->printTeardown($formatter, $event->getTeardown()); }
php
private function printStepOnAfterStepEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepTested) { return; } $this->stepPrinter->printStep($formatter, $this->example, $event->getStep(), $event->getTestResult()); $this->stepSetupPrinter->printTeardown($formatter, $event->getTeardown()); }
[ "private", "function", "printStepOnAfterStepEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterStepTested", ")", "{", "return", ";", "}", "$", "this", "->", "stepPrinter", "->", "printStep", "(", "$", "formatter", ",", "$", "this", "->", "example", ",", "$", "event", "->", "getStep", "(", ")", ",", "$", "event", "->", "getTestResult", "(", ")", ")", ";", "$", "this", "->", "stepSetupPrinter", "->", "printTeardown", "(", "$", "formatter", ",", "$", "event", "->", "getTeardown", "(", ")", ")", ";", "}" ]
Prints example step on step AFTER event. @param Formatter $formatter @param Event $event
[ "Prints", "example", "step", "on", "step", "AFTER", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php#L185-L193
train
Behat/Behat
src/Behat/Behat/Transformation/Transformation/PatternTransformation.php
PatternTransformation.supportsDefinitionAndArgument
public function supportsDefinitionAndArgument( RegexGenerator $regexGenerator, DefinitionCall $definitionCall, $argumentValue ) { $regex = $regexGenerator->generateRegex( $definitionCall->getEnvironment()->getSuite()->getName(), $this->pattern, $definitionCall->getFeature()->getLanguage() ); return $this->match($regex, $argumentValue, $match); }
php
public function supportsDefinitionAndArgument( RegexGenerator $regexGenerator, DefinitionCall $definitionCall, $argumentValue ) { $regex = $regexGenerator->generateRegex( $definitionCall->getEnvironment()->getSuite()->getName(), $this->pattern, $definitionCall->getFeature()->getLanguage() ); return $this->match($regex, $argumentValue, $match); }
[ "public", "function", "supportsDefinitionAndArgument", "(", "RegexGenerator", "$", "regexGenerator", ",", "DefinitionCall", "$", "definitionCall", ",", "$", "argumentValue", ")", "{", "$", "regex", "=", "$", "regexGenerator", "->", "generateRegex", "(", "$", "definitionCall", "->", "getEnvironment", "(", ")", "->", "getSuite", "(", ")", "->", "getName", "(", ")", ",", "$", "this", "->", "pattern", ",", "$", "definitionCall", "->", "getFeature", "(", ")", "->", "getLanguage", "(", ")", ")", ";", "return", "$", "this", "->", "match", "(", "$", "regex", ",", "$", "argumentValue", ",", "$", "match", ")", ";", "}" ]
Checks if transformer supports argument. @param RegexGenerator $regexGenerator @param DefinitionCall $definitionCall @param mixed $argumentValue @return bool
[ "Checks", "if", "transformer", "supports", "argument", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/Transformation/PatternTransformation.php#L56-L68
train
Behat/Behat
src/Behat/Behat/Transformation/Transformation/PatternTransformation.php
PatternTransformation.transformArgument
public function transformArgument( RegexGenerator $regexGenerator, CallCenter $callCenter, DefinitionCall $definitionCall, $argumentValue ) { $regex = $regexGenerator->generateRegex( $definitionCall->getEnvironment()->getSuite()->getName(), $this->pattern, $definitionCall->getFeature()->getLanguage() ); $this->match($regex, $argumentValue, $arguments); $call = new TransformationCall( $definitionCall->getEnvironment(), $definitionCall->getCallee(), $this, $arguments ); $result = $callCenter->makeCall($call); if ($result->hasException()) { throw $result->getException(); } return $result->getReturn(); }
php
public function transformArgument( RegexGenerator $regexGenerator, CallCenter $callCenter, DefinitionCall $definitionCall, $argumentValue ) { $regex = $regexGenerator->generateRegex( $definitionCall->getEnvironment()->getSuite()->getName(), $this->pattern, $definitionCall->getFeature()->getLanguage() ); $this->match($regex, $argumentValue, $arguments); $call = new TransformationCall( $definitionCall->getEnvironment(), $definitionCall->getCallee(), $this, $arguments ); $result = $callCenter->makeCall($call); if ($result->hasException()) { throw $result->getException(); } return $result->getReturn(); }
[ "public", "function", "transformArgument", "(", "RegexGenerator", "$", "regexGenerator", ",", "CallCenter", "$", "callCenter", ",", "DefinitionCall", "$", "definitionCall", ",", "$", "argumentValue", ")", "{", "$", "regex", "=", "$", "regexGenerator", "->", "generateRegex", "(", "$", "definitionCall", "->", "getEnvironment", "(", ")", "->", "getSuite", "(", ")", "->", "getName", "(", ")", ",", "$", "this", "->", "pattern", ",", "$", "definitionCall", "->", "getFeature", "(", ")", "->", "getLanguage", "(", ")", ")", ";", "$", "this", "->", "match", "(", "$", "regex", ",", "$", "argumentValue", ",", "$", "arguments", ")", ";", "$", "call", "=", "new", "TransformationCall", "(", "$", "definitionCall", "->", "getEnvironment", "(", ")", ",", "$", "definitionCall", "->", "getCallee", "(", ")", ",", "$", "this", ",", "$", "arguments", ")", ";", "$", "result", "=", "$", "callCenter", "->", "makeCall", "(", "$", "call", ")", ";", "if", "(", "$", "result", "->", "hasException", "(", ")", ")", "{", "throw", "$", "result", "->", "getException", "(", ")", ";", "}", "return", "$", "result", "->", "getReturn", "(", ")", ";", "}" ]
Transforms argument value using transformation and returns a new one. @param RegexGenerator $regexGenerator @param CallCenter $callCenter @param DefinitionCall $definitionCall @param mixed $argumentValue @return mixed @throws Exception If transformation throws exception
[ "Transforms", "argument", "value", "using", "transformation", "and", "returns", "a", "new", "one", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/Transformation/PatternTransformation.php#L82-L110
train
Behat/Behat
src/Behat/Behat/Snippet/SnippetRegistry.php
SnippetRegistry.registerUndefinedStep
public function registerUndefinedStep(Environment $environment, StepNode $step) { $this->undefinedSteps[] = new UndefinedStep($environment, $step); $this->snippetsGenerated = false; }
php
public function registerUndefinedStep(Environment $environment, StepNode $step) { $this->undefinedSteps[] = new UndefinedStep($environment, $step); $this->snippetsGenerated = false; }
[ "public", "function", "registerUndefinedStep", "(", "Environment", "$", "environment", ",", "StepNode", "$", "step", ")", "{", "$", "this", "->", "undefinedSteps", "[", "]", "=", "new", "UndefinedStep", "(", "$", "environment", ",", "$", "step", ")", ";", "$", "this", "->", "snippetsGenerated", "=", "false", ";", "}" ]
Generates and registers snippet. @param Environment $environment @param StepNode $step @return null|Snippet
[ "Generates", "and", "registers", "snippet", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/SnippetRegistry.php#L60-L64
train
Behat/Behat
src/Behat/Behat/Snippet/SnippetRegistry.php
SnippetRegistry.generateSnippets
private function generateSnippets() { if ($this->snippetsGenerated) { return null; } $snippetsSet = array(); foreach ($this->undefinedSteps as $i => $undefinedStep) { $snippet = $this->generateSnippet($undefinedStep->getEnvironment(), $undefinedStep->getStep()); if (!$snippet) { continue; } if (!isset($snippetsSet[$snippet->getHash()])) { $snippetsSet[$snippet->getHash()] = array(); } $snippetsSet[$snippet->getHash()][] = $snippet; unset($this->undefinedSteps[$i]); } $this->snippets = array_values( array_map( function (array $snippets) { return new AggregateSnippet($snippets); }, $snippetsSet ) ); $this->undefinedSteps = array_values($this->undefinedSteps); $this->snippetsGenerated = true; }
php
private function generateSnippets() { if ($this->snippetsGenerated) { return null; } $snippetsSet = array(); foreach ($this->undefinedSteps as $i => $undefinedStep) { $snippet = $this->generateSnippet($undefinedStep->getEnvironment(), $undefinedStep->getStep()); if (!$snippet) { continue; } if (!isset($snippetsSet[$snippet->getHash()])) { $snippetsSet[$snippet->getHash()] = array(); } $snippetsSet[$snippet->getHash()][] = $snippet; unset($this->undefinedSteps[$i]); } $this->snippets = array_values( array_map( function (array $snippets) { return new AggregateSnippet($snippets); }, $snippetsSet ) ); $this->undefinedSteps = array_values($this->undefinedSteps); $this->snippetsGenerated = true; }
[ "private", "function", "generateSnippets", "(", ")", "{", "if", "(", "$", "this", "->", "snippetsGenerated", ")", "{", "return", "null", ";", "}", "$", "snippetsSet", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "undefinedSteps", "as", "$", "i", "=>", "$", "undefinedStep", ")", "{", "$", "snippet", "=", "$", "this", "->", "generateSnippet", "(", "$", "undefinedStep", "->", "getEnvironment", "(", ")", ",", "$", "undefinedStep", "->", "getStep", "(", ")", ")", ";", "if", "(", "!", "$", "snippet", ")", "{", "continue", ";", "}", "if", "(", "!", "isset", "(", "$", "snippetsSet", "[", "$", "snippet", "->", "getHash", "(", ")", "]", ")", ")", "{", "$", "snippetsSet", "[", "$", "snippet", "->", "getHash", "(", ")", "]", "=", "array", "(", ")", ";", "}", "$", "snippetsSet", "[", "$", "snippet", "->", "getHash", "(", ")", "]", "[", "]", "=", "$", "snippet", ";", "unset", "(", "$", "this", "->", "undefinedSteps", "[", "$", "i", "]", ")", ";", "}", "$", "this", "->", "snippets", "=", "array_values", "(", "array_map", "(", "function", "(", "array", "$", "snippets", ")", "{", "return", "new", "AggregateSnippet", "(", "$", "snippets", ")", ";", "}", ",", "$", "snippetsSet", ")", ")", ";", "$", "this", "->", "undefinedSteps", "=", "array_values", "(", "$", "this", "->", "undefinedSteps", ")", ";", "$", "this", "->", "snippetsGenerated", "=", "true", ";", "}" ]
Generates snippets for undefined steps.
[ "Generates", "snippets", "for", "undefined", "steps", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/SnippetRegistry.php#L93-L125
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php
StepStatsListener.captureScenarioOnBeforeFeatureEvent
private function captureScenarioOnBeforeFeatureEvent(Event $event) { if (!$event instanceof BeforeScenarioTested) { return; } $this->scenarioTitle = sprintf('%s: %s', $event->getScenario()->getKeyword(), $event->getScenario()->getTitle()); $this->scenarioPath = sprintf('%s:%s', $this->currentFeaturePath, $event->getScenario()->getLine()); }
php
private function captureScenarioOnBeforeFeatureEvent(Event $event) { if (!$event instanceof BeforeScenarioTested) { return; } $this->scenarioTitle = sprintf('%s: %s', $event->getScenario()->getKeyword(), $event->getScenario()->getTitle()); $this->scenarioPath = sprintf('%s:%s', $this->currentFeaturePath, $event->getScenario()->getLine()); }
[ "private", "function", "captureScenarioOnBeforeFeatureEvent", "(", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "BeforeScenarioTested", ")", "{", "return", ";", "}", "$", "this", "->", "scenarioTitle", "=", "sprintf", "(", "'%s: %s'", ",", "$", "event", "->", "getScenario", "(", ")", "->", "getKeyword", "(", ")", ",", "$", "event", "->", "getScenario", "(", ")", "->", "getTitle", "(", ")", ")", ";", "$", "this", "->", "scenarioPath", "=", "sprintf", "(", "'%s:%s'", ",", "$", "this", "->", "currentFeaturePath", ",", "$", "event", "->", "getScenario", "(", ")", "->", "getLine", "(", ")", ")", ";", "}" ]
Captures current scenario title and path on scenario BEFORE event. @param Event $event
[ "Captures", "current", "scenario", "title", "and", "path", "on", "scenario", "BEFORE", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php#L116-L124
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php
StepStatsListener.captureStepStatsOnAfterEvent
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 = $this->getStepException($result); $path = $this->getStepPath($event, $exception); $error = $exception ? $this->exceptionPresenter->presentException($exception) : null; $stdOut = $result instanceof ExecutedStepResult ? $result->getCallResult()->getStdOut() : null; $resultCode = $result->getResultCode(); $stat = new StepStatV2($this->scenarioTitle, $this->scenarioPath, $text, $path, $resultCode, $error, $stdOut); $this->statistics->registerStepStat($stat); }
php
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 = $this->getStepException($result); $path = $this->getStepPath($event, $exception); $error = $exception ? $this->exceptionPresenter->presentException($exception) : null; $stdOut = $result instanceof ExecutedStepResult ? $result->getCallResult()->getStdOut() : null; $resultCode = $result->getResultCode(); $stat = new StepStatV2($this->scenarioTitle, $this->scenarioPath, $text, $path, $resultCode, $error, $stdOut); $this->statistics->registerStepStat($stat); }
[ "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", "=", "$", "this", "->", "getStepException", "(", "$", "result", ")", ";", "$", "path", "=", "$", "this", "->", "getStepPath", "(", "$", "event", ",", "$", "exception", ")", ";", "$", "error", "=", "$", "exception", "?", "$", "this", "->", "exceptionPresenter", "->", "presentException", "(", "$", "exception", ")", ":", "null", ";", "$", "stdOut", "=", "$", "result", "instanceof", "ExecutedStepResult", "?", "$", "result", "->", "getCallResult", "(", ")", "->", "getStdOut", "(", ")", ":", "null", ";", "$", "resultCode", "=", "$", "result", "->", "getResultCode", "(", ")", ";", "$", "stat", "=", "new", "StepStatV2", "(", "$", "this", "->", "scenarioTitle", ",", "$", "this", "->", "scenarioPath", ",", "$", "text", ",", "$", "path", ",", "$", "resultCode", ",", "$", "error", ",", "$", "stdOut", ")", ";", "$", "this", "->", "statistics", "->", "registerStepStat", "(", "$", "stat", ")", ";", "}" ]
Captures step stats on step AFTER event. @param Event $event
[ "Captures", "step", "stats", "on", "step", "AFTER", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php#L140-L159
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php
StepStatsListener.getStepPath
private function getStepPath(AfterStepTested $event, Exception $exception = null) { $path = sprintf('%s:%d', $this->currentFeaturePath, $event->getStep()->getLine()); if ($exception && $exception instanceof PendingException) { $path = $event->getTestResult()->getStepDefinition()->getPath(); } return $path; }
php
private function getStepPath(AfterStepTested $event, Exception $exception = null) { $path = sprintf('%s:%d', $this->currentFeaturePath, $event->getStep()->getLine()); if ($exception && $exception instanceof PendingException) { $path = $event->getTestResult()->getStepDefinition()->getPath(); } return $path; }
[ "private", "function", "getStepPath", "(", "AfterStepTested", "$", "event", ",", "Exception", "$", "exception", "=", "null", ")", "{", "$", "path", "=", "sprintf", "(", "'%s:%d'", ",", "$", "this", "->", "currentFeaturePath", ",", "$", "event", "->", "getStep", "(", ")", "->", "getLine", "(", ")", ")", ";", "if", "(", "$", "exception", "&&", "$", "exception", "instanceof", "PendingException", ")", "{", "$", "path", "=", "$", "event", "->", "getTestResult", "(", ")", "->", "getStepDefinition", "(", ")", "->", "getPath", "(", ")", ";", "}", "return", "$", "path", ";", "}" ]
Gets step path from the AFTER test event and exception. @param AfterStepTested $event @param null|Exception $exception @return string
[ "Gets", "step", "path", "from", "the", "AFTER", "test", "event", "and", "exception", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php#L185-L194
train
Behat/Behat
src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
ArgumentAutowirer.autowireArguments
public function autowireArguments(ReflectionFunctionAbstract $reflection, array $arguments) { $newArguments = $arguments; foreach ($reflection->getParameters() as $index => $parameter) { if ($this->isArgumentWireable($newArguments, $index, $parameter)) { $newArguments[$index] = $this->container->get($parameter->getClass()->getName()); } } return $newArguments; }
php
public function autowireArguments(ReflectionFunctionAbstract $reflection, array $arguments) { $newArguments = $arguments; foreach ($reflection->getParameters() as $index => $parameter) { if ($this->isArgumentWireable($newArguments, $index, $parameter)) { $newArguments[$index] = $this->container->get($parameter->getClass()->getName()); } } return $newArguments; }
[ "public", "function", "autowireArguments", "(", "ReflectionFunctionAbstract", "$", "reflection", ",", "array", "$", "arguments", ")", "{", "$", "newArguments", "=", "$", "arguments", ";", "foreach", "(", "$", "reflection", "->", "getParameters", "(", ")", "as", "$", "index", "=>", "$", "parameter", ")", "{", "if", "(", "$", "this", "->", "isArgumentWireable", "(", "$", "newArguments", ",", "$", "index", ",", "$", "parameter", ")", ")", "{", "$", "newArguments", "[", "$", "index", "]", "=", "$", "this", "->", "container", "->", "get", "(", "$", "parameter", "->", "getClass", "(", ")", "->", "getName", "(", ")", ")", ";", "}", "}", "return", "$", "newArguments", ";", "}" ]
Autowires given arguments using provided container. @param ReflectionFunctionAbstract $reflection @param array $arguments @return array @throws ContainerExceptionInterface if unset argument typehint can not be resolved from container
[ "Autowires", "given", "arguments", "using", "provided", "container", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php#L51-L61
train
Behat/Behat
src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
ArgumentAutowirer.isArgumentWireable
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(), $arguments)) { return false; } try { return (bool) $parameter->getClass(); } catch (ReflectionException $e) { return false; } }
php
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(), $arguments)) { return false; } try { return (bool) $parameter->getClass(); } catch (ReflectionException $e) { return false; } }
[ "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", "(", ")", ",", "$", "arguments", ")", ")", "{", "return", "false", ";", "}", "try", "{", "return", "(", "bool", ")", "$", "parameter", "->", "getClass", "(", ")", ";", "}", "catch", "(", "ReflectionException", "$", "e", ")", "{", "return", "false", ";", "}", "}" ]
Checks if given argument is wireable. Argument is wireable if it was not previously set and it has a class type-hint. @param array $arguments @param integer $index @param ReflectionParameter $parameter @return bool
[ "Checks", "if", "given", "argument", "is", "wireable", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php#L74-L89
train
Behat/Behat
src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php
BeforeStepTeardown.resultCallHasOutput
private function resultCallHasOutput() { if (!$this->result instanceof ExecutedStepResult) { return false; } return $this->result->getCallResult()->hasStdOut() || $this->result->getCallResult()->hasException(); }
php
private function resultCallHasOutput() { if (!$this->result instanceof ExecutedStepResult) { return false; } return $this->result->getCallResult()->hasStdOut() || $this->result->getCallResult()->hasException(); }
[ "private", "function", "resultCallHasOutput", "(", ")", "{", "if", "(", "!", "$", "this", "->", "result", "instanceof", "ExecutedStepResult", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "result", "->", "getCallResult", "(", ")", "->", "hasStdOut", "(", ")", "||", "$", "this", "->", "result", "->", "getCallResult", "(", ")", "->", "hasException", "(", ")", ";", "}" ]
Checks if result is executed and call result has produced exception or stdOut. @return Boolean
[ "Checks", "if", "result", "is", "executed", "and", "call", "result", "has", "produced", "exception", "or", "stdOut", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php#L118-L125
train
Behat/Behat
src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php
DefinitionExtension.loadFinder
private function loadFinder(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\DefinitionFinder'); $container->setDefinition(self::FINDER_ID, $definition); }
php
private function loadFinder(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\DefinitionFinder'); $container->setDefinition(self::FINDER_ID, $definition); }
[ "private", "function", "loadFinder", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "definition", "=", "new", "Definition", "(", "'Behat\\Behat\\Definition\\DefinitionFinder'", ")", ";", "$", "container", "->", "setDefinition", "(", "self", "::", "FINDER_ID", ",", "$", "definition", ")", ";", "}" ]
Loads definition finder. @param ContainerBuilder $container
[ "Loads", "definition", "finder", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php#L118-L122
train
Behat/Behat
src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php
DefinitionExtension.loadWriter
private function loadWriter(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\DefinitionWriter', array( new Reference(EnvironmentExtension::MANAGER_ID), new Reference(self::REPOSITORY_ID) )); $container->setDefinition(self::WRITER_ID, $definition); }
php
private function loadWriter(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\DefinitionWriter', array( new Reference(EnvironmentExtension::MANAGER_ID), new Reference(self::REPOSITORY_ID) )); $container->setDefinition(self::WRITER_ID, $definition); }
[ "private", "function", "loadWriter", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "definition", "=", "new", "Definition", "(", "'Behat\\Behat\\Definition\\DefinitionWriter'", ",", "array", "(", "new", "Reference", "(", "EnvironmentExtension", "::", "MANAGER_ID", ")", ",", "new", "Reference", "(", "self", "::", "REPOSITORY_ID", ")", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "self", "::", "WRITER_ID", ",", "$", "definition", ")", ";", "}" ]
Loads definition writer. @param ContainerBuilder $container
[ "Loads", "definition", "writer", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php#L142-L149
train
Behat/Behat
src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php
DefinitionExtension.loadPatternTransformer
private function loadPatternTransformer(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Pattern\PatternTransformer'); $container->setDefinition(self::PATTERN_TRANSFORMER_ID, $definition); }
php
private function loadPatternTransformer(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Pattern\PatternTransformer'); $container->setDefinition(self::PATTERN_TRANSFORMER_ID, $definition); }
[ "private", "function", "loadPatternTransformer", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "definition", "=", "new", "Definition", "(", "'Behat\\Behat\\Definition\\Pattern\\PatternTransformer'", ")", ";", "$", "container", "->", "setDefinition", "(", "self", "::", "PATTERN_TRANSFORMER_ID", ",", "$", "definition", ")", ";", "}" ]
Loads definition pattern transformer. @param ContainerBuilder $container
[ "Loads", "definition", "pattern", "transformer", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php#L156-L160
train
Behat/Behat
src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php
DefinitionExtension.loadDefinitionTranslator
private function loadDefinitionTranslator(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Translator\DefinitionTranslator', array( new Reference(TranslatorExtension::TRANSLATOR_ID) )); $container->setDefinition(self::DEFINITION_TRANSLATOR_ID, $definition); }
php
private function loadDefinitionTranslator(ContainerBuilder $container) { $definition = new Definition('Behat\Behat\Definition\Translator\DefinitionTranslator', array( new Reference(TranslatorExtension::TRANSLATOR_ID) )); $container->setDefinition(self::DEFINITION_TRANSLATOR_ID, $definition); }
[ "private", "function", "loadDefinitionTranslator", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "definition", "=", "new", "Definition", "(", "'Behat\\Behat\\Definition\\Translator\\DefinitionTranslator'", ",", "array", "(", "new", "Reference", "(", "TranslatorExtension", "::", "TRANSLATOR_ID", ")", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "self", "::", "DEFINITION_TRANSLATOR_ID", ",", "$", "definition", ")", ";", "}" ]
Loads definition translator. @param ContainerBuilder $container
[ "Loads", "definition", "translator", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php#L167-L173
train
Behat/Behat
src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php
DefinitionExtension.loadDefaultSearchEngines
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), new Reference(self::DEFINITION_TRANSLATOR_ID), new Reference(ArgumentExtension::PREG_MATCH_ARGUMENT_ORGANISER_ID) )); $definition->addTag(self::SEARCH_ENGINE_TAG, array('priority' => 50)); $container->setDefinition(self::SEARCH_ENGINE_TAG . '.repository', $definition); }
php
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), new Reference(self::DEFINITION_TRANSLATOR_ID), new Reference(ArgumentExtension::PREG_MATCH_ARGUMENT_ORGANISER_ID) )); $definition->addTag(self::SEARCH_ENGINE_TAG, array('priority' => 50)); $container->setDefinition(self::SEARCH_ENGINE_TAG . '.repository', $definition); }
[ "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", ")", ",", "new", "Reference", "(", "self", "::", "DEFINITION_TRANSLATOR_ID", ")", ",", "new", "Reference", "(", "ArgumentExtension", "::", "PREG_MATCH_ARGUMENT_ORGANISER_ID", ")", ")", ")", ";", "$", "definition", "->", "addTag", "(", "self", "::", "SEARCH_ENGINE_TAG", ",", "array", "(", "'priority'", "=>", "50", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "self", "::", "SEARCH_ENGINE_TAG", ".", "'.repository'", ",", "$", "definition", ")", ";", "}" ]
Loads default search engines. @param ContainerBuilder $container
[ "Loads", "default", "search", "engines", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php#L180-L190
train
Behat/Behat
src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php
DefinitionExtension.loadDefaultPatternPolicies
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 . '.turnip', $definition); $definition = new Definition('Behat\Behat\Definition\Pattern\Policy\RegexPatternPolicy'); $definition->addTag(self::PATTERN_POLICY_TAG, array('priority' => 60)); $container->setDefinition(self::PATTERN_POLICY_TAG . '.regex', $definition); }
php
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 . '.turnip', $definition); $definition = new Definition('Behat\Behat\Definition\Pattern\Policy\RegexPatternPolicy'); $definition->addTag(self::PATTERN_POLICY_TAG, array('priority' => 60)); $container->setDefinition(self::PATTERN_POLICY_TAG . '.regex', $definition); }
[ "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", ".", "'.turnip'", ",", "$", "definition", ")", ";", "$", "definition", "=", "new", "Definition", "(", "'Behat\\Behat\\Definition\\Pattern\\Policy\\RegexPatternPolicy'", ")", ";", "$", "definition", "->", "addTag", "(", "self", "::", "PATTERN_POLICY_TAG", ",", "array", "(", "'priority'", "=>", "60", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "self", "::", "PATTERN_POLICY_TAG", ".", "'.regex'", ",", "$", "definition", ")", ";", "}" ]
Loads default pattern policies. @param ContainerBuilder $container
[ "Loads", "default", "pattern", "policies", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php#L197-L206
train
Behat/Behat
src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php
DefinitionExtension.loadDefinitionPrinters
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 Reference(self::DEFINITION_TRANSLATOR_ID), new Reference(GherkinExtension::KEYWORDS_ID) )); $container->setDefinition($this->getInformationPrinterId(), $definition); $definition = new Definition('Behat\Behat\Definition\Printer\ConsoleDefinitionListPrinter', array( new Reference(CliExtension::OUTPUT_ID), new Reference(self::PATTERN_TRANSFORMER_ID), new Reference(self::DEFINITION_TRANSLATOR_ID), new Reference(GherkinExtension::KEYWORDS_ID) )); $container->setDefinition($this->getListPrinterId(), $definition); }
php
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 Reference(self::DEFINITION_TRANSLATOR_ID), new Reference(GherkinExtension::KEYWORDS_ID) )); $container->setDefinition($this->getInformationPrinterId(), $definition); $definition = new Definition('Behat\Behat\Definition\Printer\ConsoleDefinitionListPrinter', array( new Reference(CliExtension::OUTPUT_ID), new Reference(self::PATTERN_TRANSFORMER_ID), new Reference(self::DEFINITION_TRANSLATOR_ID), new Reference(GherkinExtension::KEYWORDS_ID) )); $container->setDefinition($this->getListPrinterId(), $definition); }
[ "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", "Reference", "(", "self", "::", "DEFINITION_TRANSLATOR_ID", ")", ",", "new", "Reference", "(", "GherkinExtension", "::", "KEYWORDS_ID", ")", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "$", "this", "->", "getInformationPrinterId", "(", ")", ",", "$", "definition", ")", ";", "$", "definition", "=", "new", "Definition", "(", "'Behat\\Behat\\Definition\\Printer\\ConsoleDefinitionListPrinter'", ",", "array", "(", "new", "Reference", "(", "CliExtension", "::", "OUTPUT_ID", ")", ",", "new", "Reference", "(", "self", "::", "PATTERN_TRANSFORMER_ID", ")", ",", "new", "Reference", "(", "self", "::", "DEFINITION_TRANSLATOR_ID", ")", ",", "new", "Reference", "(", "GherkinExtension", "::", "KEYWORDS_ID", ")", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "$", "this", "->", "getListPrinterId", "(", ")", ",", "$", "definition", ")", ";", "}" ]
Loads definition printers. @param ContainerBuilder $container
[ "Loads", "definition", "printers", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php#L225-L242
train
Behat/Behat
src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php
DefinitionExtension.loadController
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->getListPrinterId()), new Reference($this->getInformationPrinterId()) )); $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 500)); $container->setDefinition(CliExtension::CONTROLLER_TAG . '.available_definitions', $definition); }
php
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->getListPrinterId()), new Reference($this->getInformationPrinterId()) )); $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 500)); $container->setDefinition(CliExtension::CONTROLLER_TAG . '.available_definitions', $definition); }
[ "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", "->", "getListPrinterId", "(", ")", ")", ",", "new", "Reference", "(", "$", "this", "->", "getInformationPrinterId", "(", ")", ")", ")", ")", ";", "$", "definition", "->", "addTag", "(", "CliExtension", "::", "CONTROLLER_TAG", ",", "array", "(", "'priority'", "=>", "500", ")", ")", ";", "$", "container", "->", "setDefinition", "(", "CliExtension", "::", "CONTROLLER_TAG", ".", "'.available_definitions'", ",", "$", "definition", ")", ";", "}" ]
Loads definition controller. @param ContainerBuilder $container
[ "Loads", "definition", "controller", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php#L249-L259
train
Behat/Behat
src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php
DefinitionExtension.processPatternPolicies
private function processPatternPolicies(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::PATTERN_POLICY_TAG); $definition = $container->getDefinition(self::PATTERN_TRANSFORMER_ID); foreach ($references as $reference) { $definition->addMethodCall('registerPatternPolicy', array($reference)); } }
php
private function processPatternPolicies(ContainerBuilder $container) { $references = $this->processor->findAndSortTaggedServices($container, self::PATTERN_POLICY_TAG); $definition = $container->getDefinition(self::PATTERN_TRANSFORMER_ID); foreach ($references as $reference) { $definition->addMethodCall('registerPatternPolicy', array($reference)); } }
[ "private", "function", "processPatternPolicies", "(", "ContainerBuilder", "$", "container", ")", "{", "$", "references", "=", "$", "this", "->", "processor", "->", "findAndSortTaggedServices", "(", "$", "container", ",", "self", "::", "PATTERN_POLICY_TAG", ")", ";", "$", "definition", "=", "$", "container", "->", "getDefinition", "(", "self", "::", "PATTERN_TRANSFORMER_ID", ")", ";", "foreach", "(", "$", "references", "as", "$", "reference", ")", "{", "$", "definition", "->", "addMethodCall", "(", "'registerPatternPolicy'", ",", "array", "(", "$", "reference", ")", ")", ";", "}", "}" ]
Processes all pattern policies. @param ContainerBuilder $container
[ "Processes", "all", "pattern", "policies", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php#L281-L289
train
Behat/Behat
src/Behat/Behat/Definition/Search/RepositorySearchEngine.php
RepositorySearchEngine.match
private function match(Definition $definition, $stepText, array $multiline) { $regex = $this->patternTransformer->transformPatternToRegex($definition->getPattern()); if (!preg_match($regex, $stepText, $match)) { return null; } $function = $definition->getReflection(); $match = array_merge($match, array_values($multiline)); $arguments = $this->argumentOrganiser->organiseArguments($function, $match); return new SearchResult($definition, $stepText, $arguments); }
php
private function match(Definition $definition, $stepText, array $multiline) { $regex = $this->patternTransformer->transformPatternToRegex($definition->getPattern()); if (!preg_match($regex, $stepText, $match)) { return null; } $function = $definition->getReflection(); $match = array_merge($match, array_values($multiline)); $arguments = $this->argumentOrganiser->organiseArguments($function, $match); return new SearchResult($definition, $stepText, $arguments); }
[ "private", "function", "match", "(", "Definition", "$", "definition", ",", "$", "stepText", ",", "array", "$", "multiline", ")", "{", "$", "regex", "=", "$", "this", "->", "patternTransformer", "->", "transformPatternToRegex", "(", "$", "definition", "->", "getPattern", "(", ")", ")", ";", "if", "(", "!", "preg_match", "(", "$", "regex", ",", "$", "stepText", ",", "$", "match", ")", ")", "{", "return", "null", ";", "}", "$", "function", "=", "$", "definition", "->", "getReflection", "(", ")", ";", "$", "match", "=", "array_merge", "(", "$", "match", ",", "array_values", "(", "$", "multiline", ")", ")", ";", "$", "arguments", "=", "$", "this", "->", "argumentOrganiser", "->", "organiseArguments", "(", "$", "function", ",", "$", "match", ")", ";", "return", "new", "SearchResult", "(", "$", "definition", ",", "$", "stepText", ",", "$", "arguments", ")", ";", "}" ]
Attempts to match provided definition against a step text. @param Definition $definition @param string $stepText @param ArgumentInterface[] $multiline @return null|SearchResult
[ "Attempts", "to", "match", "provided", "definition", "against", "a", "step", "text", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Search/RepositorySearchEngine.php#L116-L129
train
Behat/Behat
src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php
StopOnFailureController.exitOnFailure
public function exitOnFailure(AfterScenarioTested $event) { if (!$this->resultInterpretation->isFailure($event->getTestResult())) { return; } $this->eventDispatcher->dispatch(SuiteTested::AFTER, new AfterSuiteAborted($event->getEnvironment())); $this->eventDispatcher->dispatch(ExerciseCompleted::AFTER, new AfterExerciseAborted()); exit(1); }
php
public function exitOnFailure(AfterScenarioTested $event) { if (!$this->resultInterpretation->isFailure($event->getTestResult())) { return; } $this->eventDispatcher->dispatch(SuiteTested::AFTER, new AfterSuiteAborted($event->getEnvironment())); $this->eventDispatcher->dispatch(ExerciseCompleted::AFTER, new AfterExerciseAborted()); exit(1); }
[ "public", "function", "exitOnFailure", "(", "AfterScenarioTested", "$", "event", ")", "{", "if", "(", "!", "$", "this", "->", "resultInterpretation", "->", "isFailure", "(", "$", "event", "->", "getTestResult", "(", ")", ")", ")", "{", "return", ";", "}", "$", "this", "->", "eventDispatcher", "->", "dispatch", "(", "SuiteTested", "::", "AFTER", ",", "new", "AfterSuiteAborted", "(", "$", "event", "->", "getEnvironment", "(", ")", ")", ")", ";", "$", "this", "->", "eventDispatcher", "->", "dispatch", "(", "ExerciseCompleted", "::", "AFTER", ",", "new", "AfterExerciseAborted", "(", ")", ")", ";", "exit", "(", "1", ")", ";", "}" ]
Exits if scenario is a failure and if stopper is enabled. @param AfterScenarioTested $event
[ "Exits", "if", "scenario", "is", "a", "failure", "and", "if", "stopper", "is", "enabled", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php#L97-L107
train
Behat/Behat
src/Behat/Behat/Output/Node/Printer/JUnit/JUnitStepPrinter.php
JUnitStepPrinter.printStep
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 ExceptionResult && $result->hasException()) { $message .= ': ' . $this->exceptionPresenter->presentException($result->getException()); } $attributes = array('message' => $message); switch ($result->getResultCode()) { case TestResult::FAILED: $outputPrinter->addTestcaseChild('failure', $attributes); break; case TestResult::PENDING: $attributes['type'] = 'pending'; $outputPrinter->addTestcaseChild('error', $attributes); break; case StepResult::UNDEFINED: $attributes['type'] = 'undefined'; $outputPrinter->addTestcaseChild('error', $attributes); break; } }
php
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 ExceptionResult && $result->hasException()) { $message .= ': ' . $this->exceptionPresenter->presentException($result->getException()); } $attributes = array('message' => $message); switch ($result->getResultCode()) { case TestResult::FAILED: $outputPrinter->addTestcaseChild('failure', $attributes); break; case TestResult::PENDING: $attributes['type'] = 'pending'; $outputPrinter->addTestcaseChild('error', $attributes); break; case StepResult::UNDEFINED: $attributes['type'] = 'undefined'; $outputPrinter->addTestcaseChild('error', $attributes); break; } }
[ "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", "ExceptionResult", "&&", "$", "result", "->", "hasException", "(", ")", ")", "{", "$", "message", ".=", "': '", ".", "$", "this", "->", "exceptionPresenter", "->", "presentException", "(", "$", "result", "->", "getException", "(", ")", ")", ";", "}", "$", "attributes", "=", "array", "(", "'message'", "=>", "$", "message", ")", ";", "switch", "(", "$", "result", "->", "getResultCode", "(", ")", ")", "{", "case", "TestResult", "::", "FAILED", ":", "$", "outputPrinter", "->", "addTestcaseChild", "(", "'failure'", ",", "$", "attributes", ")", ";", "break", ";", "case", "TestResult", "::", "PENDING", ":", "$", "attributes", "[", "'type'", "]", "=", "'pending'", ";", "$", "outputPrinter", "->", "addTestcaseChild", "(", "'error'", ",", "$", "attributes", ")", ";", "break", ";", "case", "StepResult", "::", "UNDEFINED", ":", "$", "attributes", "[", "'type'", "]", "=", "'undefined'", ";", "$", "outputPrinter", "->", "addTestcaseChild", "(", "'error'", ",", "$", "attributes", ")", ";", "break", ";", "}", "}" ]
Prints step using provided printer. @param Formatter $formatter @param Scenario $scenario @param StepNode $step @param StepResult $result
[ "Prints", "step", "using", "provided", "printer", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitStepPrinter.php#L49-L77
train
Behat/Behat
src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
BuiltInServiceContainer.createInstance
private function createInstance($id) { $schema = $this->getAndValidateServiceSchema($id); $reflection = new ReflectionClass($schema['class']); $arguments = $schema['arguments']; if ($factoryMethod = $this->getAndValidateFactoryMethod($reflection, $schema)) { return $factoryMethod->invokeArgs(null, $arguments); } return $reflection->newInstanceArgs($arguments); }
php
private function createInstance($id) { $schema = $this->getAndValidateServiceSchema($id); $reflection = new ReflectionClass($schema['class']); $arguments = $schema['arguments']; if ($factoryMethod = $this->getAndValidateFactoryMethod($reflection, $schema)) { return $factoryMethod->invokeArgs(null, $arguments); } return $reflection->newInstanceArgs($arguments); }
[ "private", "function", "createInstance", "(", "$", "id", ")", "{", "$", "schema", "=", "$", "this", "->", "getAndValidateServiceSchema", "(", "$", "id", ")", ";", "$", "reflection", "=", "new", "ReflectionClass", "(", "$", "schema", "[", "'class'", "]", ")", ";", "$", "arguments", "=", "$", "schema", "[", "'arguments'", "]", ";", "if", "(", "$", "factoryMethod", "=", "$", "this", "->", "getAndValidateFactoryMethod", "(", "$", "reflection", ",", "$", "schema", ")", ")", "{", "return", "$", "factoryMethod", "->", "invokeArgs", "(", "null", ",", "$", "arguments", ")", ";", "}", "return", "$", "reflection", "->", "newInstanceArgs", "(", "$", "arguments", ")", ";", "}" ]
Creates an instance of given service. @param string $id @return mixed
[ "Creates", "an", "instance", "of", "given", "service", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php#L75-L87
train
Behat/Behat
src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
BuiltInServiceContainer.getAndValidateServiceSchema
private function getAndValidateServiceSchema($id) { $schema = $this->schema[$id]; if (null === $schema) { $schema = array('class' => $id); } if (is_string($schema)) { $schema = array('class' => $schema); } $schema['class'] = $this->getAndValidateClass($id, $schema); $schema['arguments'] = $this->getAndValidateArguments($schema); return $schema; }
php
private function getAndValidateServiceSchema($id) { $schema = $this->schema[$id]; if (null === $schema) { $schema = array('class' => $id); } if (is_string($schema)) { $schema = array('class' => $schema); } $schema['class'] = $this->getAndValidateClass($id, $schema); $schema['arguments'] = $this->getAndValidateArguments($schema); return $schema; }
[ "private", "function", "getAndValidateServiceSchema", "(", "$", "id", ")", "{", "$", "schema", "=", "$", "this", "->", "schema", "[", "$", "id", "]", ";", "if", "(", "null", "===", "$", "schema", ")", "{", "$", "schema", "=", "array", "(", "'class'", "=>", "$", "id", ")", ";", "}", "if", "(", "is_string", "(", "$", "schema", ")", ")", "{", "$", "schema", "=", "array", "(", "'class'", "=>", "$", "schema", ")", ";", "}", "$", "schema", "[", "'class'", "]", "=", "$", "this", "->", "getAndValidateClass", "(", "$", "id", ",", "$", "schema", ")", ";", "$", "schema", "[", "'arguments'", "]", "=", "$", "this", "->", "getAndValidateArguments", "(", "$", "schema", ")", ";", "return", "$", "schema", ";", "}" ]
Gets and validates a service configuration for a service with given ID. @param string $id @throws WrongServicesConfigurationException @return array|string
[ "Gets", "and", "validates", "a", "service", "configuration", "for", "a", "service", "with", "given", "ID", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php#L98-L114
train
Behat/Behat
src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
BuiltInServiceContainer.getAndValidateFactoryMethod
private function getAndValidateFactoryMethod(ReflectionClass $reflection, array $schema) { if (!isset($schema['factory_method'])) { return null; } $factoryMethod = $schema['factory_method']; $this->assertFactoryMethodExists($reflection, $factoryMethod); $method = $reflection->getMethod($factoryMethod); $this->assertFactoryMethodIsStatic($method); return $method; }
php
private function getAndValidateFactoryMethod(ReflectionClass $reflection, array $schema) { if (!isset($schema['factory_method'])) { return null; } $factoryMethod = $schema['factory_method']; $this->assertFactoryMethodExists($reflection, $factoryMethod); $method = $reflection->getMethod($factoryMethod); $this->assertFactoryMethodIsStatic($method); return $method; }
[ "private", "function", "getAndValidateFactoryMethod", "(", "ReflectionClass", "$", "reflection", ",", "array", "$", "schema", ")", "{", "if", "(", "!", "isset", "(", "$", "schema", "[", "'factory_method'", "]", ")", ")", "{", "return", "null", ";", "}", "$", "factoryMethod", "=", "$", "schema", "[", "'factory_method'", "]", ";", "$", "this", "->", "assertFactoryMethodExists", "(", "$", "reflection", ",", "$", "factoryMethod", ")", ";", "$", "method", "=", "$", "reflection", "->", "getMethod", "(", "$", "factoryMethod", ")", ";", "$", "this", "->", "assertFactoryMethodIsStatic", "(", "$", "method", ")", ";", "return", "$", "method", ";", "}" ]
Gets and validates a factory method. @param ReflectionClass $reflection @param array $schema @return null|ReflectionMethod
[ "Gets", "and", "validates", "a", "factory", "method", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php#L153-L165
train
Behat/Behat
src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
BuiltInServiceContainer.assertFactoryMethodIsStatic
private function assertFactoryMethodIsStatic(ReflectionMethod $method) { if (!$method->isStatic()) { throw new WrongServicesConfigurationException(sprintf( 'Service factory methods must be static, but `%s::%s` is not.', $method->getDeclaringClass()->getName(), $method->getName() )); } }
php
private function assertFactoryMethodIsStatic(ReflectionMethod $method) { if (!$method->isStatic()) { throw new WrongServicesConfigurationException(sprintf( 'Service factory methods must be static, but `%s::%s` is not.', $method->getDeclaringClass()->getName(), $method->getName() )); } }
[ "private", "function", "assertFactoryMethodIsStatic", "(", "ReflectionMethod", "$", "method", ")", "{", "if", "(", "!", "$", "method", "->", "isStatic", "(", ")", ")", "{", "throw", "new", "WrongServicesConfigurationException", "(", "sprintf", "(", "'Service factory methods must be static, but `%s::%s` is not.'", ",", "$", "method", "->", "getDeclaringClass", "(", ")", "->", "getName", "(", ")", ",", "$", "method", "->", "getName", "(", ")", ")", ")", ";", "}", "}" ]
Checks if factory method is static. @param ReflectionMethod $method @throws WrongServicesConfigurationException
[ "Checks", "if", "factory", "method", "is", "static", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php#L193-L202
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php
HookStatsListener.captureHookStatsOnEvent
private function captureHookStatsOnEvent(Event $event) { if ($event instanceof AfterSetup && $event->getSetup() instanceof HookedSetup) { $this->captureBeforeHookStats($event->getSetup()); } if ($event instanceof AfterTested && $event->getTeardown() instanceof HookedTeardown) { $this->captureAfterHookStats($event->getTeardown()); } }
php
private function captureHookStatsOnEvent(Event $event) { if ($event instanceof AfterSetup && $event->getSetup() instanceof HookedSetup) { $this->captureBeforeHookStats($event->getSetup()); } if ($event instanceof AfterTested && $event->getTeardown() instanceof HookedTeardown) { $this->captureAfterHookStats($event->getTeardown()); } }
[ "private", "function", "captureHookStatsOnEvent", "(", "Event", "$", "event", ")", "{", "if", "(", "$", "event", "instanceof", "AfterSetup", "&&", "$", "event", "->", "getSetup", "(", ")", "instanceof", "HookedSetup", ")", "{", "$", "this", "->", "captureBeforeHookStats", "(", "$", "event", "->", "getSetup", "(", ")", ")", ";", "}", "if", "(", "$", "event", "instanceof", "AfterTested", "&&", "$", "event", "->", "getTeardown", "(", ")", "instanceof", "HookedTeardown", ")", "{", "$", "this", "->", "captureAfterHookStats", "(", "$", "event", "->", "getTeardown", "(", ")", ")", ";", "}", "}" ]
Captures hook stats on hooked event. @param Event $event
[ "Captures", "hook", "stats", "on", "hooked", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php#L66-L75
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php
HookStatsListener.captureHookStat
private function captureHookStat(CallResult $hookCallResult) { $callee = $hookCallResult->getCall()->getCallee(); $hook = (string) $callee; $path = $callee->getPath(); $stdOut = $hookCallResult->getStdOut(); $error = $hookCallResult->getException() ? $this->exceptionPresenter->presentException($hookCallResult->getException()) : null; $stat = new HookStat($hook, $path, $error, $stdOut); $this->statistics->registerHookStat($stat); }
php
private function captureHookStat(CallResult $hookCallResult) { $callee = $hookCallResult->getCall()->getCallee(); $hook = (string) $callee; $path = $callee->getPath(); $stdOut = $hookCallResult->getStdOut(); $error = $hookCallResult->getException() ? $this->exceptionPresenter->presentException($hookCallResult->getException()) : null; $stat = new HookStat($hook, $path, $error, $stdOut); $this->statistics->registerHookStat($stat); }
[ "private", "function", "captureHookStat", "(", "CallResult", "$", "hookCallResult", ")", "{", "$", "callee", "=", "$", "hookCallResult", "->", "getCall", "(", ")", "->", "getCallee", "(", ")", ";", "$", "hook", "=", "(", "string", ")", "$", "callee", ";", "$", "path", "=", "$", "callee", "->", "getPath", "(", ")", ";", "$", "stdOut", "=", "$", "hookCallResult", "->", "getStdOut", "(", ")", ";", "$", "error", "=", "$", "hookCallResult", "->", "getException", "(", ")", "?", "$", "this", "->", "exceptionPresenter", "->", "presentException", "(", "$", "hookCallResult", "->", "getException", "(", ")", ")", ":", "null", ";", "$", "stat", "=", "new", "HookStat", "(", "$", "hook", ",", "$", "path", ",", "$", "error", ",", "$", "stdOut", ")", ";", "$", "this", "->", "statistics", "->", "registerHookStat", "(", "$", "stat", ")", ";", "}" ]
Captures hook call result. @param CallResult $hookCallResult
[ "Captures", "hook", "call", "result", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php#L110-L122
train
Behat/Behat
src/Behat/Behat/Transformation/Context/Annotation/TransformationAnnotationReader.php
TransformationAnnotationReader.simpleTransformations
private function simpleTransformations() { $transformations = array(); $transformations[] = 'Behat\Behat\Transformation\Transformation\RowBasedTableTransformation'; $transformations[] = 'Behat\Behat\Transformation\Transformation\ColumnBasedTableTransformation'; $transformations[] = 'Behat\Behat\Transformation\Transformation\TableRowTransformation'; if (PHP_VERSION_ID >= 70000) { $transformations[] = 'Behat\Behat\Transformation\Transformation\TokenNameAndReturnTypeTransformation'; $transformations[] = 'Behat\Behat\Transformation\Transformation\ReturnTypeTransformation'; } $transformations[] = 'Behat\Behat\Transformation\Transformation\TokenNameTransformation'; return $transformations; }
php
private function simpleTransformations() { $transformations = array(); $transformations[] = 'Behat\Behat\Transformation\Transformation\RowBasedTableTransformation'; $transformations[] = 'Behat\Behat\Transformation\Transformation\ColumnBasedTableTransformation'; $transformations[] = 'Behat\Behat\Transformation\Transformation\TableRowTransformation'; if (PHP_VERSION_ID >= 70000) { $transformations[] = 'Behat\Behat\Transformation\Transformation\TokenNameAndReturnTypeTransformation'; $transformations[] = 'Behat\Behat\Transformation\Transformation\ReturnTypeTransformation'; } $transformations[] = 'Behat\Behat\Transformation\Transformation\TokenNameTransformation'; return $transformations; }
[ "private", "function", "simpleTransformations", "(", ")", "{", "$", "transformations", "=", "array", "(", ")", ";", "$", "transformations", "[", "]", "=", "'Behat\\Behat\\Transformation\\Transformation\\RowBasedTableTransformation'", ";", "$", "transformations", "[", "]", "=", "'Behat\\Behat\\Transformation\\Transformation\\ColumnBasedTableTransformation'", ";", "$", "transformations", "[", "]", "=", "'Behat\\Behat\\Transformation\\Transformation\\TableRowTransformation'", ";", "if", "(", "PHP_VERSION_ID", ">=", "70000", ")", "{", "$", "transformations", "[", "]", "=", "'Behat\\Behat\\Transformation\\Transformation\\TokenNameAndReturnTypeTransformation'", ";", "$", "transformations", "[", "]", "=", "'Behat\\Behat\\Transformation\\Transformation\\ReturnTypeTransformation'", ";", "}", "$", "transformations", "[", "]", "=", "'Behat\\Behat\\Transformation\\Transformation\\TokenNameTransformation'", ";", "return", "$", "transformations", ";", "}" ]
Returns list of default transformations. @return array
[ "Returns", "list", "of", "default", "transformations", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/Context/Annotation/TransformationAnnotationReader.php#L65-L80
train
Behat/Behat
src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php
PrettyFeaturePrinter.printTags
private function printTags(OutputPrinter $printer, array $tags) { if (!count($tags)) { return; } $tags = array_map(array($this, 'prependTagWithTagSign'), $tags); $printer->writeln(sprintf('%s{+tag}%s{-tag}', $this->indentText, implode(' ', $tags))); }
php
private function printTags(OutputPrinter $printer, array $tags) { if (!count($tags)) { return; } $tags = array_map(array($this, 'prependTagWithTagSign'), $tags); $printer->writeln(sprintf('%s{+tag}%s{-tag}', $this->indentText, implode(' ', $tags))); }
[ "private", "function", "printTags", "(", "OutputPrinter", "$", "printer", ",", "array", "$", "tags", ")", "{", "if", "(", "!", "count", "(", "$", "tags", ")", ")", "{", "return", ";", "}", "$", "tags", "=", "array_map", "(", "array", "(", "$", "this", ",", "'prependTagWithTagSign'", ")", ",", "$", "tags", ")", ";", "$", "printer", "->", "writeln", "(", "sprintf", "(", "'%s{+tag}%s{-tag}'", ",", "$", "this", "->", "indentText", ",", "implode", "(", "' '", ",", "$", "tags", ")", ")", ")", ";", "}" ]
Prints feature tags. @param OutputPrinter $printer @param string[] $tags
[ "Prints", "feature", "tags", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php#L74-L82
train
Behat/Behat
src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php
PrettyFeaturePrinter.printTitle
private function printTitle(OutputPrinter $printer, FeatureNode $feature) { $printer->write(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $feature->getKeyword())); if ($title = $feature->getTitle()) { $printer->write(sprintf(' %s', $title)); } $printer->writeln(); }
php
private function printTitle(OutputPrinter $printer, FeatureNode $feature) { $printer->write(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $feature->getKeyword())); if ($title = $feature->getTitle()) { $printer->write(sprintf(' %s', $title)); } $printer->writeln(); }
[ "private", "function", "printTitle", "(", "OutputPrinter", "$", "printer", ",", "FeatureNode", "$", "feature", ")", "{", "$", "printer", "->", "write", "(", "sprintf", "(", "'%s{+keyword}%s:{-keyword}'", ",", "$", "this", "->", "indentText", ",", "$", "feature", "->", "getKeyword", "(", ")", ")", ")", ";", "if", "(", "$", "title", "=", "$", "feature", "->", "getTitle", "(", ")", ")", "{", "$", "printer", "->", "write", "(", "sprintf", "(", "' %s'", ",", "$", "title", ")", ")", ";", "}", "$", "printer", "->", "writeln", "(", ")", ";", "}" ]
Prints feature title using provided printer. @param OutputPrinter $printer @param FeatureNode $feature
[ "Prints", "feature", "title", "using", "provided", "printer", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php#L90-L99
train
Behat/Behat
src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php
PrettyFeaturePrinter.printDescription
private function printDescription(OutputPrinter $printer, FeatureNode $feature) { if (!$feature->getDescription()) { $printer->writeln(); return; } foreach (explode("\n", $feature->getDescription()) as $descriptionLine) { $printer->writeln(sprintf('%s%s', $this->subIndentText, $descriptionLine)); } $printer->writeln(); }
php
private function printDescription(OutputPrinter $printer, FeatureNode $feature) { if (!$feature->getDescription()) { $printer->writeln(); return; } foreach (explode("\n", $feature->getDescription()) as $descriptionLine) { $printer->writeln(sprintf('%s%s', $this->subIndentText, $descriptionLine)); } $printer->writeln(); }
[ "private", "function", "printDescription", "(", "OutputPrinter", "$", "printer", ",", "FeatureNode", "$", "feature", ")", "{", "if", "(", "!", "$", "feature", "->", "getDescription", "(", ")", ")", "{", "$", "printer", "->", "writeln", "(", ")", ";", "return", ";", "}", "foreach", "(", "explode", "(", "\"\\n\"", ",", "$", "feature", "->", "getDescription", "(", ")", ")", "as", "$", "descriptionLine", ")", "{", "$", "printer", "->", "writeln", "(", "sprintf", "(", "'%s%s'", ",", "$", "this", "->", "subIndentText", ",", "$", "descriptionLine", ")", ")", ";", "}", "$", "printer", "->", "writeln", "(", ")", ";", "}" ]
Prints feature description using provided printer. @param OutputPrinter $printer @param FeatureNode $feature
[ "Prints", "feature", "description", "using", "provided", "printer", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php#L107-L120
train
Behat/Behat
src/Behat/Behat/Snippet/Cli/SnippetsController.php
SnippetsController.registerUndefinedStep
public function registerUndefinedStep(AfterStepTested $event) { if (StepResult::UNDEFINED === $event->getTestResult()->getResultCode()) { $this->registry->registerUndefinedStep($event->getEnvironment(), $event->getStep()); } }
php
public function registerUndefinedStep(AfterStepTested $event) { if (StepResult::UNDEFINED === $event->getTestResult()->getResultCode()) { $this->registry->registerUndefinedStep($event->getEnvironment(), $event->getStep()); } }
[ "public", "function", "registerUndefinedStep", "(", "AfterStepTested", "$", "event", ")", "{", "if", "(", "StepResult", "::", "UNDEFINED", "===", "$", "event", "->", "getTestResult", "(", ")", "->", "getResultCode", "(", ")", ")", "{", "$", "this", "->", "registry", "->", "registerUndefinedStep", "(", "$", "event", "->", "getEnvironment", "(", ")", ",", "$", "event", "->", "getStep", "(", ")", ")", ";", "}", "}" ]
Registers undefined step. @param AfterStepTested $event
[ "Registers", "undefined", "step", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/Cli/SnippetsController.php#L124-L129
train
Behat/Behat
src/Behat/Behat/Snippet/Cli/SnippetsController.php
SnippetsController.appendAllSnippets
public function appendAllSnippets() { $snippets = $this->registry->getSnippets(); count($snippets) && $this->output->writeln(''); $this->writer->appendSnippets($snippets); }
php
public function appendAllSnippets() { $snippets = $this->registry->getSnippets(); count($snippets) && $this->output->writeln(''); $this->writer->appendSnippets($snippets); }
[ "public", "function", "appendAllSnippets", "(", ")", "{", "$", "snippets", "=", "$", "this", "->", "registry", "->", "getSnippets", "(", ")", ";", "count", "(", "$", "snippets", ")", "&&", "$", "this", "->", "output", "->", "writeln", "(", "''", ")", ";", "$", "this", "->", "writer", "->", "appendSnippets", "(", "$", "snippets", ")", ";", "}" ]
Appends all snippets to corresponding targets.
[ "Appends", "all", "snippets", "to", "corresponding", "targets", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/Cli/SnippetsController.php#L134-L140
train
Behat/Behat
src/Behat/Behat/Snippet/Cli/SnippetsController.php
SnippetsController.printAllSnippets
public function printAllSnippets() { $snippets = $this->registry->getSnippets(); count($snippets) && $this->output->writeln(''); $this->writer->printSnippets($this->printer, $snippets); }
php
public function printAllSnippets() { $snippets = $this->registry->getSnippets(); count($snippets) && $this->output->writeln(''); $this->writer->printSnippets($this->printer, $snippets); }
[ "public", "function", "printAllSnippets", "(", ")", "{", "$", "snippets", "=", "$", "this", "->", "registry", "->", "getSnippets", "(", ")", ";", "count", "(", "$", "snippets", ")", "&&", "$", "this", "->", "output", "->", "writeln", "(", "''", ")", ";", "$", "this", "->", "writer", "->", "printSnippets", "(", "$", "this", "->", "printer", ",", "$", "snippets", ")", ";", "}" ]
Prints all snippets.
[ "Prints", "all", "snippets", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/Cli/SnippetsController.php#L145-L151
train
Behat/Behat
src/Behat/Behat/Snippet/Cli/SnippetsController.php
SnippetsController.printUndefinedSteps
public function printUndefinedSteps() { $undefined = $this->registry->getUndefinedSteps(); count($undefined) && $this->output->writeln(''); $this->writer->printUndefinedSteps($this->printer, $undefined); }
php
public function printUndefinedSteps() { $undefined = $this->registry->getUndefinedSteps(); count($undefined) && $this->output->writeln(''); $this->writer->printUndefinedSteps($this->printer, $undefined); }
[ "public", "function", "printUndefinedSteps", "(", ")", "{", "$", "undefined", "=", "$", "this", "->", "registry", "->", "getUndefinedSteps", "(", ")", ";", "count", "(", "$", "undefined", ")", "&&", "$", "this", "->", "output", "->", "writeln", "(", "''", ")", ";", "$", "this", "->", "writer", "->", "printUndefinedSteps", "(", "$", "this", "->", "printer", ",", "$", "undefined", ")", ";", "}" ]
Prints all undefined steps.
[ "Prints", "all", "undefined", "steps", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/Cli/SnippetsController.php#L156-L162
train
Behat/Behat
src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
InteractiveContextIdentifier.askQuestion
private function askQuestion($message, $choices, $default) { $this->output->writeln(''); $helper = new QuestionHelper(); $question = new ChoiceQuestion(' ' . $message . "\n", $choices, $default); return $helper->ask($this->input, $this->output, $question); }
php
private function askQuestion($message, $choices, $default) { $this->output->writeln(''); $helper = new QuestionHelper(); $question = new ChoiceQuestion(' ' . $message . "\n", $choices, $default); return $helper->ask($this->input, $this->output, $question); }
[ "private", "function", "askQuestion", "(", "$", "message", ",", "$", "choices", ",", "$", "default", ")", "{", "$", "this", "->", "output", "->", "writeln", "(", "''", ")", ";", "$", "helper", "=", "new", "QuestionHelper", "(", ")", ";", "$", "question", "=", "new", "ChoiceQuestion", "(", "' '", ".", "$", "message", ".", "\"\\n\"", ",", "$", "choices", ",", "$", "default", ")", ";", "return", "$", "helper", "->", "ask", "(", "$", "this", "->", "input", ",", "$", "this", "->", "output", ",", "$", "question", ")", ";", "}" ]
Asks user question. @param string $message @param string[] $choices @param string $default @return string
[ "Asks", "user", "question", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php#L89-L96
train
Behat/Behat
src/Behat/Behat/Snippet/AggregateSnippet.php
AggregateSnippet.getSteps
public function getSteps() { return array_unique( array_map( function (Snippet $snippet) { return $snippet->getStep(); }, $this->snippets ), SORT_REGULAR ); }
php
public function getSteps() { return array_unique( array_map( function (Snippet $snippet) { return $snippet->getStep(); }, $this->snippets ), SORT_REGULAR ); }
[ "public", "function", "getSteps", "(", ")", "{", "return", "array_unique", "(", "array_map", "(", "function", "(", "Snippet", "$", "snippet", ")", "{", "return", "$", "snippet", "->", "getStep", "(", ")", ";", "}", ",", "$", "this", "->", "snippets", ")", ",", "SORT_REGULAR", ")", ";", "}" ]
Returns all steps interested in this snippet. @return StepNode[]
[ "Returns", "all", "steps", "interested", "in", "this", "snippet", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/AggregateSnippet.php#L73-L84
train
Behat/Behat
src/Behat/Behat/Snippet/AggregateSnippet.php
AggregateSnippet.getUsedClasses
public function getUsedClasses() { if (empty($this->snippets)) { return array(); } return array_unique( call_user_func_array( 'array_merge', array_map( function (Snippet $snippet) { if (!$snippet instanceof ContextSnippet) { return array(); } return $snippet->getUsedClasses(); }, $this->snippets ) ) ); }
php
public function getUsedClasses() { if (empty($this->snippets)) { return array(); } return array_unique( call_user_func_array( 'array_merge', array_map( function (Snippet $snippet) { if (!$snippet instanceof ContextSnippet) { return array(); } return $snippet->getUsedClasses(); }, $this->snippets ) ) ); }
[ "public", "function", "getUsedClasses", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "snippets", ")", ")", "{", "return", "array", "(", ")", ";", "}", "return", "array_unique", "(", "call_user_func_array", "(", "'array_merge'", ",", "array_map", "(", "function", "(", "Snippet", "$", "snippet", ")", "{", "if", "(", "!", "$", "snippet", "instanceof", "ContextSnippet", ")", "{", "return", "array", "(", ")", ";", "}", "return", "$", "snippet", "->", "getUsedClasses", "(", ")", ";", "}", ",", "$", "this", "->", "snippets", ")", ")", ")", ";", "}" ]
Returns the classes used in the snippet which should be imported. @return string[]
[ "Returns", "the", "classes", "used", "in", "the", "snippet", "which", "should", "be", "imported", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Snippet/AggregateSnippet.php#L108-L129
train
Behat/Behat
src/Behat/Behat/Context/Environment/UninitializedContextEnvironment.php
UninitializedContextEnvironment.registerContextClass
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); } $reflClass = new \ReflectionClass($contextClass); if (!$reflClass->implementsInterface('Behat\Behat\Context\Context')) { throw new WrongContextClassException(sprintf( 'Every context class must implement Behat Context interface, but `%s` does not.', $contextClass ), $contextClass); } $this->contextClasses[$contextClass] = $arguments ? : array(); }
php
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); } $reflClass = new \ReflectionClass($contextClass); if (!$reflClass->implementsInterface('Behat\Behat\Context\Context')) { throw new WrongContextClassException(sprintf( 'Every context class must implement Behat Context interface, but `%s` does not.', $contextClass ), $contextClass); } $this->contextClasses[$contextClass] = $arguments ? : array(); }
[ "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", ")", ";", "}", "$", "reflClass", "=", "new", "\\", "ReflectionClass", "(", "$", "contextClass", ")", ";", "if", "(", "!", "$", "reflClass", "->", "implementsInterface", "(", "'Behat\\Behat\\Context\\Context'", ")", ")", "{", "throw", "new", "WrongContextClassException", "(", "sprintf", "(", "'Every context class must implement Behat Context interface, but `%s` does not.'", ",", "$", "contextClass", ")", ",", "$", "contextClass", ")", ";", "}", "$", "this", "->", "contextClasses", "[", "$", "contextClass", "]", "=", "$", "arguments", "?", ":", "array", "(", ")", ";", "}" ]
Registers context class. @param string $contextClass @param null|array $arguments @throws ContextNotFoundException If class does not exist @throws WrongContextClassException if class does not implement Context interface
[ "Registers", "context", "class", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Environment/UninitializedContextEnvironment.php#L41-L60
train
Behat/Behat
src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExampleRowPrinter.php
PrettyExampleRowPrinter.getWrapperClosure
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 as $event) { $index = array_search($event->getStep(), $example->getSteps()); $header = $outline->getExampleTable()->getRow(0); $steps = $outline->getSteps(); $outlineStepText = $steps[$index]->getText(); if (false !== strpos($outlineStepText, '<' . $header[$column] . '>')) { $results[] = $event->getTestResult(); } } $result = new TestResults($results); $style = $resultConverter->convertResultToString($result); return sprintf('{+%s}%s{-%s}', $style, $value, $style); }; }
php
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 as $event) { $index = array_search($event->getStep(), $example->getSteps()); $header = $outline->getExampleTable()->getRow(0); $steps = $outline->getSteps(); $outlineStepText = $steps[$index]->getText(); if (false !== strpos($outlineStepText, '<' . $header[$column] . '>')) { $results[] = $event->getTestResult(); } } $result = new TestResults($results); $style = $resultConverter->convertResultToString($result); return sprintf('{+%s}%s{-%s}', $style, $value, $style); }; }
[ "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", "as", "$", "event", ")", "{", "$", "index", "=", "array_search", "(", "$", "event", "->", "getStep", "(", ")", ",", "$", "example", "->", "getSteps", "(", ")", ")", ";", "$", "header", "=", "$", "outline", "->", "getExampleTable", "(", ")", "->", "getRow", "(", "0", ")", ";", "$", "steps", "=", "$", "outline", "->", "getSteps", "(", ")", ";", "$", "outlineStepText", "=", "$", "steps", "[", "$", "index", "]", "->", "getText", "(", ")", ";", "if", "(", "false", "!==", "strpos", "(", "$", "outlineStepText", ",", "'<'", ".", "$", "header", "[", "$", "column", "]", ".", "'>'", ")", ")", "{", "$", "results", "[", "]", "=", "$", "event", "->", "getTestResult", "(", ")", ";", "}", "}", "$", "result", "=", "new", "TestResults", "(", "$", "results", ")", ";", "$", "style", "=", "$", "resultConverter", "->", "convertResultToString", "(", "$", "result", ")", ";", "return", "sprintf", "(", "'{+%s}%s{-%s}'", ",", "$", "style", ",", "$", "value", ",", "$", "style", ")", ";", "}", ";", "}" ]
Creates wrapper-closure for the example table. @param OutlineNode $outline @param ExampleNode $example @param AfterStepTested[] $stepEvents @return callable
[ "Creates", "wrapper", "-", "closure", "for", "the", "example", "table", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExampleRowPrinter.php#L93-L115
train
Behat/Behat
src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php
ContextSnippetGenerator.getMethodName
private function getMethodName($contextClass, $canonicalText, $pattern) { $methodName = $this->deduceMethodName($canonicalText); $methodName = $this->getUniqueMethodName($contextClass, $pattern, $methodName); return $methodName; }
php
private function getMethodName($contextClass, $canonicalText, $pattern) { $methodName = $this->deduceMethodName($canonicalText); $methodName = $this->getUniqueMethodName($contextClass, $pattern, $methodName); return $methodName; }
[ "private", "function", "getMethodName", "(", "$", "contextClass", ",", "$", "canonicalText", ",", "$", "pattern", ")", "{", "$", "methodName", "=", "$", "this", "->", "deduceMethodName", "(", "$", "canonicalText", ")", ";", "$", "methodName", "=", "$", "this", "->", "getUniqueMethodName", "(", "$", "contextClass", ",", "$", "pattern", ",", "$", "methodName", ")", ";", "return", "$", "methodName", ";", "}" ]
Generates method name using step text and regex. @param string $contextClass @param string $canonicalText @param string $pattern @return string
[ "Generates", "method", "name", "using", "step", "text", "and", "regex", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php#L144-L150
train
Behat/Behat
src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php
ContextSnippetGenerator.getMethodArguments
private function getMethodArguments(StepNode $step, $tokenCount) { $args = array(); for ($i = 0; $i < $tokenCount; $i++) { $args[] = '$arg' . ($i + 1); } foreach ($step->getArguments() as $argument) { $args[] = $this->getMethodArgument($argument); } return $args; }
php
private function getMethodArguments(StepNode $step, $tokenCount) { $args = array(); for ($i = 0; $i < $tokenCount; $i++) { $args[] = '$arg' . ($i + 1); } foreach ($step->getArguments() as $argument) { $args[] = $this->getMethodArgument($argument); } return $args; }
[ "private", "function", "getMethodArguments", "(", "StepNode", "$", "step", ",", "$", "tokenCount", ")", "{", "$", "args", "=", "array", "(", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "tokenCount", ";", "$", "i", "++", ")", "{", "$", "args", "[", "]", "=", "'$arg'", ".", "(", "$", "i", "+", "1", ")", ";", "}", "foreach", "(", "$", "step", "->", "getArguments", "(", ")", "as", "$", "argument", ")", "{", "$", "args", "[", "]", "=", "$", "this", "->", "getMethodArgument", "(", "$", "argument", ")", ";", "}", "return", "$", "args", ";", "}" ]
Returns an array of method argument names from step and token count. @param StepNode $step @param integer $tokenCount @return string[]
[ "Returns", "an", "array", "of", "method", "argument", "names", "from", "step", "and", "token", "count", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php#L160-L172
train
Behat/Behat
src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php
ContextSnippetGenerator.getUsedClasses
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'; } elseif ($argument instanceof PyStringNode) { $usedClasses[] = 'Behat\Gherkin\Node\PyStringNode'; } } return $usedClasses; }
php
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'; } elseif ($argument instanceof PyStringNode) { $usedClasses[] = 'Behat\Gherkin\Node\PyStringNode'; } } return $usedClasses; }
[ "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'", ";", "}", "elseif", "(", "$", "argument", "instanceof", "PyStringNode", ")", "{", "$", "usedClasses", "[", "]", "=", "'Behat\\Gherkin\\Node\\PyStringNode'", ";", "}", "}", "return", "$", "usedClasses", ";", "}" ]
Returns an array of classes used by the snippet template @param StepNode $step @return string[]
[ "Returns", "an", "array", "of", "classes", "used", "by", "the", "snippet", "template" ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php#L181-L194
train
Behat/Behat
src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php
ContextSnippetGenerator.getSnippetTemplate
private function getSnippetTemplate($pattern, $methodName, array $methodArguments) { return sprintf( self::$templateTemplate, str_replace('%', '%%', $pattern), $methodName, implode(', ', $methodArguments) ); }
php
private function getSnippetTemplate($pattern, $methodName, array $methodArguments) { return sprintf( self::$templateTemplate, str_replace('%', '%%', $pattern), $methodName, implode(', ', $methodArguments) ); }
[ "private", "function", "getSnippetTemplate", "(", "$", "pattern", ",", "$", "methodName", ",", "array", "$", "methodArguments", ")", "{", "return", "sprintf", "(", "self", "::", "$", "templateTemplate", ",", "str_replace", "(", "'%'", ",", "'%%'", ",", "$", "pattern", ")", ",", "$", "methodName", ",", "implode", "(", "', '", ",", "$", "methodArguments", ")", ")", ";", "}" ]
Generates snippet template using regex, method name and arguments. @param string $pattern @param string $methodName @param string[] $methodArguments @return string
[ "Generates", "snippet", "template", "using", "regex", "method", "name", "and", "arguments", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php#L205-L213
train
Behat/Behat
src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php
ContextSnippetGenerator.getUniqueMethodName
private function getUniqueMethodName($contextClass, $stepPattern, $name) { $reflection = new ReflectionClass($contextClass); $number = $this->getMethodNumberFromTheMethodName($name); list($name, $number) = $this->getMethodNameNotExistentInContext($reflection, $name, $number); $name = $this->getMethodNameNotProposedEarlier($contextClass, $stepPattern, $name, $number); return $name; }
php
private function getUniqueMethodName($contextClass, $stepPattern, $name) { $reflection = new ReflectionClass($contextClass); $number = $this->getMethodNumberFromTheMethodName($name); list($name, $number) = $this->getMethodNameNotExistentInContext($reflection, $name, $number); $name = $this->getMethodNameNotProposedEarlier($contextClass, $stepPattern, $name, $number); return $name; }
[ "private", "function", "getUniqueMethodName", "(", "$", "contextClass", ",", "$", "stepPattern", ",", "$", "name", ")", "{", "$", "reflection", "=", "new", "ReflectionClass", "(", "$", "contextClass", ")", ";", "$", "number", "=", "$", "this", "->", "getMethodNumberFromTheMethodName", "(", "$", "name", ")", ";", "list", "(", "$", "name", ",", "$", "number", ")", "=", "$", "this", "->", "getMethodNameNotExistentInContext", "(", "$", "reflection", ",", "$", "name", ",", "$", "number", ")", ";", "$", "name", "=", "$", "this", "->", "getMethodNameNotProposedEarlier", "(", "$", "contextClass", ",", "$", "stepPattern", ",", "$", "name", ",", "$", "number", ")", ";", "return", "$", "name", ";", "}" ]
Ensures uniqueness of the method name in the context. @param string $contextClass @param string $stepPattern @param string $name @return string
[ "Ensures", "uniqueness", "of", "the", "method", "name", "in", "the", "context", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php#L243-L252
train
Behat/Behat
src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php
ContextSnippetGenerator.getMethodNumberFromTheMethodName
private function getMethodNumberFromTheMethodName($methodName) { $methodNumber = 2; if (preg_match('/(\d+)$/', $methodName, $matches)) { $methodNumber = intval($matches[1]); } return $methodNumber; }
php
private function getMethodNumberFromTheMethodName($methodName) { $methodNumber = 2; if (preg_match('/(\d+)$/', $methodName, $matches)) { $methodNumber = intval($matches[1]); } return $methodNumber; }
[ "private", "function", "getMethodNumberFromTheMethodName", "(", "$", "methodName", ")", "{", "$", "methodNumber", "=", "2", ";", "if", "(", "preg_match", "(", "'/(\\d+)$/'", ",", "$", "methodName", ",", "$", "matches", ")", ")", "{", "$", "methodNumber", "=", "intval", "(", "$", "matches", "[", "1", "]", ")", ";", "}", "return", "$", "methodNumber", ";", "}" ]
Tries to deduct method number from the provided method name. @param string $methodName @return integer
[ "Tries", "to", "deduct", "method", "number", "from", "the", "provided", "method", "name", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php#L261-L269
train
Behat/Behat
src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php
ContextSnippetGenerator.getMethodNameNotExistentInContext
private function getMethodNameNotExistentInContext(ReflectionClass $reflection, $methodName, $methodNumber) { while ($reflection->hasMethod($methodName)) { $methodName = preg_replace('/\d+$/', '', $methodName); $methodName .= $methodNumber++; } return array($methodName, $methodNumber); }
php
private function getMethodNameNotExistentInContext(ReflectionClass $reflection, $methodName, $methodNumber) { while ($reflection->hasMethod($methodName)) { $methodName = preg_replace('/\d+$/', '', $methodName); $methodName .= $methodNumber++; } return array($methodName, $methodNumber); }
[ "private", "function", "getMethodNameNotExistentInContext", "(", "ReflectionClass", "$", "reflection", ",", "$", "methodName", ",", "$", "methodNumber", ")", "{", "while", "(", "$", "reflection", "->", "hasMethod", "(", "$", "methodName", ")", ")", "{", "$", "methodName", "=", "preg_replace", "(", "'/\\d+$/'", ",", "''", ",", "$", "methodName", ")", ";", "$", "methodName", ".=", "$", "methodNumber", "++", ";", "}", "return", "array", "(", "$", "methodName", ",", "$", "methodNumber", ")", ";", "}" ]
Tries to guess method name that is not yet defined in the context class. @param ReflectionClass $reflection @param string $methodName @param integer $methodNumber @return array
[ "Tries", "to", "guess", "method", "name", "that", "is", "not", "yet", "defined", "in", "the", "context", "class", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php#L280-L288
train
Behat/Behat
src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php
ContextSnippetGenerator.getMethodNameNotProposedEarlier
private function getMethodNameNotProposedEarlier($contextClass, $stepPattern, $name, $number) { foreach ($this->getAlreadyProposedMethods($contextClass) as $proposedPattern => $proposedMethod) { if ($proposedPattern === $stepPattern) { continue; } while ($proposedMethod === $name) { $name = preg_replace('/\d+$/', '', $name); $name .= $number++; } } $this->markMethodAsAlreadyProposed($contextClass, $stepPattern, $name); return $name; }
php
private function getMethodNameNotProposedEarlier($contextClass, $stepPattern, $name, $number) { foreach ($this->getAlreadyProposedMethods($contextClass) as $proposedPattern => $proposedMethod) { if ($proposedPattern === $stepPattern) { continue; } while ($proposedMethod === $name) { $name = preg_replace('/\d+$/', '', $name); $name .= $number++; } } $this->markMethodAsAlreadyProposed($contextClass, $stepPattern, $name); return $name; }
[ "private", "function", "getMethodNameNotProposedEarlier", "(", "$", "contextClass", ",", "$", "stepPattern", ",", "$", "name", ",", "$", "number", ")", "{", "foreach", "(", "$", "this", "->", "getAlreadyProposedMethods", "(", "$", "contextClass", ")", "as", "$", "proposedPattern", "=>", "$", "proposedMethod", ")", "{", "if", "(", "$", "proposedPattern", "===", "$", "stepPattern", ")", "{", "continue", ";", "}", "while", "(", "$", "proposedMethod", "===", "$", "name", ")", "{", "$", "name", "=", "preg_replace", "(", "'/\\d+$/'", ",", "''", ",", "$", "name", ")", ";", "$", "name", ".=", "$", "number", "++", ";", "}", "}", "$", "this", "->", "markMethodAsAlreadyProposed", "(", "$", "contextClass", ",", "$", "stepPattern", ",", "$", "name", ")", ";", "return", "$", "name", ";", "}" ]
Tries to guess method name that is not yet proposed to the context class. @param string $contextClass @param string $stepPattern @param string $name @param integer $number @return string
[ "Tries", "to", "guess", "method", "name", "that", "is", "not", "yet", "proposed", "to", "the", "context", "class", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php#L300-L316
train
Behat/Behat
src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php
ContextSnippetGenerator.getMethodArgument
private function getMethodArgument($argument) { $arg = '__unknown__'; if ($argument instanceof PyStringNode) { $arg = 'PyStringNode $string'; } elseif ($argument instanceof TableNode) { $arg = 'TableNode $table'; } return $arg; }
php
private function getMethodArgument($argument) { $arg = '__unknown__'; if ($argument instanceof PyStringNode) { $arg = 'PyStringNode $string'; } elseif ($argument instanceof TableNode) { $arg = 'TableNode $table'; } return $arg; }
[ "private", "function", "getMethodArgument", "(", "$", "argument", ")", "{", "$", "arg", "=", "'__unknown__'", ";", "if", "(", "$", "argument", "instanceof", "PyStringNode", ")", "{", "$", "arg", "=", "'PyStringNode $string'", ";", "}", "elseif", "(", "$", "argument", "instanceof", "TableNode", ")", "{", "$", "arg", "=", "'TableNode $table'", ";", "}", "return", "$", "arg", ";", "}" ]
Returns method argument. @param string $argument @return string
[ "Returns", "method", "argument", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php#L349-L359
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php
FeatureListener.printHeaderOnBeforeEvent
private function printHeaderOnBeforeEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureSetup) { return; } $this->setupPrinter->printSetup($formatter, $event->getSetup()); $this->featurePrinter->printHeader($formatter, $event->getFeature()); }
php
private function printHeaderOnBeforeEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureSetup) { return; } $this->setupPrinter->printSetup($formatter, $event->getSetup()); $this->featurePrinter->printHeader($formatter, $event->getFeature()); }
[ "private", "function", "printHeaderOnBeforeEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterFeatureSetup", ")", "{", "return", ";", "}", "$", "this", "->", "setupPrinter", "->", "printSetup", "(", "$", "formatter", ",", "$", "event", "->", "getSetup", "(", ")", ")", ";", "$", "this", "->", "featurePrinter", "->", "printHeader", "(", "$", "formatter", ",", "$", "event", "->", "getFeature", "(", ")", ")", ";", "}" ]
Prints feature header on BEFORE event. @param Formatter $formatter @param Event $event
[ "Prints", "feature", "header", "on", "BEFORE", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php#L69-L77
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php
FeatureListener.printFooterOnAfterEvent
private function printFooterOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureTested) { return; } $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); $this->featurePrinter->printFooter($formatter, $event->getTestResult()); }
php
private function printFooterOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureTested) { return; } $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); $this->featurePrinter->printFooter($formatter, $event->getTestResult()); }
[ "private", "function", "printFooterOnAfterEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterFeatureTested", ")", "{", "return", ";", "}", "$", "this", "->", "setupPrinter", "->", "printTeardown", "(", "$", "formatter", ",", "$", "event", "->", "getTeardown", "(", ")", ")", ";", "$", "this", "->", "featurePrinter", "->", "printFooter", "(", "$", "formatter", ",", "$", "event", "->", "getTestResult", "(", ")", ")", ";", "}" ]
Prints feature footer on AFTER event. @param Formatter $formatter @param Event $event
[ "Prints", "feature", "footer", "on", "AFTER", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php#L85-L93
train
Behat/Behat
src/Behat/Behat/Definition/DefinitionFinder.php
DefinitionFinder.findDefinition
public function findDefinition(Environment $environment, FeatureNode $feature, StepNode $step) { foreach ($this->engines as $engine) { $result = $engine->searchDefinition($environment, $feature, $step); if (null !== $result && $result->hasMatch()) { return $result; } } return new SearchResult(); }
php
public function findDefinition(Environment $environment, FeatureNode $feature, StepNode $step) { foreach ($this->engines as $engine) { $result = $engine->searchDefinition($environment, $feature, $step); if (null !== $result && $result->hasMatch()) { return $result; } } return new SearchResult(); }
[ "public", "function", "findDefinition", "(", "Environment", "$", "environment", ",", "FeatureNode", "$", "feature", ",", "StepNode", "$", "step", ")", "{", "foreach", "(", "$", "this", "->", "engines", "as", "$", "engine", ")", "{", "$", "result", "=", "$", "engine", "->", "searchDefinition", "(", "$", "environment", ",", "$", "feature", ",", "$", "step", ")", ";", "if", "(", "null", "!==", "$", "result", "&&", "$", "result", "->", "hasMatch", "(", ")", ")", "{", "return", "$", "result", ";", "}", "}", "return", "new", "SearchResult", "(", ")", ";", "}" ]
Searches definition for a provided step in a provided environment. @param Environment $environment @param FeatureNode $feature @param StepNode $step @return SearchResult
[ "Searches", "definition", "for", "a", "provided", "step", "in", "a", "provided", "environment", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/DefinitionFinder.php#L49-L60
train
Behat/Behat
src/Behat/Behat/Output/Node/Printer/ListPrinter.php
ListPrinter.printScenariosList
public function printScenariosList(OutputPrinter $printer, $intro, $resultCode, array $scenarioStats) { if (!count($scenarioStats)) { return; } $style = $this->resultConverter->convertResultCodeToString($resultCode); $intro = $this->translator->trans($intro, array(), 'output'); $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style)); foreach ($scenarioStats as $stat) { $path = $this->relativizePaths((string) $stat); $printer->writeln(sprintf(' {+%s}%s{-%s}', $style, $path, $style)); } $printer->writeln(); }
php
public function printScenariosList(OutputPrinter $printer, $intro, $resultCode, array $scenarioStats) { if (!count($scenarioStats)) { return; } $style = $this->resultConverter->convertResultCodeToString($resultCode); $intro = $this->translator->trans($intro, array(), 'output'); $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style)); foreach ($scenarioStats as $stat) { $path = $this->relativizePaths((string) $stat); $printer->writeln(sprintf(' {+%s}%s{-%s}', $style, $path, $style)); } $printer->writeln(); }
[ "public", "function", "printScenariosList", "(", "OutputPrinter", "$", "printer", ",", "$", "intro", ",", "$", "resultCode", ",", "array", "$", "scenarioStats", ")", "{", "if", "(", "!", "count", "(", "$", "scenarioStats", ")", ")", "{", "return", ";", "}", "$", "style", "=", "$", "this", "->", "resultConverter", "->", "convertResultCodeToString", "(", "$", "resultCode", ")", ";", "$", "intro", "=", "$", "this", "->", "translator", "->", "trans", "(", "$", "intro", ",", "array", "(", ")", ",", "'output'", ")", ";", "$", "printer", "->", "writeln", "(", "sprintf", "(", "'--- {+%s}%s{-%s}'", ".", "PHP_EOL", ",", "$", "style", ",", "$", "intro", ",", "$", "style", ")", ")", ";", "foreach", "(", "$", "scenarioStats", "as", "$", "stat", ")", "{", "$", "path", "=", "$", "this", "->", "relativizePaths", "(", "(", "string", ")", "$", "stat", ")", ";", "$", "printer", "->", "writeln", "(", "sprintf", "(", "' {+%s}%s{-%s}'", ",", "$", "style", ",", "$", "path", ",", "$", "style", ")", ")", ";", "}", "$", "printer", "->", "writeln", "(", ")", ";", "}" ]
Prints scenarios list. @param OutputPrinter $printer @param string $intro @param integer $resultCode @param ScenarioStat[] $scenarioStats
[ "Prints", "scenarios", "list", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/ListPrinter.php#L75-L91
train
Behat/Behat
src/Behat/Behat/Output/Node/Printer/ListPrinter.php
ListPrinter.printStepList
public function printStepList(OutputPrinter $printer, $intro, $resultCode, array $stepStats) { if (!count($stepStats)) { return; } $style = $this->resultConverter->convertResultCodeToString($resultCode); $intro = $this->translator->trans($intro, array(), 'output'); $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style)); foreach ($stepStats as $num => $stepStat) { if ($stepStat instanceof StepStatV2) { $this->printStepStat($printer, $num + 1, $stepStat, $style); } elseif ($stepStat instanceof StepStat) { $this->printStat($printer, $stepStat->getText(), $stepStat->getPath(), $style, $stepStat->getStdOut(), $stepStat->getError()); } } }
php
public function printStepList(OutputPrinter $printer, $intro, $resultCode, array $stepStats) { if (!count($stepStats)) { return; } $style = $this->resultConverter->convertResultCodeToString($resultCode); $intro = $this->translator->trans($intro, array(), 'output'); $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style)); foreach ($stepStats as $num => $stepStat) { if ($stepStat instanceof StepStatV2) { $this->printStepStat($printer, $num + 1, $stepStat, $style); } elseif ($stepStat instanceof StepStat) { $this->printStat($printer, $stepStat->getText(), $stepStat->getPath(), $style, $stepStat->getStdOut(), $stepStat->getError()); } } }
[ "public", "function", "printStepList", "(", "OutputPrinter", "$", "printer", ",", "$", "intro", ",", "$", "resultCode", ",", "array", "$", "stepStats", ")", "{", "if", "(", "!", "count", "(", "$", "stepStats", ")", ")", "{", "return", ";", "}", "$", "style", "=", "$", "this", "->", "resultConverter", "->", "convertResultCodeToString", "(", "$", "resultCode", ")", ";", "$", "intro", "=", "$", "this", "->", "translator", "->", "trans", "(", "$", "intro", ",", "array", "(", ")", ",", "'output'", ")", ";", "$", "printer", "->", "writeln", "(", "sprintf", "(", "'--- {+%s}%s{-%s}'", ".", "PHP_EOL", ",", "$", "style", ",", "$", "intro", ",", "$", "style", ")", ")", ";", "foreach", "(", "$", "stepStats", "as", "$", "num", "=>", "$", "stepStat", ")", "{", "if", "(", "$", "stepStat", "instanceof", "StepStatV2", ")", "{", "$", "this", "->", "printStepStat", "(", "$", "printer", ",", "$", "num", "+", "1", ",", "$", "stepStat", ",", "$", "style", ")", ";", "}", "elseif", "(", "$", "stepStat", "instanceof", "StepStat", ")", "{", "$", "this", "->", "printStat", "(", "$", "printer", ",", "$", "stepStat", "->", "getText", "(", ")", ",", "$", "stepStat", "->", "getPath", "(", ")", ",", "$", "style", ",", "$", "stepStat", "->", "getStdOut", "(", ")", ",", "$", "stepStat", "->", "getError", "(", ")", ")", ";", "}", "}", "}" ]
Prints step list. @param OutputPrinter $printer @param string $intro @param integer $resultCode @param StepStat[] $stepStats
[ "Prints", "step", "list", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/ListPrinter.php#L101-L119
train
Behat/Behat
src/Behat/Behat/Output/Node/Printer/ListPrinter.php
ListPrinter.printFailedHooksList
public function printFailedHooksList(OutputPrinter $printer, $intro, array $failedHookStats) { if (!count($failedHookStats)) { return; } $style = $this->resultConverter->convertResultCodeToString(TestResult::FAILED); $intro = $this->translator->trans($intro, array(), 'output'); $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style)); foreach ($failedHookStats as $hookStat) { $this->printHookStat($printer, $hookStat, $style); } }
php
public function printFailedHooksList(OutputPrinter $printer, $intro, array $failedHookStats) { if (!count($failedHookStats)) { return; } $style = $this->resultConverter->convertResultCodeToString(TestResult::FAILED); $intro = $this->translator->trans($intro, array(), 'output'); $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style)); foreach ($failedHookStats as $hookStat) { $this->printHookStat($printer, $hookStat, $style); } }
[ "public", "function", "printFailedHooksList", "(", "OutputPrinter", "$", "printer", ",", "$", "intro", ",", "array", "$", "failedHookStats", ")", "{", "if", "(", "!", "count", "(", "$", "failedHookStats", ")", ")", "{", "return", ";", "}", "$", "style", "=", "$", "this", "->", "resultConverter", "->", "convertResultCodeToString", "(", "TestResult", "::", "FAILED", ")", ";", "$", "intro", "=", "$", "this", "->", "translator", "->", "trans", "(", "$", "intro", ",", "array", "(", ")", ",", "'output'", ")", ";", "$", "printer", "->", "writeln", "(", "sprintf", "(", "'--- {+%s}%s{-%s}'", ".", "PHP_EOL", ",", "$", "style", ",", "$", "intro", ",", "$", "style", ")", ")", ";", "foreach", "(", "$", "failedHookStats", "as", "$", "hookStat", ")", "{", "$", "this", "->", "printHookStat", "(", "$", "printer", ",", "$", "hookStat", ",", "$", "style", ")", ";", "}", "}" ]
Prints failed hooks list. @param OutputPrinter $printer @param string $intro @param HookStat[] $failedHookStats
[ "Prints", "failed", "hooks", "list", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/ListPrinter.php#L128-L141
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php
StatisticsListener.printStatisticsOnAfterExerciseEvent
private function printStatisticsOnAfterExerciseEvent(Formatter $formatter, $eventName) { if (ExerciseCompleted::AFTER !== $eventName) { return; } $this->statistics->stopTimer(); $this->printer->printStatistics($formatter, $this->statistics); }
php
private function printStatisticsOnAfterExerciseEvent(Formatter $formatter, $eventName) { if (ExerciseCompleted::AFTER !== $eventName) { return; } $this->statistics->stopTimer(); $this->printer->printStatistics($formatter, $this->statistics); }
[ "private", "function", "printStatisticsOnAfterExerciseEvent", "(", "Formatter", "$", "formatter", ",", "$", "eventName", ")", "{", "if", "(", "ExerciseCompleted", "::", "AFTER", "!==", "$", "eventName", ")", "{", "return", ";", "}", "$", "this", "->", "statistics", "->", "stopTimer", "(", ")", ";", "$", "this", "->", "printer", "->", "printStatistics", "(", "$", "formatter", ",", "$", "this", "->", "statistics", ")", ";", "}" ]
Prints statistics on after exercise event. @param Formatter $formatter @param string $eventName
[ "Prints", "statistics", "on", "after", "exercise", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php#L77-L85
train
Behat/Behat
src/Behat/Behat/Output/Node/Printer/Pretty/PrettyScenarioPrinter.php
PrettyScenarioPrinter.printKeyword
private function printKeyword(OutputPrinter $printer, $keyword) { $printer->write(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $keyword)); }
php
private function printKeyword(OutputPrinter $printer, $keyword) { $printer->write(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $keyword)); }
[ "private", "function", "printKeyword", "(", "OutputPrinter", "$", "printer", ",", "$", "keyword", ")", "{", "$", "printer", "->", "write", "(", "sprintf", "(", "'%s{+keyword}%s:{-keyword}'", ",", "$", "this", "->", "indentText", ",", "$", "keyword", ")", ")", ";", "}" ]
Prints scenario keyword. @param OutputPrinter $printer @param string $keyword
[ "Prints", "scenario", "keyword", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyScenarioPrinter.php#L100-L103
train
Behat/Behat
src/Behat/Behat/Transformation/Call/Filter/DefinitionArgumentsTransformer.php
DefinitionArgumentsTransformer.transformArgument
private function transformArgument(DefinitionCall $definitionCall, $index, $value) { foreach ($this->argumentTransformers as $transformer) { if (!$transformer->supportsDefinitionAndArgument($definitionCall, $index, $value)) { continue; } return $transformer->transformArgument($definitionCall, $index, $value); } return $value; }
php
private function transformArgument(DefinitionCall $definitionCall, $index, $value) { foreach ($this->argumentTransformers as $transformer) { if (!$transformer->supportsDefinitionAndArgument($definitionCall, $index, $value)) { continue; } return $transformer->transformArgument($definitionCall, $index, $value); } return $value; }
[ "private", "function", "transformArgument", "(", "DefinitionCall", "$", "definitionCall", ",", "$", "index", ",", "$", "value", ")", "{", "foreach", "(", "$", "this", "->", "argumentTransformers", "as", "$", "transformer", ")", "{", "if", "(", "!", "$", "transformer", "->", "supportsDefinitionAndArgument", "(", "$", "definitionCall", ",", "$", "index", ",", "$", "value", ")", ")", "{", "continue", ";", "}", "return", "$", "transformer", "->", "transformArgument", "(", "$", "definitionCall", ",", "$", "index", ",", "$", "value", ")", ";", "}", "return", "$", "value", ";", "}" ]
Transforms call argument using registered transformers. @param DefinitionCall $definitionCall @param integer|string $index @param mixed $value @return mixed
[ "Transforms", "call", "argument", "using", "registered", "transformers", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/Call/Filter/DefinitionArgumentsTransformer.php#L96-L107
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
JUnitFeatureElementListener.captureScenarioEvent
private function captureScenarioEvent(ScenarioTested $event) { if ($event instanceof AfterScenarioTested) { $this->afterScenarioTestedEvents[$event->getScenario()->getLine()] = array( 'event' => $event, 'step_events' => $this->afterStepTestedEvents, 'step_setup_events' => $this->afterStepSetupEvents, ); $this->afterStepTestedEvents = array(); $this->afterStepSetupEvents = array(); } }
php
private function captureScenarioEvent(ScenarioTested $event) { if ($event instanceof AfterScenarioTested) { $this->afterScenarioTestedEvents[$event->getScenario()->getLine()] = array( 'event' => $event, 'step_events' => $this->afterStepTestedEvents, 'step_setup_events' => $this->afterStepSetupEvents, ); $this->afterStepTestedEvents = array(); $this->afterStepSetupEvents = array(); } }
[ "private", "function", "captureScenarioEvent", "(", "ScenarioTested", "$", "event", ")", "{", "if", "(", "$", "event", "instanceof", "AfterScenarioTested", ")", "{", "$", "this", "->", "afterScenarioTestedEvents", "[", "$", "event", "->", "getScenario", "(", ")", "->", "getLine", "(", ")", "]", "=", "array", "(", "'event'", "=>", "$", "event", ",", "'step_events'", "=>", "$", "this", "->", "afterStepTestedEvents", ",", "'step_setup_events'", "=>", "$", "this", "->", "afterStepSetupEvents", ",", ")", ";", "$", "this", "->", "afterStepTestedEvents", "=", "array", "(", ")", ";", "$", "this", "->", "afterStepSetupEvents", "=", "array", "(", ")", ";", "}", "}" ]
Captures scenario tested event. @param ScenarioTested $event
[ "Captures", "scenario", "tested", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php#L113-L125
train
Behat/Behat
src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
JUnitFeatureElementListener.printFeatureOnAfterEvent
public function printFeatureOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureTested) { return; } $this->featurePrinter->printHeader($formatter, $this->beforeFeatureTestedEvent); foreach ($this->afterScenarioTestedEvents as $afterScenario) { $afterScenarioTested = $afterScenario['event']; $this->scenarioPrinter->printOpenTag($formatter, $afterScenarioTested->getFeature(), $afterScenarioTested->getScenario(), $afterScenarioTested->getTestResult()); /** @var AfterStepSetup $afterStepSetup */ foreach ($afterScenario['step_setup_events'] as $afterStepSetup) { $this->setupPrinter->printSetup($formatter, $afterStepSetup->getSetup()); } foreach ($afterScenario['step_events'] as $afterStepTested) { $this->stepPrinter->printStep($formatter, $afterScenarioTested->getScenario(), $afterStepTested->getStep(), $afterStepTested->getTestResult()); $this->setupPrinter->printTeardown($formatter, $afterStepTested->getTeardown()); } } $this->featurePrinter->printFooter($formatter, $event->getTestResult()); $this->afterScenarioTestedEvents = array(); }
php
public function printFeatureOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureTested) { return; } $this->featurePrinter->printHeader($formatter, $this->beforeFeatureTestedEvent); foreach ($this->afterScenarioTestedEvents as $afterScenario) { $afterScenarioTested = $afterScenario['event']; $this->scenarioPrinter->printOpenTag($formatter, $afterScenarioTested->getFeature(), $afterScenarioTested->getScenario(), $afterScenarioTested->getTestResult()); /** @var AfterStepSetup $afterStepSetup */ foreach ($afterScenario['step_setup_events'] as $afterStepSetup) { $this->setupPrinter->printSetup($formatter, $afterStepSetup->getSetup()); } foreach ($afterScenario['step_events'] as $afterStepTested) { $this->stepPrinter->printStep($formatter, $afterScenarioTested->getScenario(), $afterStepTested->getStep(), $afterStepTested->getTestResult()); $this->setupPrinter->printTeardown($formatter, $afterStepTested->getTeardown()); } } $this->featurePrinter->printFooter($formatter, $event->getTestResult()); $this->afterScenarioTestedEvents = array(); }
[ "public", "function", "printFeatureOnAfterEvent", "(", "Formatter", "$", "formatter", ",", "Event", "$", "event", ")", "{", "if", "(", "!", "$", "event", "instanceof", "AfterFeatureTested", ")", "{", "return", ";", "}", "$", "this", "->", "featurePrinter", "->", "printHeader", "(", "$", "formatter", ",", "$", "this", "->", "beforeFeatureTestedEvent", ")", ";", "foreach", "(", "$", "this", "->", "afterScenarioTestedEvents", "as", "$", "afterScenario", ")", "{", "$", "afterScenarioTested", "=", "$", "afterScenario", "[", "'event'", "]", ";", "$", "this", "->", "scenarioPrinter", "->", "printOpenTag", "(", "$", "formatter", ",", "$", "afterScenarioTested", "->", "getFeature", "(", ")", ",", "$", "afterScenarioTested", "->", "getScenario", "(", ")", ",", "$", "afterScenarioTested", "->", "getTestResult", "(", ")", ")", ";", "/** @var AfterStepSetup $afterStepSetup */", "foreach", "(", "$", "afterScenario", "[", "'step_setup_events'", "]", "as", "$", "afterStepSetup", ")", "{", "$", "this", "->", "setupPrinter", "->", "printSetup", "(", "$", "formatter", ",", "$", "afterStepSetup", "->", "getSetup", "(", ")", ")", ";", "}", "foreach", "(", "$", "afterScenario", "[", "'step_events'", "]", "as", "$", "afterStepTested", ")", "{", "$", "this", "->", "stepPrinter", "->", "printStep", "(", "$", "formatter", ",", "$", "afterScenarioTested", "->", "getScenario", "(", ")", ",", "$", "afterStepTested", "->", "getStep", "(", ")", ",", "$", "afterStepTested", "->", "getTestResult", "(", ")", ")", ";", "$", "this", "->", "setupPrinter", "->", "printTeardown", "(", "$", "formatter", ",", "$", "afterStepTested", "->", "getTeardown", "(", ")", ")", ";", "}", "}", "$", "this", "->", "featurePrinter", "->", "printFooter", "(", "$", "formatter", ",", "$", "event", "->", "getTestResult", "(", ")", ")", ";", "$", "this", "->", "afterScenarioTestedEvents", "=", "array", "(", ")", ";", "}" ]
Prints the feature on AFTER event. @param Formatter $formatter @param Event $event
[ "Prints", "the", "feature", "on", "AFTER", "event", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php#L162-L186
train
Behat/Behat
src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php
SuiteWithContextsSetup.getNormalizedContextClasses
private function getNormalizedContextClasses(Suite $suite) { return array_map( function ($context) { return is_array($context) ? current(array_keys($context)) : $context; }, $this->getSuiteContexts($suite) ); }
php
private function getNormalizedContextClasses(Suite $suite) { return array_map( function ($context) { return is_array($context) ? current(array_keys($context)) : $context; }, $this->getSuiteContexts($suite) ); }
[ "private", "function", "getNormalizedContextClasses", "(", "Suite", "$", "suite", ")", "{", "return", "array_map", "(", "function", "(", "$", "context", ")", "{", "return", "is_array", "(", "$", "context", ")", "?", "current", "(", "array_keys", "(", "$", "context", ")", ")", ":", "$", "context", ";", "}", ",", "$", "this", "->", "getSuiteContexts", "(", "$", "suite", ")", ")", ";", "}" ]
Returns normalized context classes. @param Suite $suite @return string[]
[ "Returns", "normalized", "context", "classes", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php#L96-L104
train
Behat/Behat
src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php
SuiteWithContextsSetup.getSuiteContexts
private function getSuiteContexts(Suite $suite) { $contexts = $suite->getSetting('contexts'); if (!is_array($contexts)) { throw new SuiteConfigurationException( sprintf('`contexts` setting of the "%s" suite is expected to be an array, `%s` given.', $suite->getName(), gettype($contexts) ), $suite->getName() ); } return $contexts; }
php
private function getSuiteContexts(Suite $suite) { $contexts = $suite->getSetting('contexts'); if (!is_array($contexts)) { throw new SuiteConfigurationException( sprintf('`contexts` setting of the "%s" suite is expected to be an array, `%s` given.', $suite->getName(), gettype($contexts) ), $suite->getName() ); } return $contexts; }
[ "private", "function", "getSuiteContexts", "(", "Suite", "$", "suite", ")", "{", "$", "contexts", "=", "$", "suite", "->", "getSetting", "(", "'contexts'", ")", ";", "if", "(", "!", "is_array", "(", "$", "contexts", ")", ")", "{", "throw", "new", "SuiteConfigurationException", "(", "sprintf", "(", "'`contexts` setting of the \"%s\" suite is expected to be an array, `%s` given.'", ",", "$", "suite", "->", "getName", "(", ")", ",", "gettype", "(", "$", "contexts", ")", ")", ",", "$", "suite", "->", "getName", "(", ")", ")", ";", "}", "return", "$", "contexts", ";", "}" ]
Returns array of context classes configured for the provided suite. @param Suite $suite @return string[] @throws SuiteConfigurationException If `contexts` setting is not an array
[ "Returns", "array", "of", "context", "classes", "configured", "for", "the", "provided", "suite", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php#L115-L130
train
Behat/Behat
src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php
SuiteWithContextsSetup.createContextDirectory
private function createContextDirectory($path) { mkdir($path, 0777, true); if ($this->logger) { $this->logger->directoryCreated($path, 'place your context classes here'); } }
php
private function createContextDirectory($path) { mkdir($path, 0777, true); if ($this->logger) { $this->logger->directoryCreated($path, 'place your context classes here'); } }
[ "private", "function", "createContextDirectory", "(", "$", "path", ")", "{", "mkdir", "(", "$", "path", ",", "0777", ",", "true", ")", ";", "if", "(", "$", "this", "->", "logger", ")", "{", "$", "this", "->", "logger", "->", "directoryCreated", "(", "$", "path", ",", "'place your context classes here'", ")", ";", "}", "}" ]
Creates context directory in the filesystem. @param string $path
[ "Creates", "context", "directory", "in", "the", "filesystem", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php#L137-L144
train
Behat/Behat
src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php
SuiteWithContextsSetup.createContextFile
private function createContextFile($path, $content) { file_put_contents($path, $content); if ($this->logger) { $this->logger->fileCreated($path, 'place your definitions, transformations and hooks here'); } }
php
private function createContextFile($path, $content) { file_put_contents($path, $content); if ($this->logger) { $this->logger->fileCreated($path, 'place your definitions, transformations and hooks here'); } }
[ "private", "function", "createContextFile", "(", "$", "path", ",", "$", "content", ")", "{", "file_put_contents", "(", "$", "path", ",", "$", "content", ")", ";", "if", "(", "$", "this", "->", "logger", ")", "{", "$", "this", "->", "logger", "->", "fileCreated", "(", "$", "path", ",", "'place your definitions, transformations and hooks here'", ")", ";", "}", "}" ]
Creates context class file in the filesystem. @param string $path @param string $content
[ "Creates", "context", "class", "file", "in", "the", "filesystem", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php#L152-L159
train
Behat/Behat
src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php
SuiteWithContextsSetup.findClassFile
private function findClassFile($class) { list($classpath, $classname) = $this->findClasspathAndClass($class); $classpath .= str_replace('_', DIRECTORY_SEPARATOR, $classname) . '.php'; foreach ($this->autoloader->getPrefixes() as $prefix => $dirs) { if (0 === strpos($class, $prefix)) { return current($dirs) . DIRECTORY_SEPARATOR . $classpath; } } if ($dirs = $this->autoloader->getFallbackDirs()) { return current($dirs) . DIRECTORY_SEPARATOR . $classpath; } throw new ContextNotFoundException(sprintf( 'Could not find where to put "%s" class. Have you configured autoloader properly?', $class ), $class); }
php
private function findClassFile($class) { list($classpath, $classname) = $this->findClasspathAndClass($class); $classpath .= str_replace('_', DIRECTORY_SEPARATOR, $classname) . '.php'; foreach ($this->autoloader->getPrefixes() as $prefix => $dirs) { if (0 === strpos($class, $prefix)) { return current($dirs) . DIRECTORY_SEPARATOR . $classpath; } } if ($dirs = $this->autoloader->getFallbackDirs()) { return current($dirs) . DIRECTORY_SEPARATOR . $classpath; } throw new ContextNotFoundException(sprintf( 'Could not find where to put "%s" class. Have you configured autoloader properly?', $class ), $class); }
[ "private", "function", "findClassFile", "(", "$", "class", ")", "{", "list", "(", "$", "classpath", ",", "$", "classname", ")", "=", "$", "this", "->", "findClasspathAndClass", "(", "$", "class", ")", ";", "$", "classpath", ".=", "str_replace", "(", "'_'", ",", "DIRECTORY_SEPARATOR", ",", "$", "classname", ")", ".", "'.php'", ";", "foreach", "(", "$", "this", "->", "autoloader", "->", "getPrefixes", "(", ")", "as", "$", "prefix", "=>", "$", "dirs", ")", "{", "if", "(", "0", "===", "strpos", "(", "$", "class", ",", "$", "prefix", ")", ")", "{", "return", "current", "(", "$", "dirs", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "classpath", ";", "}", "}", "if", "(", "$", "dirs", "=", "$", "this", "->", "autoloader", "->", "getFallbackDirs", "(", ")", ")", "{", "return", "current", "(", "$", "dirs", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "classpath", ";", "}", "throw", "new", "ContextNotFoundException", "(", "sprintf", "(", "'Could not find where to put \"%s\" class. Have you configured autoloader properly?'", ",", "$", "class", ")", ",", "$", "class", ")", ";", "}" ]
Finds file to store a class. @param string $class @return string @throws ContextNotFoundException If class file could not be determined
[ "Finds", "file", "to", "store", "a", "class", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php#L170-L189
train
Behat/Behat
src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php
SuiteWithContextsSetup.generateClass
private function generateClass(Suite $suite, $class) { $content = null; foreach ($this->classGenerators as $generator) { if ($generator->supportsSuiteAndClass($suite, $class)) { $content = $generator->generateClass($suite, $class); } } return $content; }
php
private function generateClass(Suite $suite, $class) { $content = null; foreach ($this->classGenerators as $generator) { if ($generator->supportsSuiteAndClass($suite, $class)) { $content = $generator->generateClass($suite, $class); } } return $content; }
[ "private", "function", "generateClass", "(", "Suite", "$", "suite", ",", "$", "class", ")", "{", "$", "content", "=", "null", ";", "foreach", "(", "$", "this", "->", "classGenerators", "as", "$", "generator", ")", "{", "if", "(", "$", "generator", "->", "supportsSuiteAndClass", "(", "$", "suite", ",", "$", "class", ")", ")", "{", "$", "content", "=", "$", "generator", "->", "generateClass", "(", "$", "suite", ",", "$", "class", ")", ";", "}", "}", "return", "$", "content", ";", "}" ]
Generates class using registered class generators. @param Suite $suite @param string $class @return null|string
[ "Generates", "class", "using", "registered", "class", "generators", "." ]
eb6c5d39420a47c08344598b58ec5f8d26a75b9b
https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php#L199-L209
train