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/Definition/Pattern/Policy/RegexPatternPolicy.php | RegexPatternPolicy.countPlaceholders | private function countPlaceholders($stepText, $stepRegex)
{
preg_match('/^' . $stepRegex . '$/', $stepText, $matches);
return count($matches) ? count($matches) - 1 : 0;
} | php | private function countPlaceholders($stepText, $stepRegex)
{
preg_match('/^' . $stepRegex . '$/', $stepText, $matches);
return count($matches) ? count($matches) - 1 : 0;
} | [
"private",
"function",
"countPlaceholders",
"(",
"$",
"stepText",
",",
"$",
"stepRegex",
")",
"{",
"preg_match",
"(",
"'/^'",
".",
"$",
"stepRegex",
".",
"'$/'",
",",
"$",
"stepText",
",",
"$",
"matches",
")",
";",
"return",
"count",
"(",
"$",
"matches",
")",
"?",
"count",
"(",
"$",
"matches",
")",
"-",
"1",
":",
"0",
";",
"}"
] | Counts regex placeholders using provided text.
@param string $stepText
@param string $stepRegex
@return integer | [
"Counts",
"regex",
"placeholders",
"using",
"provided",
"text",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Pattern/Policy/RegexPatternPolicy.php#L117-L122 | train |
Behat/Behat | src/Behat/Behat/Output/Printer/ConsoleOutputFactory.php | ConsoleOutputFactory.getDefaultStyles | private function getDefaultStyles()
{
return array(
'keyword' => new OutputFormatterStyle(null, null, array('bold')),
'stdout' => new OutputFormatterStyle(null, null, array()),
'exception' => new OutputFormatterStyle('red'),
'undefined' => new OutputFormatterStyle('yellow'),
'pending' => new OutputFormatterStyle('yellow'),
'pending_param' => new OutputFormatterStyle('yellow', null, array('bold')),
'failed' => new OutputFormatterStyle('red'),
'failed_param' => new OutputFormatterStyle('red', null, array('bold')),
'passed' => new OutputFormatterStyle('green'),
'passed_param' => new OutputFormatterStyle('green', null, array('bold')),
'skipped' => new OutputFormatterStyle('cyan'),
'skipped_param' => new OutputFormatterStyle('cyan', null, array('bold')),
'comment' => new OutputFormatterStyle('black'),
'tag' => new OutputFormatterStyle('cyan')
);
} | php | private function getDefaultStyles()
{
return array(
'keyword' => new OutputFormatterStyle(null, null, array('bold')),
'stdout' => new OutputFormatterStyle(null, null, array()),
'exception' => new OutputFormatterStyle('red'),
'undefined' => new OutputFormatterStyle('yellow'),
'pending' => new OutputFormatterStyle('yellow'),
'pending_param' => new OutputFormatterStyle('yellow', null, array('bold')),
'failed' => new OutputFormatterStyle('red'),
'failed_param' => new OutputFormatterStyle('red', null, array('bold')),
'passed' => new OutputFormatterStyle('green'),
'passed_param' => new OutputFormatterStyle('green', null, array('bold')),
'skipped' => new OutputFormatterStyle('cyan'),
'skipped_param' => new OutputFormatterStyle('cyan', null, array('bold')),
'comment' => new OutputFormatterStyle('black'),
'tag' => new OutputFormatterStyle('cyan')
);
} | [
"private",
"function",
"getDefaultStyles",
"(",
")",
"{",
"return",
"array",
"(",
"'keyword'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"null",
",",
"null",
",",
"array",
"(",
"'bold'",
")",
")",
",",
"'stdout'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"null",
",",
"null",
",",
"array",
"(",
")",
")",
",",
"'exception'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'red'",
")",
",",
"'undefined'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'yellow'",
")",
",",
"'pending'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'yellow'",
")",
",",
"'pending_param'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'yellow'",
",",
"null",
",",
"array",
"(",
"'bold'",
")",
")",
",",
"'failed'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'red'",
")",
",",
"'failed_param'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'red'",
",",
"null",
",",
"array",
"(",
"'bold'",
")",
")",
",",
"'passed'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'green'",
")",
",",
"'passed_param'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'green'",
",",
"null",
",",
"array",
"(",
"'bold'",
")",
")",
",",
"'skipped'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'cyan'",
")",
",",
"'skipped_param'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'cyan'",
",",
"null",
",",
"array",
"(",
"'bold'",
")",
")",
",",
"'comment'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'black'",
")",
",",
"'tag'",
"=>",
"new",
"OutputFormatterStyle",
"(",
"'cyan'",
")",
")",
";",
"}"
] | Returns default styles.
@return OutputFormatterStyle[string] | [
"Returns",
"default",
"styles",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Printer/ConsoleOutputFactory.php#L43-L61 | train |
Behat/Behat | src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php | OutlineTableListener.printExampleRowOnAfterExampleEvent | private function printExampleRowOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName)
{
if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) {
return;
}
$example = $event->getScenario();
$this->exampleSetupPrinter->printSetup($formatter, $this->exampleSetup);
foreach ($this->stepBeforeTestedEvents as $beforeEvent) {
$this->stepSetupPrinter->printSetup($formatter, $beforeEvent->getSetup());
}
$this->exampleRowPrinter->printExampleRow($formatter, $this->outline, $example, $this->stepAfterTestedEvents);
foreach ($this->stepAfterTestedEvents as $afterEvent) {
$this->stepSetupPrinter->printTeardown($formatter, $afterEvent->getTeardown());
}
$this->exampleSetupPrinter->printTeardown($formatter, $event->getTeardown());
$this->exampleSetup = null;
$this->stepBeforeTestedEvents = array();
$this->stepAfterTestedEvents = array();
} | php | private function printExampleRowOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName)
{
if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) {
return;
}
$example = $event->getScenario();
$this->exampleSetupPrinter->printSetup($formatter, $this->exampleSetup);
foreach ($this->stepBeforeTestedEvents as $beforeEvent) {
$this->stepSetupPrinter->printSetup($formatter, $beforeEvent->getSetup());
}
$this->exampleRowPrinter->printExampleRow($formatter, $this->outline, $example, $this->stepAfterTestedEvents);
foreach ($this->stepAfterTestedEvents as $afterEvent) {
$this->stepSetupPrinter->printTeardown($formatter, $afterEvent->getTeardown());
}
$this->exampleSetupPrinter->printTeardown($formatter, $event->getTeardown());
$this->exampleSetup = null;
$this->stepBeforeTestedEvents = array();
$this->stepAfterTestedEvents = array();
} | [
"private",
"function",
"printExampleRowOnAfterExampleEvent",
"(",
"Formatter",
"$",
"formatter",
",",
"Event",
"$",
"event",
",",
"$",
"eventName",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"instanceof",
"AfterScenarioTested",
"||",
"ExampleTested",
"::",
"AFTER",
"!==",
"$",
"eventName",
")",
"{",
"return",
";",
"}",
"$",
"example",
"=",
"$",
"event",
"->",
"getScenario",
"(",
")",
";",
"$",
"this",
"->",
"exampleSetupPrinter",
"->",
"printSetup",
"(",
"$",
"formatter",
",",
"$",
"this",
"->",
"exampleSetup",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"stepBeforeTestedEvents",
"as",
"$",
"beforeEvent",
")",
"{",
"$",
"this",
"->",
"stepSetupPrinter",
"->",
"printSetup",
"(",
"$",
"formatter",
",",
"$",
"beforeEvent",
"->",
"getSetup",
"(",
")",
")",
";",
"}",
"$",
"this",
"->",
"exampleRowPrinter",
"->",
"printExampleRow",
"(",
"$",
"formatter",
",",
"$",
"this",
"->",
"outline",
",",
"$",
"example",
",",
"$",
"this",
"->",
"stepAfterTestedEvents",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"stepAfterTestedEvents",
"as",
"$",
"afterEvent",
")",
"{",
"$",
"this",
"->",
"stepSetupPrinter",
"->",
"printTeardown",
"(",
"$",
"formatter",
",",
"$",
"afterEvent",
"->",
"getTeardown",
"(",
")",
")",
";",
"}",
"$",
"this",
"->",
"exampleSetupPrinter",
"->",
"printTeardown",
"(",
"$",
"formatter",
",",
"$",
"event",
"->",
"getTeardown",
"(",
")",
")",
";",
"$",
"this",
"->",
"exampleSetup",
"=",
"null",
";",
"$",
"this",
"->",
"stepBeforeTestedEvents",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"stepAfterTestedEvents",
"=",
"array",
"(",
")",
";",
"}"
] | Prints example row on example AFTER event.
@param Formatter $formatter
@param Event $event
@param string $eventName | [
"Prints",
"example",
"row",
"on",
"example",
"AFTER",
"event",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php#L204-L229 | train |
Behat/Behat | src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php | OutlineTableListener.printFooterOnAfterEvent | private function printFooterOnAfterEvent(Formatter $formatter, Event $event)
{
if (!$event instanceof AfterOutlineTested) {
return;
}
$this->tablePrinter->printFooter($formatter, $event->getTestResult());
} | php | private function printFooterOnAfterEvent(Formatter $formatter, Event $event)
{
if (!$event instanceof AfterOutlineTested) {
return;
}
$this->tablePrinter->printFooter($formatter, $event->getTestResult());
} | [
"private",
"function",
"printFooterOnAfterEvent",
"(",
"Formatter",
"$",
"formatter",
",",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"instanceof",
"AfterOutlineTested",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"tablePrinter",
"->",
"printFooter",
"(",
"$",
"formatter",
",",
"$",
"event",
"->",
"getTestResult",
"(",
")",
")",
";",
"}"
] | Prints outline footer on outline AFTER event.
@param Formatter $formatter
@param Event $event | [
"Prints",
"outline",
"footer",
"on",
"outline",
"AFTER",
"event",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php#L237-L244 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Helper/StepTextPainter.php | StepTextPainter.paintText | public function paintText($text, Definition $definition, TestResult $result)
{
$regex = $this->patternTransformer->transformPatternToRegex($definition->getPattern());
$style = $this->resultConverter->convertResultToString($result);
$paramStyle = $style . '_param';
// If it's just a string - skip
if ('/' !== substr($regex, 0, 1)) {
return $text;
}
// Find arguments with offsets
$matches = array();
preg_match($regex, $text, $matches, PREG_OFFSET_CAPTURE);
array_shift($matches);
// Replace arguments with colorized ones
$shift = 0;
$lastReplacementPosition = 0;
foreach ($matches as $key => $match) {
if (!is_numeric($key) || -1 === $match[1] || false !== strpos($match[0], '<')) {
continue;
}
$offset = $match[1] + $shift;
$value = $match[0];
// Skip inner matches
if ($lastReplacementPosition > $offset) {
continue;
}
$lastReplacementPosition = $offset + strlen($value);
$begin = substr($text, 0, $offset);
$end = substr($text, $lastReplacementPosition);
$format = "{-$style}{+$paramStyle}%s{-$paramStyle}{+$style}";
$text = sprintf("%s{$format}%s", $begin, $value, $end);
// Keep track of how many extra characters are added
$shift += strlen($format) - 2;
$lastReplacementPosition += strlen($format) - 2;
}
// Replace "<", ">" with colorized ones
$text = preg_replace(
'/(<[^>]+>)/',
"{-$style}{+$paramStyle}\$1{-$paramStyle}{+$style}",
$text
);
return $text;
} | php | public function paintText($text, Definition $definition, TestResult $result)
{
$regex = $this->patternTransformer->transformPatternToRegex($definition->getPattern());
$style = $this->resultConverter->convertResultToString($result);
$paramStyle = $style . '_param';
// If it's just a string - skip
if ('/' !== substr($regex, 0, 1)) {
return $text;
}
// Find arguments with offsets
$matches = array();
preg_match($regex, $text, $matches, PREG_OFFSET_CAPTURE);
array_shift($matches);
// Replace arguments with colorized ones
$shift = 0;
$lastReplacementPosition = 0;
foreach ($matches as $key => $match) {
if (!is_numeric($key) || -1 === $match[1] || false !== strpos($match[0], '<')) {
continue;
}
$offset = $match[1] + $shift;
$value = $match[0];
// Skip inner matches
if ($lastReplacementPosition > $offset) {
continue;
}
$lastReplacementPosition = $offset + strlen($value);
$begin = substr($text, 0, $offset);
$end = substr($text, $lastReplacementPosition);
$format = "{-$style}{+$paramStyle}%s{-$paramStyle}{+$style}";
$text = sprintf("%s{$format}%s", $begin, $value, $end);
// Keep track of how many extra characters are added
$shift += strlen($format) - 2;
$lastReplacementPosition += strlen($format) - 2;
}
// Replace "<", ">" with colorized ones
$text = preg_replace(
'/(<[^>]+>)/',
"{-$style}{+$paramStyle}\$1{-$paramStyle}{+$style}",
$text
);
return $text;
} | [
"public",
"function",
"paintText",
"(",
"$",
"text",
",",
"Definition",
"$",
"definition",
",",
"TestResult",
"$",
"result",
")",
"{",
"$",
"regex",
"=",
"$",
"this",
"->",
"patternTransformer",
"->",
"transformPatternToRegex",
"(",
"$",
"definition",
"->",
"getPattern",
"(",
")",
")",
";",
"$",
"style",
"=",
"$",
"this",
"->",
"resultConverter",
"->",
"convertResultToString",
"(",
"$",
"result",
")",
";",
"$",
"paramStyle",
"=",
"$",
"style",
".",
"'_param'",
";",
"// If it's just a string - skip",
"if",
"(",
"'/'",
"!==",
"substr",
"(",
"$",
"regex",
",",
"0",
",",
"1",
")",
")",
"{",
"return",
"$",
"text",
";",
"}",
"// Find arguments with offsets",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"preg_match",
"(",
"$",
"regex",
",",
"$",
"text",
",",
"$",
"matches",
",",
"PREG_OFFSET_CAPTURE",
")",
";",
"array_shift",
"(",
"$",
"matches",
")",
";",
"// Replace arguments with colorized ones",
"$",
"shift",
"=",
"0",
";",
"$",
"lastReplacementPosition",
"=",
"0",
";",
"foreach",
"(",
"$",
"matches",
"as",
"$",
"key",
"=>",
"$",
"match",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"key",
")",
"||",
"-",
"1",
"===",
"$",
"match",
"[",
"1",
"]",
"||",
"false",
"!==",
"strpos",
"(",
"$",
"match",
"[",
"0",
"]",
",",
"'<'",
")",
")",
"{",
"continue",
";",
"}",
"$",
"offset",
"=",
"$",
"match",
"[",
"1",
"]",
"+",
"$",
"shift",
";",
"$",
"value",
"=",
"$",
"match",
"[",
"0",
"]",
";",
"// Skip inner matches",
"if",
"(",
"$",
"lastReplacementPosition",
">",
"$",
"offset",
")",
"{",
"continue",
";",
"}",
"$",
"lastReplacementPosition",
"=",
"$",
"offset",
"+",
"strlen",
"(",
"$",
"value",
")",
";",
"$",
"begin",
"=",
"substr",
"(",
"$",
"text",
",",
"0",
",",
"$",
"offset",
")",
";",
"$",
"end",
"=",
"substr",
"(",
"$",
"text",
",",
"$",
"lastReplacementPosition",
")",
";",
"$",
"format",
"=",
"\"{-$style}{+$paramStyle}%s{-$paramStyle}{+$style}\"",
";",
"$",
"text",
"=",
"sprintf",
"(",
"\"%s{$format}%s\"",
",",
"$",
"begin",
",",
"$",
"value",
",",
"$",
"end",
")",
";",
"// Keep track of how many extra characters are added",
"$",
"shift",
"+=",
"strlen",
"(",
"$",
"format",
")",
"-",
"2",
";",
"$",
"lastReplacementPosition",
"+=",
"strlen",
"(",
"$",
"format",
")",
"-",
"2",
";",
"}",
"// Replace \"<\", \">\" with colorized ones",
"$",
"text",
"=",
"preg_replace",
"(",
"'/(<[^>]+>)/'",
",",
"\"{-$style}{+$paramStyle}\\$1{-$paramStyle}{+$style}\"",
",",
"$",
"text",
")",
";",
"return",
"$",
"text",
";",
"}"
] | Colorizes step text arguments according to definition.
@param string $text
@param Definition $definition
@param TestResult $result
@return string | [
"Colorizes",
"step",
"text",
"arguments",
"according",
"to",
"definition",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Helper/StepTextPainter.php#L54-L105 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php | PrettyOutlinePrinter.printExamplesSteps | private function printExamplesSteps(Formatter $formatter, OutlineNode $outline, array $steps)
{
foreach ($steps as $step) {
$this->stepPrinter->printStep($formatter, $outline, $step, new UndefinedStepResult());
}
$formatter->getOutputPrinter()->writeln();
} | php | private function printExamplesSteps(Formatter $formatter, OutlineNode $outline, array $steps)
{
foreach ($steps as $step) {
$this->stepPrinter->printStep($formatter, $outline, $step, new UndefinedStepResult());
}
$formatter->getOutputPrinter()->writeln();
} | [
"private",
"function",
"printExamplesSteps",
"(",
"Formatter",
"$",
"formatter",
",",
"OutlineNode",
"$",
"outline",
",",
"array",
"$",
"steps",
")",
"{",
"foreach",
"(",
"$",
"steps",
"as",
"$",
"step",
")",
"{",
"$",
"this",
"->",
"stepPrinter",
"->",
"printStep",
"(",
"$",
"formatter",
",",
"$",
"outline",
",",
"$",
"step",
",",
"new",
"UndefinedStepResult",
"(",
")",
")",
";",
"}",
"$",
"formatter",
"->",
"getOutputPrinter",
"(",
")",
"->",
"writeln",
"(",
")",
";",
"}"
] | Prints outline steps.
@param Formatter $formatter
@param OutlineNode $outline
@param StepNode[] $steps | [
"Prints",
"outline",
"steps",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php#L101-L108 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php | PrettyOutlinePrinter.printExamplesTableHeader | private function printExamplesTableHeader(OutputPrinter $printer, ExampleTableNode $table)
{
$printer->writeln(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $table->getKeyword()));
$rowNum = 0;
$wrapper = $this->getWrapperClosure();
$row = $table->getRowAsStringWithWrappedValues($rowNum, $wrapper);
$printer->writeln(sprintf('%s%s', $this->subIndentText, $row));
} | php | private function printExamplesTableHeader(OutputPrinter $printer, ExampleTableNode $table)
{
$printer->writeln(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $table->getKeyword()));
$rowNum = 0;
$wrapper = $this->getWrapperClosure();
$row = $table->getRowAsStringWithWrappedValues($rowNum, $wrapper);
$printer->writeln(sprintf('%s%s', $this->subIndentText, $row));
} | [
"private",
"function",
"printExamplesTableHeader",
"(",
"OutputPrinter",
"$",
"printer",
",",
"ExampleTableNode",
"$",
"table",
")",
"{",
"$",
"printer",
"->",
"writeln",
"(",
"sprintf",
"(",
"'%s{+keyword}%s:{-keyword}'",
",",
"$",
"this",
"->",
"indentText",
",",
"$",
"table",
"->",
"getKeyword",
"(",
")",
")",
")",
";",
"$",
"rowNum",
"=",
"0",
";",
"$",
"wrapper",
"=",
"$",
"this",
"->",
"getWrapperClosure",
"(",
")",
";",
"$",
"row",
"=",
"$",
"table",
"->",
"getRowAsStringWithWrappedValues",
"(",
"$",
"rowNum",
",",
"$",
"wrapper",
")",
";",
"$",
"printer",
"->",
"writeln",
"(",
"sprintf",
"(",
"'%s%s'",
",",
"$",
"this",
"->",
"subIndentText",
",",
"$",
"row",
")",
")",
";",
"}"
] | Prints examples table header.
@param OutputPrinter $printer
@param ExampleTableNode $table | [
"Prints",
"examples",
"table",
"header",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php#L116-L125 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php | PrettyOutlinePrinter.getWrapperClosure | private function getWrapperClosure()
{
$style = $this->resultConverter->convertResultCodeToString(TestResult::SKIPPED);
return function ($col) use ($style) {
return sprintf('{+%s_param}%s{-%s_param}', $style, $col, $style);
};
} | php | private function getWrapperClosure()
{
$style = $this->resultConverter->convertResultCodeToString(TestResult::SKIPPED);
return function ($col) use ($style) {
return sprintf('{+%s_param}%s{-%s_param}', $style, $col, $style);
};
} | [
"private",
"function",
"getWrapperClosure",
"(",
")",
"{",
"$",
"style",
"=",
"$",
"this",
"->",
"resultConverter",
"->",
"convertResultCodeToString",
"(",
"TestResult",
"::",
"SKIPPED",
")",
";",
"return",
"function",
"(",
"$",
"col",
")",
"use",
"(",
"$",
"style",
")",
"{",
"return",
"sprintf",
"(",
"'{+%s_param}%s{-%s_param}'",
",",
"$",
"style",
",",
"$",
"col",
",",
"$",
"style",
")",
";",
"}",
";",
"}"
] | Creates wrapper-closure for the example header.
@return callable | [
"Creates",
"wrapper",
"-",
"closure",
"for",
"the",
"example",
"header",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php#L132-L139 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Helper/ResultToStringConverter.php | ResultToStringConverter.convertResultCodeToString | public function convertResultCodeToString($resultCode)
{
switch ($resultCode) {
case TestResult::SKIPPED:
return 'skipped';
case TestResult::PENDING:
return 'pending';
case TestResult::FAILED:
return 'failed';
case StepResult::UNDEFINED:
return 'undefined';
}
return 'passed';
} | php | public function convertResultCodeToString($resultCode)
{
switch ($resultCode) {
case TestResult::SKIPPED:
return 'skipped';
case TestResult::PENDING:
return 'pending';
case TestResult::FAILED:
return 'failed';
case StepResult::UNDEFINED:
return 'undefined';
}
return 'passed';
} | [
"public",
"function",
"convertResultCodeToString",
"(",
"$",
"resultCode",
")",
"{",
"switch",
"(",
"$",
"resultCode",
")",
"{",
"case",
"TestResult",
"::",
"SKIPPED",
":",
"return",
"'skipped'",
";",
"case",
"TestResult",
"::",
"PENDING",
":",
"return",
"'pending'",
";",
"case",
"TestResult",
"::",
"FAILED",
":",
"return",
"'failed'",
";",
"case",
"StepResult",
"::",
"UNDEFINED",
":",
"return",
"'undefined'",
";",
"}",
"return",
"'passed'",
";",
"}"
] | Converts provided result code to a string.
@param integer $resultCode
@return string | [
"Converts",
"provided",
"result",
"code",
"to",
"a",
"string",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Helper/ResultToStringConverter.php#L42-L56 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php | WidthCalculator.calculateScenarioWidth | public function calculateScenarioWidth(Scenario $scenario, $indentation, $subIndentation)
{
$length = $this->calculateScenarioHeaderWidth($scenario, $indentation);
foreach ($scenario->getSteps() as $step) {
$stepLength = $this->calculateStepWidth($step, $indentation + $subIndentation);
$length = max($length, $stepLength);
}
return $length;
} | php | public function calculateScenarioWidth(Scenario $scenario, $indentation, $subIndentation)
{
$length = $this->calculateScenarioHeaderWidth($scenario, $indentation);
foreach ($scenario->getSteps() as $step) {
$stepLength = $this->calculateStepWidth($step, $indentation + $subIndentation);
$length = max($length, $stepLength);
}
return $length;
} | [
"public",
"function",
"calculateScenarioWidth",
"(",
"Scenario",
"$",
"scenario",
",",
"$",
"indentation",
",",
"$",
"subIndentation",
")",
"{",
"$",
"length",
"=",
"$",
"this",
"->",
"calculateScenarioHeaderWidth",
"(",
"$",
"scenario",
",",
"$",
"indentation",
")",
";",
"foreach",
"(",
"$",
"scenario",
"->",
"getSteps",
"(",
")",
"as",
"$",
"step",
")",
"{",
"$",
"stepLength",
"=",
"$",
"this",
"->",
"calculateStepWidth",
"(",
"$",
"step",
",",
"$",
"indentation",
"+",
"$",
"subIndentation",
")",
";",
"$",
"length",
"=",
"max",
"(",
"$",
"length",
",",
"$",
"stepLength",
")",
";",
"}",
"return",
"$",
"length",
";",
"}"
] | Calculates scenario width.
@param Scenario $scenario
@param integer $indentation
@param integer $subIndentation
@return integer | [
"Calculates",
"scenario",
"width",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php#L33-L43 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php | WidthCalculator.calculateExampleWidth | public function calculateExampleWidth(ExampleNode $example, $indentation, $subIndentation)
{
$length = $this->calculateScenarioHeaderWidth($example, $indentation);
foreach ($example->getSteps() as $step) {
$stepLength = $this->calculateStepWidth($step, $indentation + $subIndentation);
$length = max($length, $stepLength);
}
return $length;
} | php | public function calculateExampleWidth(ExampleNode $example, $indentation, $subIndentation)
{
$length = $this->calculateScenarioHeaderWidth($example, $indentation);
foreach ($example->getSteps() as $step) {
$stepLength = $this->calculateStepWidth($step, $indentation + $subIndentation);
$length = max($length, $stepLength);
}
return $length;
} | [
"public",
"function",
"calculateExampleWidth",
"(",
"ExampleNode",
"$",
"example",
",",
"$",
"indentation",
",",
"$",
"subIndentation",
")",
"{",
"$",
"length",
"=",
"$",
"this",
"->",
"calculateScenarioHeaderWidth",
"(",
"$",
"example",
",",
"$",
"indentation",
")",
";",
"foreach",
"(",
"$",
"example",
"->",
"getSteps",
"(",
")",
"as",
"$",
"step",
")",
"{",
"$",
"stepLength",
"=",
"$",
"this",
"->",
"calculateStepWidth",
"(",
"$",
"step",
",",
"$",
"indentation",
"+",
"$",
"subIndentation",
")",
";",
"$",
"length",
"=",
"max",
"(",
"$",
"length",
",",
"$",
"stepLength",
")",
";",
"}",
"return",
"$",
"length",
";",
"}"
] | Calculates outline examples width.
@param ExampleNode $example
@param integer $indentation
@param integer $subIndentation
@return integer | [
"Calculates",
"outline",
"examples",
"width",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php#L54-L64 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php | WidthCalculator.calculateScenarioHeaderWidth | public function calculateScenarioHeaderWidth(Scenario $scenario, $indentation)
{
$indentText = str_repeat(' ', intval($indentation));
if ($scenario instanceof ExampleNode) {
$header = sprintf('%s%s', $indentText, $scenario->getTitle());
} else {
$title = $scenario->getTitle();
$lines = explode("\n", $title);
$header = sprintf('%s%s: %s', $indentText, $scenario->getKeyword(), array_shift($lines));
}
return mb_strlen(rtrim($header), 'utf8');
} | php | public function calculateScenarioHeaderWidth(Scenario $scenario, $indentation)
{
$indentText = str_repeat(' ', intval($indentation));
if ($scenario instanceof ExampleNode) {
$header = sprintf('%s%s', $indentText, $scenario->getTitle());
} else {
$title = $scenario->getTitle();
$lines = explode("\n", $title);
$header = sprintf('%s%s: %s', $indentText, $scenario->getKeyword(), array_shift($lines));
}
return mb_strlen(rtrim($header), 'utf8');
} | [
"public",
"function",
"calculateScenarioHeaderWidth",
"(",
"Scenario",
"$",
"scenario",
",",
"$",
"indentation",
")",
"{",
"$",
"indentText",
"=",
"str_repeat",
"(",
"' '",
",",
"intval",
"(",
"$",
"indentation",
")",
")",
";",
"if",
"(",
"$",
"scenario",
"instanceof",
"ExampleNode",
")",
"{",
"$",
"header",
"=",
"sprintf",
"(",
"'%s%s'",
",",
"$",
"indentText",
",",
"$",
"scenario",
"->",
"getTitle",
"(",
")",
")",
";",
"}",
"else",
"{",
"$",
"title",
"=",
"$",
"scenario",
"->",
"getTitle",
"(",
")",
";",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"title",
")",
";",
"$",
"header",
"=",
"sprintf",
"(",
"'%s%s: %s'",
",",
"$",
"indentText",
",",
"$",
"scenario",
"->",
"getKeyword",
"(",
")",
",",
"array_shift",
"(",
"$",
"lines",
")",
")",
";",
"}",
"return",
"mb_strlen",
"(",
"rtrim",
"(",
"$",
"header",
")",
",",
"'utf8'",
")",
";",
"}"
] | Calculates scenario header width.
@param Scenario $scenario
@param integer $indentation
@return integer | [
"Calculates",
"scenario",
"header",
"width",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php#L74-L87 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php | WidthCalculator.calculateStepWidth | public function calculateStepWidth(StepNode $step, $indentation)
{
$indentText = str_repeat(' ', intval($indentation));
$text = sprintf('%s%s %s', $indentText, $step->getKeyword(), $step->getText());
return mb_strlen($text, 'utf8');
} | php | public function calculateStepWidth(StepNode $step, $indentation)
{
$indentText = str_repeat(' ', intval($indentation));
$text = sprintf('%s%s %s', $indentText, $step->getKeyword(), $step->getText());
return mb_strlen($text, 'utf8');
} | [
"public",
"function",
"calculateStepWidth",
"(",
"StepNode",
"$",
"step",
",",
"$",
"indentation",
")",
"{",
"$",
"indentText",
"=",
"str_repeat",
"(",
"' '",
",",
"intval",
"(",
"$",
"indentation",
")",
")",
";",
"$",
"text",
"=",
"sprintf",
"(",
"'%s%s %s'",
",",
"$",
"indentText",
",",
"$",
"step",
"->",
"getKeyword",
"(",
")",
",",
"$",
"step",
"->",
"getText",
"(",
")",
")",
";",
"return",
"mb_strlen",
"(",
"$",
"text",
",",
"'utf8'",
")",
";",
"}"
] | Calculates step width.
@param StepNode $step
@param integer $indentation
@return integer | [
"Calculates",
"step",
"width",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php#L97-L104 | train |
Behat/Behat | src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php | TransformationExtension.loadDefinitionArgumentsTransformer | protected function loadDefinitionArgumentsTransformer(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Transformation\Call\Filter\DefinitionArgumentsTransformer');
$definition->addTag(CallExtension::CALL_FILTER_TAG, array('priority' => 200));
$container->setDefinition($this->getDefinitionArgumentTransformerId(), $definition);
} | php | protected function loadDefinitionArgumentsTransformer(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Transformation\Call\Filter\DefinitionArgumentsTransformer');
$definition->addTag(CallExtension::CALL_FILTER_TAG, array('priority' => 200));
$container->setDefinition($this->getDefinitionArgumentTransformerId(), $definition);
} | [
"protected",
"function",
"loadDefinitionArgumentsTransformer",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Transformation\\Call\\Filter\\DefinitionArgumentsTransformer'",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"CallExtension",
"::",
"CALL_FILTER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"200",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"$",
"this",
"->",
"getDefinitionArgumentTransformerId",
"(",
")",
",",
"$",
"definition",
")",
";",
"}"
] | Loads definition arguments transformer.
@param ContainerBuilder $container | [
"Loads",
"definition",
"arguments",
"transformer",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php#L104-L109 | train |
Behat/Behat | src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php | TransformationExtension.loadDefaultTransformers | protected function loadDefaultTransformers(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Transformation\Transformer\RepositoryArgumentTransformer', array(
new Reference(self::REPOSITORY_ID),
new Reference(CallExtension::CALL_CENTER_ID),
new Reference(DefinitionExtension::PATTERN_TRANSFORMER_ID),
new Reference(TranslatorExtension::TRANSLATOR_ID)
));
$definition->addTag(self::ARGUMENT_TRANSFORMER_TAG, array('priority' => 50));
$container->setDefinition(self::ARGUMENT_TRANSFORMER_TAG . '.repository', $definition);
} | php | protected function loadDefaultTransformers(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Transformation\Transformer\RepositoryArgumentTransformer', array(
new Reference(self::REPOSITORY_ID),
new Reference(CallExtension::CALL_CENTER_ID),
new Reference(DefinitionExtension::PATTERN_TRANSFORMER_ID),
new Reference(TranslatorExtension::TRANSLATOR_ID)
));
$definition->addTag(self::ARGUMENT_TRANSFORMER_TAG, array('priority' => 50));
$container->setDefinition(self::ARGUMENT_TRANSFORMER_TAG . '.repository', $definition);
} | [
"protected",
"function",
"loadDefaultTransformers",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Transformation\\Transformer\\RepositoryArgumentTransformer'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"REPOSITORY_ID",
")",
",",
"new",
"Reference",
"(",
"CallExtension",
"::",
"CALL_CENTER_ID",
")",
",",
"new",
"Reference",
"(",
"DefinitionExtension",
"::",
"PATTERN_TRANSFORMER_ID",
")",
",",
"new",
"Reference",
"(",
"TranslatorExtension",
"::",
"TRANSLATOR_ID",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"self",
"::",
"ARGUMENT_TRANSFORMER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"ARGUMENT_TRANSFORMER_TAG",
".",
"'.repository'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads default transformers.
@param ContainerBuilder $container | [
"Loads",
"default",
"transformers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php#L116-L126 | train |
Behat/Behat | src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php | TransformationExtension.loadRepository | protected function loadRepository(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Transformation\TransformationRepository', array(
new Reference(EnvironmentExtension::MANAGER_ID)
));
$container->setDefinition(self::REPOSITORY_ID, $definition);
} | php | protected function loadRepository(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Transformation\TransformationRepository', array(
new Reference(EnvironmentExtension::MANAGER_ID)
));
$container->setDefinition(self::REPOSITORY_ID, $definition);
} | [
"protected",
"function",
"loadRepository",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Transformation\\TransformationRepository'",
",",
"array",
"(",
"new",
"Reference",
"(",
"EnvironmentExtension",
"::",
"MANAGER_ID",
")",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"REPOSITORY_ID",
",",
"$",
"definition",
")",
";",
"}"
] | Loads transformations repository.
@param ContainerBuilder $container | [
"Loads",
"transformations",
"repository",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php#L145-L151 | train |
Behat/Behat | src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php | TransformationExtension.processArgumentsTransformers | protected function processArgumentsTransformers(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::ARGUMENT_TRANSFORMER_TAG);
$definition = $container->getDefinition($this->getDefinitionArgumentTransformerId());
foreach ($references as $reference) {
$definition->addMethodCall('registerArgumentTransformer', array($reference));
}
} | php | protected function processArgumentsTransformers(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::ARGUMENT_TRANSFORMER_TAG);
$definition = $container->getDefinition($this->getDefinitionArgumentTransformerId());
foreach ($references as $reference) {
$definition->addMethodCall('registerArgumentTransformer', array($reference));
}
} | [
"protected",
"function",
"processArgumentsTransformers",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"references",
"=",
"$",
"this",
"->",
"processor",
"->",
"findAndSortTaggedServices",
"(",
"$",
"container",
",",
"self",
"::",
"ARGUMENT_TRANSFORMER_TAG",
")",
";",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"$",
"this",
"->",
"getDefinitionArgumentTransformerId",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"references",
"as",
"$",
"reference",
")",
"{",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'registerArgumentTransformer'",
",",
"array",
"(",
"$",
"reference",
")",
")",
";",
"}",
"}"
] | Processes all available argument transformers.
@param ContainerBuilder $container | [
"Processes",
"all",
"available",
"argument",
"transformers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php#L158-L166 | train |
Behat/Behat | features/bootstrap/FeatureContext.php | FeatureContext.iRunBehatInteractively | public function iRunBehatInteractively($answerString, $argumentsString)
{
$env = $this->process->getEnv();
$env['SHELL_INTERACTIVE'] = true;
$this->process->setEnv($env);
$this->process->setInput($answerString);
$this->options = '--format-settings=\'{"timer": false}\'';
$this->iRunBehat($argumentsString);
} | php | public function iRunBehatInteractively($answerString, $argumentsString)
{
$env = $this->process->getEnv();
$env['SHELL_INTERACTIVE'] = true;
$this->process->setEnv($env);
$this->process->setInput($answerString);
$this->options = '--format-settings=\'{"timer": false}\'';
$this->iRunBehat($argumentsString);
} | [
"public",
"function",
"iRunBehatInteractively",
"(",
"$",
"answerString",
",",
"$",
"argumentsString",
")",
"{",
"$",
"env",
"=",
"$",
"this",
"->",
"process",
"->",
"getEnv",
"(",
")",
";",
"$",
"env",
"[",
"'SHELL_INTERACTIVE'",
"]",
"=",
"true",
";",
"$",
"this",
"->",
"process",
"->",
"setEnv",
"(",
"$",
"env",
")",
";",
"$",
"this",
"->",
"process",
"->",
"setInput",
"(",
"$",
"answerString",
")",
";",
"$",
"this",
"->",
"options",
"=",
"'--format-settings=\\'{\"timer\": false}\\''",
";",
"$",
"this",
"->",
"iRunBehat",
"(",
"$",
"argumentsString",
")",
";",
"}"
] | Runs behat command with provided parameters in interactive mode
@When /^I answer "([^"]+)" when running "behat(?: ((?:\"|[^"])*))?"$/
@param string $answerString
@param string $argumentsString | [
"Runs",
"behat",
"command",
"with",
"provided",
"parameters",
"in",
"interactive",
"mode"
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/features/bootstrap/FeatureContext.php#L216-L226 | train |
Behat/Behat | features/bootstrap/FeatureContext.php | FeatureContext.itShouldPassWith | public function itShouldPassWith($success, PyStringNode $text)
{
$this->itShouldFail($success);
$this->theOutputShouldContain($text);
} | php | public function itShouldPassWith($success, PyStringNode $text)
{
$this->itShouldFail($success);
$this->theOutputShouldContain($text);
} | [
"public",
"function",
"itShouldPassWith",
"(",
"$",
"success",
",",
"PyStringNode",
"$",
"text",
")",
"{",
"$",
"this",
"->",
"itShouldFail",
"(",
"$",
"success",
")",
";",
"$",
"this",
"->",
"theOutputShouldContain",
"(",
"$",
"text",
")",
";",
"}"
] | Checks whether previously ran command passes|fails with provided output.
@Then /^it should (fail|pass) with:$/
@param string $success "fail" or "pass"
@param PyStringNode $text PyString text instance | [
"Checks",
"whether",
"previously",
"ran",
"command",
"passes|fails",
"with",
"provided",
"output",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/features/bootstrap/FeatureContext.php#L247-L251 | train |
Behat/Behat | features/bootstrap/FeatureContext.php | FeatureContext.fileXmlShouldBeLike | public function fileXmlShouldBeLike($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
$fileContent = preg_replace('/time="(.*)"/', 'time="-IGNORE-VALUE-"', $fileContent);
$dom = new DOMDocument();
$dom->loadXML($text);
$dom->formatOutput = true;
Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
} | php | public function fileXmlShouldBeLike($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
$fileContent = preg_replace('/time="(.*)"/', 'time="-IGNORE-VALUE-"', $fileContent);
$dom = new DOMDocument();
$dom->loadXML($text);
$dom->formatOutput = true;
Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
} | [
"public",
"function",
"fileXmlShouldBeLike",
"(",
"$",
"path",
",",
"PyStringNode",
"$",
"text",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"workingDir",
".",
"'/'",
".",
"$",
"path",
";",
"Assert",
"::",
"assertFileExists",
"(",
"$",
"path",
")",
";",
"$",
"fileContent",
"=",
"trim",
"(",
"file_get_contents",
"(",
"$",
"path",
")",
")",
";",
"$",
"fileContent",
"=",
"preg_replace",
"(",
"'/time=\"(.*)\"/'",
",",
"'time=\"-IGNORE-VALUE-\"'",
",",
"$",
"fileContent",
")",
";",
"$",
"dom",
"=",
"new",
"DOMDocument",
"(",
")",
";",
"$",
"dom",
"->",
"loadXML",
"(",
"$",
"text",
")",
";",
"$",
"dom",
"->",
"formatOutput",
"=",
"true",
";",
"Assert",
"::",
"assertEquals",
"(",
"trim",
"(",
"$",
"dom",
"->",
"saveXML",
"(",
"null",
",",
"LIBXML_NOEMPTYTAG",
")",
")",
",",
"$",
"fileContent",
")",
";",
"}"
] | Checks whether specified content and structure of the xml is correct without worrying about layout.
@Then /^"([^"]*)" file xml should be like:$/
@param string $path file path
@param PyStringNode $text file content | [
"Checks",
"whether",
"specified",
"content",
"and",
"structure",
"of",
"the",
"xml",
"is",
"correct",
"without",
"worrying",
"about",
"layout",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/features/bootstrap/FeatureContext.php#L296-L310 | train |
Behat/Behat | features/bootstrap/FeatureContext.php | FeatureContext.xmlShouldBeValid | public function xmlShouldBeValid($xmlFile, $schemaPath)
{
$dom = new DomDocument();
$dom->load($this->workingDir . '/' . $xmlFile);
$dom->schemaValidate(__DIR__ . '/schema/' . $schemaPath);
} | php | public function xmlShouldBeValid($xmlFile, $schemaPath)
{
$dom = new DomDocument();
$dom->load($this->workingDir . '/' . $xmlFile);
$dom->schemaValidate(__DIR__ . '/schema/' . $schemaPath);
} | [
"public",
"function",
"xmlShouldBeValid",
"(",
"$",
"xmlFile",
",",
"$",
"schemaPath",
")",
"{",
"$",
"dom",
"=",
"new",
"DomDocument",
"(",
")",
";",
"$",
"dom",
"->",
"load",
"(",
"$",
"this",
"->",
"workingDir",
".",
"'/'",
".",
"$",
"xmlFile",
")",
";",
"$",
"dom",
"->",
"schemaValidate",
"(",
"__DIR__",
".",
"'/schema/'",
".",
"$",
"schemaPath",
")",
";",
"}"
] | Checks whether the file is valid according to an XML schema.
@Then /^the file "([^"]+)" should be a valid document according to "([^"]+)"$/
@param string $xmlFile
@param string $schemaPath relative to features/bootstrap/schema | [
"Checks",
"whether",
"the",
"file",
"is",
"valid",
"according",
"to",
"an",
"XML",
"schema",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/features/bootstrap/FeatureContext.php#L388-L394 | train |
Behat/Behat | src/Behat/Behat/Hook/ServiceContainer/HookExtension.php | HookExtension.loadAnnotationReader | private function loadAnnotationReader(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Hook\Context\Annotation\HookAnnotationReader');
$definition->addTag(ContextExtension::ANNOTATION_READER_TAG, array('priority' => 50));
$container->setDefinition(ContextExtension::ANNOTATION_READER_TAG . '.hook', $definition);
} | php | private function loadAnnotationReader(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Hook\Context\Annotation\HookAnnotationReader');
$definition->addTag(ContextExtension::ANNOTATION_READER_TAG, array('priority' => 50));
$container->setDefinition(ContextExtension::ANNOTATION_READER_TAG . '.hook', $definition);
} | [
"private",
"function",
"loadAnnotationReader",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Hook\\Context\\Annotation\\HookAnnotationReader'",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"ContextExtension",
"::",
"ANNOTATION_READER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"ContextExtension",
"::",
"ANNOTATION_READER_TAG",
".",
"'.hook'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads hook annotation reader.
@param ContainerBuilder $container | [
"Loads",
"hook",
"annotation",
"reader",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Hook/ServiceContainer/HookExtension.php#L82-L87 | train |
Behat/Behat | src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php | PrettyFormatterFactory.loadRootNodeListener | protected function loadRootNodeListener(ContainerBuilder $container)
{
$definition = new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array(
array(
new Definition('Behat\Behat\Output\Node\EventListener\AST\SuiteListener', array(
new Reference('output.node.printer.pretty.suite_setup')
)),
new Definition('Behat\Behat\Output\Node\EventListener\AST\FeatureListener', array(
new Reference('output.node.printer.pretty.feature'),
new Reference('output.node.printer.pretty.feature_setup')
)),
$this->proxySiblingEvents(
BackgroundTested::BEFORE,
BackgroundTested::AFTER,
array(
new Definition('Behat\Behat\Output\Node\EventListener\AST\ScenarioNodeListener', array(
BackgroundTested::AFTER_SETUP,
BackgroundTested::AFTER,
new Reference('output.node.printer.pretty.scenario')
)),
new Definition('Behat\Behat\Output\Node\EventListener\AST\StepListener', array(
new Reference('output.node.printer.pretty.step'),
new Reference('output.node.printer.pretty.step_setup')
)),
)
),
$this->proxySiblingEvents(
ScenarioTested::BEFORE,
ScenarioTested::AFTER,
array(
new Definition('Behat\Behat\Output\Node\EventListener\AST\ScenarioNodeListener', array(
ScenarioTested::AFTER_SETUP,
ScenarioTested::AFTER,
new Reference('output.node.printer.pretty.scenario'),
new Reference('output.node.printer.pretty.scenario_setup')
)),
new Definition('Behat\Behat\Output\Node\EventListener\AST\StepListener', array(
new Reference('output.node.printer.pretty.step'),
new Reference('output.node.printer.pretty.step_setup')
)),
)
),
$this->proxySiblingEvents(
OutlineTested::BEFORE,
OutlineTested::AFTER,
array(
$this->proxyEventsIfParameterIsSet(
'expand',
false,
new Definition('Behat\Behat\Output\Node\EventListener\AST\OutlineTableListener', array(
new Reference('output.node.printer.pretty.outline_table'),
new Reference('output.node.printer.pretty.example_row'),
new Reference('output.node.printer.pretty.example_setup'),
new Reference('output.node.printer.pretty.example_step_setup')
))
),
$this->proxyEventsIfParameterIsSet(
'expand',
true,
new Definition('Behat\Behat\Output\Node\EventListener\AST\OutlineListener', array(
new Reference('output.node.printer.pretty.outline'),
new Reference('output.node.printer.pretty.example'),
new Reference('output.node.printer.pretty.example_step'),
new Reference('output.node.printer.pretty.example_setup'),
new Reference('output.node.printer.pretty.example_step_setup')
))
)
)
),
)
));
$container->setDefinition(self::ROOT_LISTENER_ID, $definition);
} | php | protected function loadRootNodeListener(ContainerBuilder $container)
{
$definition = new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array(
array(
new Definition('Behat\Behat\Output\Node\EventListener\AST\SuiteListener', array(
new Reference('output.node.printer.pretty.suite_setup')
)),
new Definition('Behat\Behat\Output\Node\EventListener\AST\FeatureListener', array(
new Reference('output.node.printer.pretty.feature'),
new Reference('output.node.printer.pretty.feature_setup')
)),
$this->proxySiblingEvents(
BackgroundTested::BEFORE,
BackgroundTested::AFTER,
array(
new Definition('Behat\Behat\Output\Node\EventListener\AST\ScenarioNodeListener', array(
BackgroundTested::AFTER_SETUP,
BackgroundTested::AFTER,
new Reference('output.node.printer.pretty.scenario')
)),
new Definition('Behat\Behat\Output\Node\EventListener\AST\StepListener', array(
new Reference('output.node.printer.pretty.step'),
new Reference('output.node.printer.pretty.step_setup')
)),
)
),
$this->proxySiblingEvents(
ScenarioTested::BEFORE,
ScenarioTested::AFTER,
array(
new Definition('Behat\Behat\Output\Node\EventListener\AST\ScenarioNodeListener', array(
ScenarioTested::AFTER_SETUP,
ScenarioTested::AFTER,
new Reference('output.node.printer.pretty.scenario'),
new Reference('output.node.printer.pretty.scenario_setup')
)),
new Definition('Behat\Behat\Output\Node\EventListener\AST\StepListener', array(
new Reference('output.node.printer.pretty.step'),
new Reference('output.node.printer.pretty.step_setup')
)),
)
),
$this->proxySiblingEvents(
OutlineTested::BEFORE,
OutlineTested::AFTER,
array(
$this->proxyEventsIfParameterIsSet(
'expand',
false,
new Definition('Behat\Behat\Output\Node\EventListener\AST\OutlineTableListener', array(
new Reference('output.node.printer.pretty.outline_table'),
new Reference('output.node.printer.pretty.example_row'),
new Reference('output.node.printer.pretty.example_setup'),
new Reference('output.node.printer.pretty.example_step_setup')
))
),
$this->proxyEventsIfParameterIsSet(
'expand',
true,
new Definition('Behat\Behat\Output\Node\EventListener\AST\OutlineListener', array(
new Reference('output.node.printer.pretty.outline'),
new Reference('output.node.printer.pretty.example'),
new Reference('output.node.printer.pretty.example_step'),
new Reference('output.node.printer.pretty.example_setup'),
new Reference('output.node.printer.pretty.example_step_setup')
))
)
)
),
)
));
$container->setDefinition(self::ROOT_LISTENER_ID, $definition);
} | [
"protected",
"function",
"loadRootNodeListener",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Testwork\\Output\\Node\\EventListener\\ChainEventListener'",
",",
"array",
"(",
"array",
"(",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\EventListener\\AST\\SuiteListener'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'output.node.printer.pretty.suite_setup'",
")",
")",
")",
",",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\EventListener\\AST\\FeatureListener'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'output.node.printer.pretty.feature'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.feature_setup'",
")",
")",
")",
",",
"$",
"this",
"->",
"proxySiblingEvents",
"(",
"BackgroundTested",
"::",
"BEFORE",
",",
"BackgroundTested",
"::",
"AFTER",
",",
"array",
"(",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\EventListener\\AST\\ScenarioNodeListener'",
",",
"array",
"(",
"BackgroundTested",
"::",
"AFTER_SETUP",
",",
"BackgroundTested",
"::",
"AFTER",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.scenario'",
")",
")",
")",
",",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\EventListener\\AST\\StepListener'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'output.node.printer.pretty.step'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.step_setup'",
")",
")",
")",
",",
")",
")",
",",
"$",
"this",
"->",
"proxySiblingEvents",
"(",
"ScenarioTested",
"::",
"BEFORE",
",",
"ScenarioTested",
"::",
"AFTER",
",",
"array",
"(",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\EventListener\\AST\\ScenarioNodeListener'",
",",
"array",
"(",
"ScenarioTested",
"::",
"AFTER_SETUP",
",",
"ScenarioTested",
"::",
"AFTER",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.scenario'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.scenario_setup'",
")",
")",
")",
",",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\EventListener\\AST\\StepListener'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'output.node.printer.pretty.step'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.step_setup'",
")",
")",
")",
",",
")",
")",
",",
"$",
"this",
"->",
"proxySiblingEvents",
"(",
"OutlineTested",
"::",
"BEFORE",
",",
"OutlineTested",
"::",
"AFTER",
",",
"array",
"(",
"$",
"this",
"->",
"proxyEventsIfParameterIsSet",
"(",
"'expand'",
",",
"false",
",",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\EventListener\\AST\\OutlineTableListener'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'output.node.printer.pretty.outline_table'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.example_row'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.example_setup'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.example_step_setup'",
")",
")",
")",
")",
",",
"$",
"this",
"->",
"proxyEventsIfParameterIsSet",
"(",
"'expand'",
",",
"true",
",",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\EventListener\\AST\\OutlineListener'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'output.node.printer.pretty.outline'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.example'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.example_step'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.example_setup'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.example_step_setup'",
")",
")",
")",
")",
")",
")",
",",
")",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"ROOT_LISTENER_ID",
",",
"$",
"definition",
")",
";",
"}"
] | Loads pretty formatter node event listener.
@param ContainerBuilder $container | [
"Loads",
"pretty",
"formatter",
"node",
"event",
"listener",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php#L89-L161 | train |
Behat/Behat | src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php | PrettyFormatterFactory.loadTableOutlinePrinter | protected function loadTableOutlinePrinter(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyOutlineTablePrinter', array(
new Reference('output.node.printer.pretty.scenario'),
new Reference('output.node.printer.pretty.skipped_step'),
new Reference(self::RESULT_TO_STRING_CONVERTER_ID)
));
$container->setDefinition('output.node.printer.pretty.outline_table', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyExampleRowPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID)
));
$container->setDefinition('output.node.printer.pretty.example_row', $definition);
} | php | protected function loadTableOutlinePrinter(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyOutlineTablePrinter', array(
new Reference('output.node.printer.pretty.scenario'),
new Reference('output.node.printer.pretty.skipped_step'),
new Reference(self::RESULT_TO_STRING_CONVERTER_ID)
));
$container->setDefinition('output.node.printer.pretty.outline_table', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyExampleRowPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID)
));
$container->setDefinition('output.node.printer.pretty.example_row', $definition);
} | [
"protected",
"function",
"loadTableOutlinePrinter",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\Printer\\Pretty\\PrettyOutlineTablePrinter'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'output.node.printer.pretty.scenario'",
")",
",",
"new",
"Reference",
"(",
"'output.node.printer.pretty.skipped_step'",
")",
",",
"new",
"Reference",
"(",
"self",
"::",
"RESULT_TO_STRING_CONVERTER_ID",
")",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'output.node.printer.pretty.outline_table'",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\Printer\\Pretty\\PrettyExampleRowPrinter'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"RESULT_TO_STRING_CONVERTER_ID",
")",
",",
"new",
"Reference",
"(",
"ExceptionExtension",
"::",
"PRESENTER_ID",
")",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'output.node.printer.pretty.example_row'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads table outline printer.
@param ContainerBuilder $container | [
"Loads",
"table",
"outline",
"printer",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php#L249-L263 | train |
Behat/Behat | src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php | PrettyFormatterFactory.loadHookPrinters | protected function loadHookPrinters(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
0,
true,
true
));
$container->setDefinition('output.node.printer.pretty.suite_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
0,
false,
true
));
$container->setDefinition('output.node.printer.pretty.feature_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
2
));
$container->setDefinition('output.node.printer.pretty.scenario_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
4
));
$container->setDefinition('output.node.printer.pretty.step_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
8
));
$container->setDefinition('output.node.printer.pretty.example_step_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
6
));
$container->setDefinition('output.node.printer.pretty.example_setup', $definition);
} | php | protected function loadHookPrinters(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
0,
true,
true
));
$container->setDefinition('output.node.printer.pretty.suite_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
0,
false,
true
));
$container->setDefinition('output.node.printer.pretty.feature_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
2
));
$container->setDefinition('output.node.printer.pretty.scenario_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
4
));
$container->setDefinition('output.node.printer.pretty.step_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
8
));
$container->setDefinition('output.node.printer.pretty.example_step_setup', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference(ExceptionExtension::PRESENTER_ID),
6
));
$container->setDefinition('output.node.printer.pretty.example_setup', $definition);
} | [
"protected",
"function",
"loadHookPrinters",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\Printer\\Pretty\\PrettySetupPrinter'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"RESULT_TO_STRING_CONVERTER_ID",
")",
",",
"new",
"Reference",
"(",
"ExceptionExtension",
"::",
"PRESENTER_ID",
")",
",",
"0",
",",
"true",
",",
"true",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'output.node.printer.pretty.suite_setup'",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\Printer\\Pretty\\PrettySetupPrinter'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"RESULT_TO_STRING_CONVERTER_ID",
")",
",",
"new",
"Reference",
"(",
"ExceptionExtension",
"::",
"PRESENTER_ID",
")",
",",
"0",
",",
"false",
",",
"true",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'output.node.printer.pretty.feature_setup'",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\Printer\\Pretty\\PrettySetupPrinter'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"RESULT_TO_STRING_CONVERTER_ID",
")",
",",
"new",
"Reference",
"(",
"ExceptionExtension",
"::",
"PRESENTER_ID",
")",
",",
"2",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'output.node.printer.pretty.scenario_setup'",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\Printer\\Pretty\\PrettySetupPrinter'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"RESULT_TO_STRING_CONVERTER_ID",
")",
",",
"new",
"Reference",
"(",
"ExceptionExtension",
"::",
"PRESENTER_ID",
")",
",",
"4",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'output.node.printer.pretty.step_setup'",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\Printer\\Pretty\\PrettySetupPrinter'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"RESULT_TO_STRING_CONVERTER_ID",
")",
",",
"new",
"Reference",
"(",
"ExceptionExtension",
"::",
"PRESENTER_ID",
")",
",",
"8",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'output.node.printer.pretty.example_step_setup'",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Output\\Node\\Printer\\Pretty\\PrettySetupPrinter'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"RESULT_TO_STRING_CONVERTER_ID",
")",
",",
"new",
"Reference",
"(",
"ExceptionExtension",
"::",
"PRESENTER_ID",
")",
",",
"6",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'output.node.printer.pretty.example_setup'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads hook printers.
@param ContainerBuilder $container | [
"Loads",
"hook",
"printers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php#L299-L346 | train |
Behat/Behat | src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php | PrettyFormatterFactory.processListenerWrappers | protected function processListenerWrappers(ContainerBuilder $container)
{
$this->processor->processWrapperServices($container, self::ROOT_LISTENER_ID, self::ROOT_LISTENER_WRAPPER_TAG);
} | php | protected function processListenerWrappers(ContainerBuilder $container)
{
$this->processor->processWrapperServices($container, self::ROOT_LISTENER_ID, self::ROOT_LISTENER_WRAPPER_TAG);
} | [
"protected",
"function",
"processListenerWrappers",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"this",
"->",
"processor",
"->",
"processWrapperServices",
"(",
"$",
"container",
",",
"self",
"::",
"ROOT_LISTENER_ID",
",",
"self",
"::",
"ROOT_LISTENER_WRAPPER_TAG",
")",
";",
"}"
] | Processes all registered pretty formatter node listener wrappers.
@param ContainerBuilder $container | [
"Processes",
"all",
"registered",
"pretty",
"formatter",
"node",
"listener",
"wrappers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php#L465-L468 | train |
Behat/Behat | src/Behat/Behat/Output/Statistics/TotalStatistics.php | TotalStatistics.registerScenarioStat | public function registerScenarioStat(ScenarioStat $stat)
{
if (TestResults::NO_TESTS === $stat->getResultCode()) {
return;
}
$this->scenarioCounters[$stat->getResultCode()]++;
if (TestResult::FAILED === $stat->getResultCode()) {
$this->failedScenarioStats[] = $stat;
}
if (TestResult::SKIPPED === $stat->getResultCode()) {
$this->skippedScenarioStats[] = $stat;
}
} | php | public function registerScenarioStat(ScenarioStat $stat)
{
if (TestResults::NO_TESTS === $stat->getResultCode()) {
return;
}
$this->scenarioCounters[$stat->getResultCode()]++;
if (TestResult::FAILED === $stat->getResultCode()) {
$this->failedScenarioStats[] = $stat;
}
if (TestResult::SKIPPED === $stat->getResultCode()) {
$this->skippedScenarioStats[] = $stat;
}
} | [
"public",
"function",
"registerScenarioStat",
"(",
"ScenarioStat",
"$",
"stat",
")",
"{",
"if",
"(",
"TestResults",
"::",
"NO_TESTS",
"===",
"$",
"stat",
"->",
"getResultCode",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"scenarioCounters",
"[",
"$",
"stat",
"->",
"getResultCode",
"(",
")",
"]",
"++",
";",
"if",
"(",
"TestResult",
"::",
"FAILED",
"===",
"$",
"stat",
"->",
"getResultCode",
"(",
")",
")",
"{",
"$",
"this",
"->",
"failedScenarioStats",
"[",
"]",
"=",
"$",
"stat",
";",
"}",
"if",
"(",
"TestResult",
"::",
"SKIPPED",
"===",
"$",
"stat",
"->",
"getResultCode",
"(",
")",
")",
"{",
"$",
"this",
"->",
"skippedScenarioStats",
"[",
"]",
"=",
"$",
"stat",
";",
"}",
"}"
] | Registers scenario stat.
@param ScenarioStat $stat | [
"Registers",
"scenario",
"stat",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Statistics/TotalStatistics.php#L126-L141 | train |
Behat/Behat | src/Behat/Behat/Output/Statistics/TotalStatistics.php | TotalStatistics.registerStepStat | public function registerStepStat(StepStat $stat)
{
$this->stepCounters[$stat->getResultCode()]++;
if (TestResult::FAILED === $stat->getResultCode()) {
$this->failedStepStats[] = $stat;
}
if (TestResult::PENDING === $stat->getResultCode()) {
$this->pendingStepStats[] = $stat;
}
} | php | public function registerStepStat(StepStat $stat)
{
$this->stepCounters[$stat->getResultCode()]++;
if (TestResult::FAILED === $stat->getResultCode()) {
$this->failedStepStats[] = $stat;
}
if (TestResult::PENDING === $stat->getResultCode()) {
$this->pendingStepStats[] = $stat;
}
} | [
"public",
"function",
"registerStepStat",
"(",
"StepStat",
"$",
"stat",
")",
"{",
"$",
"this",
"->",
"stepCounters",
"[",
"$",
"stat",
"->",
"getResultCode",
"(",
")",
"]",
"++",
";",
"if",
"(",
"TestResult",
"::",
"FAILED",
"===",
"$",
"stat",
"->",
"getResultCode",
"(",
")",
")",
"{",
"$",
"this",
"->",
"failedStepStats",
"[",
"]",
"=",
"$",
"stat",
";",
"}",
"if",
"(",
"TestResult",
"::",
"PENDING",
"===",
"$",
"stat",
"->",
"getResultCode",
"(",
")",
")",
"{",
"$",
"this",
"->",
"pendingStepStats",
"[",
"]",
"=",
"$",
"stat",
";",
"}",
"}"
] | Registers step stat.
@param StepStat $stat | [
"Registers",
"step",
"stat",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Statistics/TotalStatistics.php#L148-L159 | train |
Behat/Behat | src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php | HelperContainerExtension.isDefinitionShared | private function isDefinitionShared(Definition $definition)
{
if (method_exists($definition, 'isShared')) {
return $definition->isShared();
} else if (method_exists($definition, 'getScope')) {
return $definition->getScope() !== ContainerBuilder::SCOPE_PROTOTYPE;
}
return false;
} | php | private function isDefinitionShared(Definition $definition)
{
if (method_exists($definition, 'isShared')) {
return $definition->isShared();
} else if (method_exists($definition, 'getScope')) {
return $definition->getScope() !== ContainerBuilder::SCOPE_PROTOTYPE;
}
return false;
} | [
"private",
"function",
"isDefinitionShared",
"(",
"Definition",
"$",
"definition",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"definition",
",",
"'isShared'",
")",
")",
"{",
"return",
"$",
"definition",
"->",
"isShared",
"(",
")",
";",
"}",
"else",
"if",
"(",
"method_exists",
"(",
"$",
"definition",
",",
"'getScope'",
")",
")",
"{",
"return",
"$",
"definition",
"->",
"getScope",
"(",
")",
"!==",
"ContainerBuilder",
"::",
"SCOPE_PROTOTYPE",
";",
"}",
"return",
"false",
";",
"}"
] | Checks if provided definition is shared.
@param Definition $definition
@return bool
@todo Remove after upgrading to Symfony 2.8+ | [
"Checks",
"if",
"provided",
"definition",
"is",
"shared",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php#L116-L125 | train |
Behat/Behat | src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php | ConsoleDefinitionInformationPrinter.extractHeader | private function extractHeader(Suite $suite, Definition $definition)
{
$pattern = $definition->getPattern();
$lines = array();
$lines[] = strtr(
'{suite} <def_dimmed>|</def_dimmed> <info>{type}</info> <def_regex>{regex}</def_regex>', array(
'{suite}' => $suite->getName(),
'{type}' => $this->getDefinitionType($definition),
'{regex}' => $pattern,
)
);
return $lines;
} | php | private function extractHeader(Suite $suite, Definition $definition)
{
$pattern = $definition->getPattern();
$lines = array();
$lines[] = strtr(
'{suite} <def_dimmed>|</def_dimmed> <info>{type}</info> <def_regex>{regex}</def_regex>', array(
'{suite}' => $suite->getName(),
'{type}' => $this->getDefinitionType($definition),
'{regex}' => $pattern,
)
);
return $lines;
} | [
"private",
"function",
"extractHeader",
"(",
"Suite",
"$",
"suite",
",",
"Definition",
"$",
"definition",
")",
"{",
"$",
"pattern",
"=",
"$",
"definition",
"->",
"getPattern",
"(",
")",
";",
"$",
"lines",
"=",
"array",
"(",
")",
";",
"$",
"lines",
"[",
"]",
"=",
"strtr",
"(",
"'{suite} <def_dimmed>|</def_dimmed> <info>{type}</info> <def_regex>{regex}</def_regex>'",
",",
"array",
"(",
"'{suite}'",
"=>",
"$",
"suite",
"->",
"getName",
"(",
")",
",",
"'{type}'",
"=>",
"$",
"this",
"->",
"getDefinitionType",
"(",
"$",
"definition",
")",
",",
"'{regex}'",
"=>",
"$",
"pattern",
",",
")",
")",
";",
"return",
"$",
"lines",
";",
"}"
] | Extracts the formatted header from the definition.
@param Suite $suite
@param Definition $definition
@return string[] | [
"Extracts",
"the",
"formatted",
"header",
"from",
"the",
"definition",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php#L74-L87 | train |
Behat/Behat | src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php | ConsoleDefinitionInformationPrinter.extractDescription | private function extractDescription(Suite $suite, Definition $definition)
{
$definition = $this->translateDefinition($suite, $definition);
$lines = array();
if ($description = $definition->getDescription()) {
foreach (explode("\n", $description) as $descriptionLine) {
$lines[] = strtr(
'{space}<def_dimmed>|</def_dimmed> {description}', array(
'{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1),
'{description}' => $descriptionLine
)
);
}
}
return $lines;
} | php | private function extractDescription(Suite $suite, Definition $definition)
{
$definition = $this->translateDefinition($suite, $definition);
$lines = array();
if ($description = $definition->getDescription()) {
foreach (explode("\n", $description) as $descriptionLine) {
$lines[] = strtr(
'{space}<def_dimmed>|</def_dimmed> {description}', array(
'{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1),
'{description}' => $descriptionLine
)
);
}
}
return $lines;
} | [
"private",
"function",
"extractDescription",
"(",
"Suite",
"$",
"suite",
",",
"Definition",
"$",
"definition",
")",
"{",
"$",
"definition",
"=",
"$",
"this",
"->",
"translateDefinition",
"(",
"$",
"suite",
",",
"$",
"definition",
")",
";",
"$",
"lines",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"description",
"=",
"$",
"definition",
"->",
"getDescription",
"(",
")",
")",
"{",
"foreach",
"(",
"explode",
"(",
"\"\\n\"",
",",
"$",
"description",
")",
"as",
"$",
"descriptionLine",
")",
"{",
"$",
"lines",
"[",
"]",
"=",
"strtr",
"(",
"'{space}<def_dimmed>|</def_dimmed> {description}'",
",",
"array",
"(",
"'{space}'",
"=>",
"str_pad",
"(",
"''",
",",
"mb_strlen",
"(",
"$",
"suite",
"->",
"getName",
"(",
")",
",",
"'utf8'",
")",
"+",
"1",
")",
",",
"'{description}'",
"=>",
"$",
"descriptionLine",
")",
")",
";",
"}",
"}",
"return",
"$",
"lines",
";",
"}"
] | Extracts the formatted description from the definition.
@param Suite $suite
@param Definition $definition
@return string[] | [
"Extracts",
"the",
"formatted",
"description",
"from",
"the",
"definition",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php#L97-L114 | train |
Behat/Behat | src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php | ConsoleDefinitionInformationPrinter.extractFooter | private function extractFooter(Suite $suite, Definition $definition)
{
$lines = array();
$lines[] = strtr(
'{space}<def_dimmed>|</def_dimmed> at `{path}`', array(
'{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1),
'{path}' => $definition->getPath()
)
);
if ($this->isVerbose()) {
$lines[] = strtr(
'{space}<def_dimmed>|</def_dimmed> on `{filepath}[{start}:{end}]`', array(
'{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1),
'{filepath}' => $definition->getReflection()->getFileName(),
'{start}' => $definition->getReflection()->getStartLine(),
'{end}' => $definition->getReflection()->getEndLine()
)
);
}
return $lines;
} | php | private function extractFooter(Suite $suite, Definition $definition)
{
$lines = array();
$lines[] = strtr(
'{space}<def_dimmed>|</def_dimmed> at `{path}`', array(
'{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1),
'{path}' => $definition->getPath()
)
);
if ($this->isVerbose()) {
$lines[] = strtr(
'{space}<def_dimmed>|</def_dimmed> on `{filepath}[{start}:{end}]`', array(
'{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1),
'{filepath}' => $definition->getReflection()->getFileName(),
'{start}' => $definition->getReflection()->getStartLine(),
'{end}' => $definition->getReflection()->getEndLine()
)
);
}
return $lines;
} | [
"private",
"function",
"extractFooter",
"(",
"Suite",
"$",
"suite",
",",
"Definition",
"$",
"definition",
")",
"{",
"$",
"lines",
"=",
"array",
"(",
")",
";",
"$",
"lines",
"[",
"]",
"=",
"strtr",
"(",
"'{space}<def_dimmed>|</def_dimmed> at `{path}`'",
",",
"array",
"(",
"'{space}'",
"=>",
"str_pad",
"(",
"''",
",",
"mb_strlen",
"(",
"$",
"suite",
"->",
"getName",
"(",
")",
",",
"'utf8'",
")",
"+",
"1",
")",
",",
"'{path}'",
"=>",
"$",
"definition",
"->",
"getPath",
"(",
")",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isVerbose",
"(",
")",
")",
"{",
"$",
"lines",
"[",
"]",
"=",
"strtr",
"(",
"'{space}<def_dimmed>|</def_dimmed> on `{filepath}[{start}:{end}]`'",
",",
"array",
"(",
"'{space}'",
"=>",
"str_pad",
"(",
"''",
",",
"mb_strlen",
"(",
"$",
"suite",
"->",
"getName",
"(",
")",
",",
"'utf8'",
")",
"+",
"1",
")",
",",
"'{filepath}'",
"=>",
"$",
"definition",
"->",
"getReflection",
"(",
")",
"->",
"getFileName",
"(",
")",
",",
"'{start}'",
"=>",
"$",
"definition",
"->",
"getReflection",
"(",
")",
"->",
"getStartLine",
"(",
")",
",",
"'{end}'",
"=>",
"$",
"definition",
"->",
"getReflection",
"(",
")",
"->",
"getEndLine",
"(",
")",
")",
")",
";",
"}",
"return",
"$",
"lines",
";",
"}"
] | Extracts the formatted footer from the definition.
@param Suite $suite
@param Definition $definition
@return string[] | [
"Extracts",
"the",
"formatted",
"footer",
"from",
"the",
"definition",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php#L124-L146 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/CounterPrinter.php | CounterPrinter.printCounters | public function printCounters(OutputPrinter $printer, $intro, array $stats)
{
$stats = array_filter($stats, function ($count) { return 0 !== $count; });
if (0 === count($stats)) {
$totalCount = 0;
} else {
$totalCount = array_sum($stats);
}
$detailedStats = array();
foreach ($stats as $resultCode => $count) {
$style = $this->resultConverter->convertResultCodeToString($resultCode);
$transId = $style . '_count';
$message = $this->translator->transChoice($transId, $count, array('%1%' => $count), 'output');
$detailedStats[] = sprintf('{+%s}%s{-%s}', $style, $message, $style);
}
$message = $this->translator->transChoice($intro, $totalCount, array('%1%' => $totalCount), 'output');
$printer->write($message);
if (count($detailedStats)) {
$printer->write(sprintf(' (%s)', implode(', ', $detailedStats)));
}
$printer->writeln();
} | php | public function printCounters(OutputPrinter $printer, $intro, array $stats)
{
$stats = array_filter($stats, function ($count) { return 0 !== $count; });
if (0 === count($stats)) {
$totalCount = 0;
} else {
$totalCount = array_sum($stats);
}
$detailedStats = array();
foreach ($stats as $resultCode => $count) {
$style = $this->resultConverter->convertResultCodeToString($resultCode);
$transId = $style . '_count';
$message = $this->translator->transChoice($transId, $count, array('%1%' => $count), 'output');
$detailedStats[] = sprintf('{+%s}%s{-%s}', $style, $message, $style);
}
$message = $this->translator->transChoice($intro, $totalCount, array('%1%' => $totalCount), 'output');
$printer->write($message);
if (count($detailedStats)) {
$printer->write(sprintf(' (%s)', implode(', ', $detailedStats)));
}
$printer->writeln();
} | [
"public",
"function",
"printCounters",
"(",
"OutputPrinter",
"$",
"printer",
",",
"$",
"intro",
",",
"array",
"$",
"stats",
")",
"{",
"$",
"stats",
"=",
"array_filter",
"(",
"$",
"stats",
",",
"function",
"(",
"$",
"count",
")",
"{",
"return",
"0",
"!==",
"$",
"count",
";",
"}",
")",
";",
"if",
"(",
"0",
"===",
"count",
"(",
"$",
"stats",
")",
")",
"{",
"$",
"totalCount",
"=",
"0",
";",
"}",
"else",
"{",
"$",
"totalCount",
"=",
"array_sum",
"(",
"$",
"stats",
")",
";",
"}",
"$",
"detailedStats",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"stats",
"as",
"$",
"resultCode",
"=>",
"$",
"count",
")",
"{",
"$",
"style",
"=",
"$",
"this",
"->",
"resultConverter",
"->",
"convertResultCodeToString",
"(",
"$",
"resultCode",
")",
";",
"$",
"transId",
"=",
"$",
"style",
".",
"'_count'",
";",
"$",
"message",
"=",
"$",
"this",
"->",
"translator",
"->",
"transChoice",
"(",
"$",
"transId",
",",
"$",
"count",
",",
"array",
"(",
"'%1%'",
"=>",
"$",
"count",
")",
",",
"'output'",
")",
";",
"$",
"detailedStats",
"[",
"]",
"=",
"sprintf",
"(",
"'{+%s}%s{-%s}'",
",",
"$",
"style",
",",
"$",
"message",
",",
"$",
"style",
")",
";",
"}",
"$",
"message",
"=",
"$",
"this",
"->",
"translator",
"->",
"transChoice",
"(",
"$",
"intro",
",",
"$",
"totalCount",
",",
"array",
"(",
"'%1%'",
"=>",
"$",
"totalCount",
")",
",",
"'output'",
")",
";",
"$",
"printer",
"->",
"write",
"(",
"$",
"message",
")",
";",
"if",
"(",
"count",
"(",
"$",
"detailedStats",
")",
")",
"{",
"$",
"printer",
"->",
"write",
"(",
"sprintf",
"(",
"' (%s)'",
",",
"implode",
"(",
"', '",
",",
"$",
"detailedStats",
")",
")",
")",
";",
"}",
"$",
"printer",
"->",
"writeln",
"(",
")",
";",
"}"
] | Prints scenario and step counters.
@param OutputPrinter $printer
@param string $intro
@param array $stats | [
"Prints",
"scenario",
"and",
"step",
"counters",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php#L52-L80 | train |
Behat/Behat | src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php | ConsoleDefinitionPrinter.translateDefinition | final protected function translateDefinition(Suite $suite, Definition $definition)
{
return $this->translator->translateDefinition($suite, $definition);
} | php | final protected function translateDefinition(Suite $suite, Definition $definition)
{
return $this->translator->translateDefinition($suite, $definition);
} | [
"final",
"protected",
"function",
"translateDefinition",
"(",
"Suite",
"$",
"suite",
",",
"Definition",
"$",
"definition",
")",
"{",
"return",
"$",
"this",
"->",
"translator",
"->",
"translateDefinition",
"(",
"$",
"suite",
",",
"$",
"definition",
")",
";",
"}"
] | Translates definition using translator.
@param Suite $suite
@param Definition $definition
@return Definition | [
"Translates",
"definition",
"using",
"translator",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php#L109-L112 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php | PrettyPathPrinter.printScenarioPath | public function printScenarioPath(Formatter $formatter, FeatureNode $feature, Scenario $scenario, $indentation)
{
$printer = $formatter->getOutputPrinter();
if (!$formatter->getParameter('paths')) {
$printer->writeln();
return;
}
$fileAndLine = sprintf('%s:%s', $this->relativizePaths($feature->getFile()), $scenario->getLine());
$headerWidth = $this->widthCalculator->calculateScenarioHeaderWidth($scenario, $indentation);
$scenarioWidth = $this->widthCalculator->calculateScenarioWidth($scenario, $indentation, 2);
$spacing = str_repeat(' ', max(0, $scenarioWidth - $headerWidth));
$printer->writeln(sprintf('%s {+comment}# %s{-comment}', $spacing, $fileAndLine));
} | php | public function printScenarioPath(Formatter $formatter, FeatureNode $feature, Scenario $scenario, $indentation)
{
$printer = $formatter->getOutputPrinter();
if (!$formatter->getParameter('paths')) {
$printer->writeln();
return;
}
$fileAndLine = sprintf('%s:%s', $this->relativizePaths($feature->getFile()), $scenario->getLine());
$headerWidth = $this->widthCalculator->calculateScenarioHeaderWidth($scenario, $indentation);
$scenarioWidth = $this->widthCalculator->calculateScenarioWidth($scenario, $indentation, 2);
$spacing = str_repeat(' ', max(0, $scenarioWidth - $headerWidth));
$printer->writeln(sprintf('%s {+comment}# %s{-comment}', $spacing, $fileAndLine));
} | [
"public",
"function",
"printScenarioPath",
"(",
"Formatter",
"$",
"formatter",
",",
"FeatureNode",
"$",
"feature",
",",
"Scenario",
"$",
"scenario",
",",
"$",
"indentation",
")",
"{",
"$",
"printer",
"=",
"$",
"formatter",
"->",
"getOutputPrinter",
"(",
")",
";",
"if",
"(",
"!",
"$",
"formatter",
"->",
"getParameter",
"(",
"'paths'",
")",
")",
"{",
"$",
"printer",
"->",
"writeln",
"(",
")",
";",
"return",
";",
"}",
"$",
"fileAndLine",
"=",
"sprintf",
"(",
"'%s:%s'",
",",
"$",
"this",
"->",
"relativizePaths",
"(",
"$",
"feature",
"->",
"getFile",
"(",
")",
")",
",",
"$",
"scenario",
"->",
"getLine",
"(",
")",
")",
";",
"$",
"headerWidth",
"=",
"$",
"this",
"->",
"widthCalculator",
"->",
"calculateScenarioHeaderWidth",
"(",
"$",
"scenario",
",",
"$",
"indentation",
")",
";",
"$",
"scenarioWidth",
"=",
"$",
"this",
"->",
"widthCalculator",
"->",
"calculateScenarioWidth",
"(",
"$",
"scenario",
",",
"$",
"indentation",
",",
"2",
")",
";",
"$",
"spacing",
"=",
"str_repeat",
"(",
"' '",
",",
"max",
"(",
"0",
",",
"$",
"scenarioWidth",
"-",
"$",
"headerWidth",
")",
")",
";",
"$",
"printer",
"->",
"writeln",
"(",
"sprintf",
"(",
"'%s {+comment}# %s{-comment}'",
",",
"$",
"spacing",
",",
"$",
"fileAndLine",
")",
")",
";",
"}"
] | Prints scenario path comment.
@param Formatter $formatter
@param FeatureNode $feature
@param Scenario $scenario
@param integer $indentation | [
"Prints",
"scenario",
"path",
"comment",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php#L58-L74 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php | PrettyPathPrinter.printStepPath | public function printStepPath(
Formatter $formatter,
Scenario $scenario,
StepNode $step,
StepResult $result,
$indentation
) {
$printer = $formatter->getOutputPrinter();
if (!$result instanceof DefinedStepResult || !$result->getStepDefinition() || !$formatter->getParameter('paths')) {
$printer->writeln();
return;
}
$textWidth = $this->widthCalculator->calculateStepWidth($step, $indentation);
$scenarioWidth = $this->widthCalculator->calculateScenarioWidth($scenario, $indentation - 2, 2);
$this->printDefinedStepPath($printer, $result, $scenarioWidth, $textWidth);
} | php | public function printStepPath(
Formatter $formatter,
Scenario $scenario,
StepNode $step,
StepResult $result,
$indentation
) {
$printer = $formatter->getOutputPrinter();
if (!$result instanceof DefinedStepResult || !$result->getStepDefinition() || !$formatter->getParameter('paths')) {
$printer->writeln();
return;
}
$textWidth = $this->widthCalculator->calculateStepWidth($step, $indentation);
$scenarioWidth = $this->widthCalculator->calculateScenarioWidth($scenario, $indentation - 2, 2);
$this->printDefinedStepPath($printer, $result, $scenarioWidth, $textWidth);
} | [
"public",
"function",
"printStepPath",
"(",
"Formatter",
"$",
"formatter",
",",
"Scenario",
"$",
"scenario",
",",
"StepNode",
"$",
"step",
",",
"StepResult",
"$",
"result",
",",
"$",
"indentation",
")",
"{",
"$",
"printer",
"=",
"$",
"formatter",
"->",
"getOutputPrinter",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"instanceof",
"DefinedStepResult",
"||",
"!",
"$",
"result",
"->",
"getStepDefinition",
"(",
")",
"||",
"!",
"$",
"formatter",
"->",
"getParameter",
"(",
"'paths'",
")",
")",
"{",
"$",
"printer",
"->",
"writeln",
"(",
")",
";",
"return",
";",
"}",
"$",
"textWidth",
"=",
"$",
"this",
"->",
"widthCalculator",
"->",
"calculateStepWidth",
"(",
"$",
"step",
",",
"$",
"indentation",
")",
";",
"$",
"scenarioWidth",
"=",
"$",
"this",
"->",
"widthCalculator",
"->",
"calculateScenarioWidth",
"(",
"$",
"scenario",
",",
"$",
"indentation",
"-",
"2",
",",
"2",
")",
";",
"$",
"this",
"->",
"printDefinedStepPath",
"(",
"$",
"printer",
",",
"$",
"result",
",",
"$",
"scenarioWidth",
",",
"$",
"textWidth",
")",
";",
"}"
] | Prints step path comment.
@param Formatter $formatter
@param Scenario $scenario
@param StepNode $step
@param StepResult $result
@param integer $indentation | [
"Prints",
"step",
"path",
"comment",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php#L85-L104 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php | PrettyPathPrinter.printDefinedStepPath | private function printDefinedStepPath(OutputPrinter $printer, DefinedStepResult $result, $scenarioWidth, $stepWidth)
{
$path = $result->getStepDefinition()->getPath();
$spacing = str_repeat(' ', max(0, $scenarioWidth - $stepWidth));
$printer->writeln(sprintf('%s {+comment}# %s{-comment}', $spacing, $path));
} | php | private function printDefinedStepPath(OutputPrinter $printer, DefinedStepResult $result, $scenarioWidth, $stepWidth)
{
$path = $result->getStepDefinition()->getPath();
$spacing = str_repeat(' ', max(0, $scenarioWidth - $stepWidth));
$printer->writeln(sprintf('%s {+comment}# %s{-comment}', $spacing, $path));
} | [
"private",
"function",
"printDefinedStepPath",
"(",
"OutputPrinter",
"$",
"printer",
",",
"DefinedStepResult",
"$",
"result",
",",
"$",
"scenarioWidth",
",",
"$",
"stepWidth",
")",
"{",
"$",
"path",
"=",
"$",
"result",
"->",
"getStepDefinition",
"(",
")",
"->",
"getPath",
"(",
")",
";",
"$",
"spacing",
"=",
"str_repeat",
"(",
"' '",
",",
"max",
"(",
"0",
",",
"$",
"scenarioWidth",
"-",
"$",
"stepWidth",
")",
")",
";",
"$",
"printer",
"->",
"writeln",
"(",
"sprintf",
"(",
"'%s {+comment}# %s{-comment}'",
",",
"$",
"spacing",
",",
"$",
"path",
")",
")",
";",
"}"
] | Prints defined step path.
@param OutputPrinter $printer
@param DefinedStepResult $result
@param integer $scenarioWidth
@param integer $stepWidth | [
"Prints",
"defined",
"step",
"path",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php#L114-L120 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php | PrettyPathPrinter.relativizePaths | private function relativizePaths($path)
{
if (!$this->basePath) {
return $path;
}
return str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path);
} | php | private function relativizePaths($path)
{
if (!$this->basePath) {
return $path;
}
return str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path);
} | [
"private",
"function",
"relativizePaths",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"basePath",
")",
"{",
"return",
"$",
"path",
";",
"}",
"return",
"str_replace",
"(",
"$",
"this",
"->",
"basePath",
".",
"DIRECTORY_SEPARATOR",
",",
"''",
",",
"$",
"path",
")",
";",
"}"
] | Transforms path to relative.
@param string $path
@return string | [
"Transforms",
"path",
"to",
"relative",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php#L129-L136 | train |
Behat/Behat | src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php | ReturnTypeTransformation.getReturnClass | static private function getReturnClass(ReflectionFunctionAbstract $reflection)
{
$type = $reflection->getReturnType();
if (null === $type || $type->isBuiltin()) {
return null;
}
return (string) $type;
} | php | static private function getReturnClass(ReflectionFunctionAbstract $reflection)
{
$type = $reflection->getReturnType();
if (null === $type || $type->isBuiltin()) {
return null;
}
return (string) $type;
} | [
"static",
"private",
"function",
"getReturnClass",
"(",
"ReflectionFunctionAbstract",
"$",
"reflection",
")",
"{",
"$",
"type",
"=",
"$",
"reflection",
"->",
"getReturnType",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"type",
"||",
"$",
"type",
"->",
"isBuiltin",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"string",
")",
"$",
"type",
";",
"}"
] | Extracts parameters from provided definition call.
@param ReflectionFunctionAbstract $reflection
@return null|string | [
"Extracts",
"parameters",
"from",
"provided",
"definition",
"call",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php#L125-L134 | train |
Behat/Behat | src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php | ReturnTypeTransformation.hasIndex | private function hasIndex($index)
{
return is_string($index) ? $this->hasName($index) : $this->hasPosition($index);
} | php | private function hasIndex($index)
{
return is_string($index) ? $this->hasName($index) : $this->hasPosition($index);
} | [
"private",
"function",
"hasIndex",
"(",
"$",
"index",
")",
"{",
"return",
"is_string",
"(",
"$",
"index",
")",
"?",
"$",
"this",
"->",
"hasName",
"(",
"$",
"index",
")",
":",
"$",
"this",
"->",
"hasPosition",
"(",
"$",
"index",
")",
";",
"}"
] | Returns appropriate closure for filtering parameter by index.
@param string|integer $index
@return Closure | [
"Returns",
"appropriate",
"closure",
"for",
"filtering",
"parameter",
"by",
"index",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php#L174-L177 | train |
Behat/Behat | src/Behat/Behat/Definition/Translator/DefinitionTranslator.php | DefinitionTranslator.translateDefinition | public function translateDefinition(Suite $suite, Definition $definition, $language = null)
{
$assetsId = $suite->getName();
$pattern = $definition->getPattern();
$translatedPattern = $this->translator->trans($pattern, array(), $assetsId, $language);
if ($pattern != $translatedPattern) {
return new TranslatedDefinition($definition, $translatedPattern, $language);
}
return $definition;
} | php | public function translateDefinition(Suite $suite, Definition $definition, $language = null)
{
$assetsId = $suite->getName();
$pattern = $definition->getPattern();
$translatedPattern = $this->translator->trans($pattern, array(), $assetsId, $language);
if ($pattern != $translatedPattern) {
return new TranslatedDefinition($definition, $translatedPattern, $language);
}
return $definition;
} | [
"public",
"function",
"translateDefinition",
"(",
"Suite",
"$",
"suite",
",",
"Definition",
"$",
"definition",
",",
"$",
"language",
"=",
"null",
")",
"{",
"$",
"assetsId",
"=",
"$",
"suite",
"->",
"getName",
"(",
")",
";",
"$",
"pattern",
"=",
"$",
"definition",
"->",
"getPattern",
"(",
")",
";",
"$",
"translatedPattern",
"=",
"$",
"this",
"->",
"translator",
"->",
"trans",
"(",
"$",
"pattern",
",",
"array",
"(",
")",
",",
"$",
"assetsId",
",",
"$",
"language",
")",
";",
"if",
"(",
"$",
"pattern",
"!=",
"$",
"translatedPattern",
")",
"{",
"return",
"new",
"TranslatedDefinition",
"(",
"$",
"definition",
",",
"$",
"translatedPattern",
",",
"$",
"language",
")",
";",
"}",
"return",
"$",
"definition",
";",
"}"
] | Attempts to translate definition using translator and produce translated one on success.
@param Suite $suite
@param Definition $definition
@param null|string $language
@return Definition|TranslatedDefinition | [
"Attempts",
"to",
"translate",
"definition",
"using",
"translator",
"and",
"produce",
"translated",
"one",
"on",
"success",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php#L48-L59 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php | PrettySkippedStepPrinter.getArgumentString | private function getArgumentString(ArgumentInterface $argument, $collapse = false)
{
if ($collapse) {
return '...';
}
if ($argument instanceof PyStringNode) {
$text = '"""' . "\n" . $argument . "\n" . '"""';
return $text;
}
return (string) $argument;
} | php | private function getArgumentString(ArgumentInterface $argument, $collapse = false)
{
if ($collapse) {
return '...';
}
if ($argument instanceof PyStringNode) {
$text = '"""' . "\n" . $argument . "\n" . '"""';
return $text;
}
return (string) $argument;
} | [
"private",
"function",
"getArgumentString",
"(",
"ArgumentInterface",
"$",
"argument",
",",
"$",
"collapse",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"collapse",
")",
"{",
"return",
"'...'",
";",
"}",
"if",
"(",
"$",
"argument",
"instanceof",
"PyStringNode",
")",
"{",
"$",
"text",
"=",
"'\"\"\"'",
".",
"\"\\n\"",
".",
"$",
"argument",
".",
"\"\\n\"",
".",
"'\"\"\"'",
";",
"return",
"$",
"text",
";",
"}",
"return",
"(",
"string",
")",
"$",
"argument",
";",
"}"
] | Returns argument string for provided argument.
@param ArgumentInterface $argument
@param Boolean $collapse
@return string | [
"Returns",
"argument",
"string",
"for",
"provided",
"argument",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php#L136-L149 | train |
Behat/Behat | src/Behat/Behat/Context/ContextFactory.php | ContextFactory.createContext | public function createContext($class, array $arguments = array(), array $singleUseResolvers = array())
{
$reflection = new ReflectionClass($class);
$resolvers = array_merge($singleUseResolvers, $this->argumentResolvers);
$resolvedArguments = $this->resolveArguments($reflection, $arguments, $resolvers);
$context = $this->createInstance($reflection, $resolvedArguments);
$this->initializeInstance($context);
return $context;
} | php | public function createContext($class, array $arguments = array(), array $singleUseResolvers = array())
{
$reflection = new ReflectionClass($class);
$resolvers = array_merge($singleUseResolvers, $this->argumentResolvers);
$resolvedArguments = $this->resolveArguments($reflection, $arguments, $resolvers);
$context = $this->createInstance($reflection, $resolvedArguments);
$this->initializeInstance($context);
return $context;
} | [
"public",
"function",
"createContext",
"(",
"$",
"class",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
",",
"array",
"$",
"singleUseResolvers",
"=",
"array",
"(",
")",
")",
"{",
"$",
"reflection",
"=",
"new",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"$",
"resolvers",
"=",
"array_merge",
"(",
"$",
"singleUseResolvers",
",",
"$",
"this",
"->",
"argumentResolvers",
")",
";",
"$",
"resolvedArguments",
"=",
"$",
"this",
"->",
"resolveArguments",
"(",
"$",
"reflection",
",",
"$",
"arguments",
",",
"$",
"resolvers",
")",
";",
"$",
"context",
"=",
"$",
"this",
"->",
"createInstance",
"(",
"$",
"reflection",
",",
"$",
"resolvedArguments",
")",
";",
"$",
"this",
"->",
"initializeInstance",
"(",
"$",
"context",
")",
";",
"return",
"$",
"context",
";",
"}"
] | Creates and initializes context class.
@param string $class
@param array $arguments
@param ArgumentResolver[] $singleUseResolvers
@return Context | [
"Creates",
"and",
"initializes",
"context",
"class",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ContextFactory.php#L83-L92 | train |
Behat/Behat | src/Behat/Behat/Context/ContextFactory.php | ContextFactory.resolveArguments | private function resolveArguments(ReflectionClass $reflection, array $arguments, array $resolvers)
{
$newArguments = $arguments;
foreach ($resolvers as $resolver) {
$newArguments = $resolver->resolveArguments($reflection, $newArguments);
}
if (!$reflection->hasMethod('__construct')) {
return $newArguments;
}
$constructor = $reflection->getConstructor();
$newArguments = $this->argumentOrganiser->organiseArguments($constructor, $newArguments);
$this->validator->validateArguments($constructor, $newArguments);
return $newArguments;
} | php | private function resolveArguments(ReflectionClass $reflection, array $arguments, array $resolvers)
{
$newArguments = $arguments;
foreach ($resolvers as $resolver) {
$newArguments = $resolver->resolveArguments($reflection, $newArguments);
}
if (!$reflection->hasMethod('__construct')) {
return $newArguments;
}
$constructor = $reflection->getConstructor();
$newArguments = $this->argumentOrganiser->organiseArguments($constructor, $newArguments);
$this->validator->validateArguments($constructor, $newArguments);
return $newArguments;
} | [
"private",
"function",
"resolveArguments",
"(",
"ReflectionClass",
"$",
"reflection",
",",
"array",
"$",
"arguments",
",",
"array",
"$",
"resolvers",
")",
"{",
"$",
"newArguments",
"=",
"$",
"arguments",
";",
"foreach",
"(",
"$",
"resolvers",
"as",
"$",
"resolver",
")",
"{",
"$",
"newArguments",
"=",
"$",
"resolver",
"->",
"resolveArguments",
"(",
"$",
"reflection",
",",
"$",
"newArguments",
")",
";",
"}",
"if",
"(",
"!",
"$",
"reflection",
"->",
"hasMethod",
"(",
"'__construct'",
")",
")",
"{",
"return",
"$",
"newArguments",
";",
"}",
"$",
"constructor",
"=",
"$",
"reflection",
"->",
"getConstructor",
"(",
")",
";",
"$",
"newArguments",
"=",
"$",
"this",
"->",
"argumentOrganiser",
"->",
"organiseArguments",
"(",
"$",
"constructor",
",",
"$",
"newArguments",
")",
";",
"$",
"this",
"->",
"validator",
"->",
"validateArguments",
"(",
"$",
"constructor",
",",
"$",
"newArguments",
")",
";",
"return",
"$",
"newArguments",
";",
"}"
] | Resolves arguments for a specific class using registered argument resolvers.
@param ReflectionClass $reflection
@param array $arguments
@param ArgumentResolver[] $resolvers
@return mixed[] | [
"Resolves",
"arguments",
"for",
"a",
"specific",
"class",
"using",
"registered",
"argument",
"resolvers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ContextFactory.php#L103-L120 | train |
Behat/Behat | src/Behat/Behat/Context/ContextFactory.php | ContextFactory.createInstance | private function createInstance(ReflectionClass $reflection, array $arguments)
{
if (count($arguments)) {
return $reflection->newInstanceArgs($arguments);
}
return $reflection->newInstance();
} | php | private function createInstance(ReflectionClass $reflection, array $arguments)
{
if (count($arguments)) {
return $reflection->newInstanceArgs($arguments);
}
return $reflection->newInstance();
} | [
"private",
"function",
"createInstance",
"(",
"ReflectionClass",
"$",
"reflection",
",",
"array",
"$",
"arguments",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"arguments",
")",
")",
"{",
"return",
"$",
"reflection",
"->",
"newInstanceArgs",
"(",
"$",
"arguments",
")",
";",
"}",
"return",
"$",
"reflection",
"->",
"newInstance",
"(",
")",
";",
"}"
] | Creates context instance.
@param ReflectionClass $reflection
@param array $arguments
@return mixed | [
"Creates",
"context",
"instance",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ContextFactory.php#L130-L137 | train |
Behat/Behat | src/Behat/Behat/Context/ContextFactory.php | ContextFactory.initializeInstance | private function initializeInstance(Context $context)
{
foreach ($this->contextInitializers as $initializer) {
$initializer->initializeContext($context);
}
} | php | private function initializeInstance(Context $context)
{
foreach ($this->contextInitializers as $initializer) {
$initializer->initializeContext($context);
}
} | [
"private",
"function",
"initializeInstance",
"(",
"Context",
"$",
"context",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"contextInitializers",
"as",
"$",
"initializer",
")",
"{",
"$",
"initializer",
"->",
"initializeContext",
"(",
"$",
"context",
")",
";",
"}",
"}"
] | Initializes context class and returns new context instance.
@param Context $context | [
"Initializes",
"context",
"class",
"and",
"returns",
"new",
"context",
"instance",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ContextFactory.php#L144-L149 | train |
Behat/Behat | src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php | TurnipPatternPolicy.replaceTokensWithRegexCaptureGroups | private function replaceTokensWithRegexCaptureGroups($regex)
{
$tokenRegex = self::TOKEN_REGEX;
return preg_replace_callback(
self::PLACEHOLDER_REGEXP,
array($this, 'replaceTokenWithRegexCaptureGroup'),
$regex
);
} | php | private function replaceTokensWithRegexCaptureGroups($regex)
{
$tokenRegex = self::TOKEN_REGEX;
return preg_replace_callback(
self::PLACEHOLDER_REGEXP,
array($this, 'replaceTokenWithRegexCaptureGroup'),
$regex
);
} | [
"private",
"function",
"replaceTokensWithRegexCaptureGroups",
"(",
"$",
"regex",
")",
"{",
"$",
"tokenRegex",
"=",
"self",
"::",
"TOKEN_REGEX",
";",
"return",
"preg_replace_callback",
"(",
"self",
"::",
"PLACEHOLDER_REGEXP",
",",
"array",
"(",
"$",
"this",
",",
"'replaceTokenWithRegexCaptureGroup'",
")",
",",
"$",
"regex",
")",
";",
"}"
] | Replaces turnip tokens with regex capture groups.
@param string $regex
@return string | [
"Replaces",
"turnip",
"tokens",
"with",
"regex",
"capture",
"groups",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php#L130-L139 | train |
Behat/Behat | src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php | TurnipPatternPolicy.replaceTurnipAlternativeWordsWithRegex | private function replaceTurnipAlternativeWordsWithRegex($regex)
{
$regex = preg_replace(self::ALTERNATIVE_WORD_REGEXP, '(?:\1|\2)', $regex);
$regex = $this->removeEscapingOfAlternationSyntax($regex);
return $regex;
} | php | private function replaceTurnipAlternativeWordsWithRegex($regex)
{
$regex = preg_replace(self::ALTERNATIVE_WORD_REGEXP, '(?:\1|\2)', $regex);
$regex = $this->removeEscapingOfAlternationSyntax($regex);
return $regex;
} | [
"private",
"function",
"replaceTurnipAlternativeWordsWithRegex",
"(",
"$",
"regex",
")",
"{",
"$",
"regex",
"=",
"preg_replace",
"(",
"self",
"::",
"ALTERNATIVE_WORD_REGEXP",
",",
"'(?:\\1|\\2)'",
",",
"$",
"regex",
")",
";",
"$",
"regex",
"=",
"$",
"this",
"->",
"removeEscapingOfAlternationSyntax",
"(",
"$",
"regex",
")",
";",
"return",
"$",
"regex",
";",
"}"
] | Replaces turnip alternative words with regex non-capturing alternating group.
@param string $regex
@return string | [
"Replaces",
"turnip",
"alternative",
"words",
"with",
"regex",
"non",
"-",
"capturing",
"alternating",
"group",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php#L171-L177 | train |
Behat/Behat | src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExamplePrinter.php | PrettyExamplePrinter.printTitle | private function printTitle(OutputPrinter $printer, ExampleNode $example)
{
$printer->write(sprintf('%s%s', $this->indentText, $example->getTitle()));
} | php | private function printTitle(OutputPrinter $printer, ExampleNode $example)
{
$printer->write(sprintf('%s%s', $this->indentText, $example->getTitle()));
} | [
"private",
"function",
"printTitle",
"(",
"OutputPrinter",
"$",
"printer",
",",
"ExampleNode",
"$",
"example",
")",
"{",
"$",
"printer",
"->",
"write",
"(",
"sprintf",
"(",
"'%s%s'",
",",
"$",
"this",
"->",
"indentText",
",",
"$",
"example",
"->",
"getTitle",
"(",
")",
")",
")",
";",
"}"
] | Prints example title.
@param OutputPrinter $printer
@param ExampleNode $example | [
"Prints",
"example",
"title",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExamplePrinter.php#L70-L73 | train |
Behat/Behat | src/Behat/Behat/Definition/DefinitionWriter.php | DefinitionWriter.printSuiteDefinitions | public function printSuiteDefinitions(DefinitionPrinter $printer, $suite)
{
$environment = $this->environmentManager->buildEnvironment($suite);
$definitions = $this->repository->getEnvironmentDefinitions($environment);
$printer->printDefinitions($suite, $definitions);
} | php | public function printSuiteDefinitions(DefinitionPrinter $printer, $suite)
{
$environment = $this->environmentManager->buildEnvironment($suite);
$definitions = $this->repository->getEnvironmentDefinitions($environment);
$printer->printDefinitions($suite, $definitions);
} | [
"public",
"function",
"printSuiteDefinitions",
"(",
"DefinitionPrinter",
"$",
"printer",
",",
"$",
"suite",
")",
"{",
"$",
"environment",
"=",
"$",
"this",
"->",
"environmentManager",
"->",
"buildEnvironment",
"(",
"$",
"suite",
")",
";",
"$",
"definitions",
"=",
"$",
"this",
"->",
"repository",
"->",
"getEnvironmentDefinitions",
"(",
"$",
"environment",
")",
";",
"$",
"printer",
"->",
"printDefinitions",
"(",
"$",
"suite",
",",
"$",
"definitions",
")",
";",
"}"
] | Prints definitions for provided suite using printer.
@param DefinitionPrinter $printer
@param Suite $suite | [
"Prints",
"definitions",
"for",
"provided",
"suite",
"using",
"printer",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/DefinitionWriter.php#L51-L57 | train |
Behat/Behat | src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php | OnlyFirstBackgroundFiresListener.flushStatesIfBeginningOfTheFeature | private function flushStatesIfBeginningOfTheFeature($eventName)
{
if (FeatureTested::BEFORE !== $eventName) {
return;
}
$this->firstBackgroundEnded = false;
$this->inBackground = false;
} | php | private function flushStatesIfBeginningOfTheFeature($eventName)
{
if (FeatureTested::BEFORE !== $eventName) {
return;
}
$this->firstBackgroundEnded = false;
$this->inBackground = false;
} | [
"private",
"function",
"flushStatesIfBeginningOfTheFeature",
"(",
"$",
"eventName",
")",
"{",
"if",
"(",
"FeatureTested",
"::",
"BEFORE",
"!==",
"$",
"eventName",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"firstBackgroundEnded",
"=",
"false",
";",
"$",
"this",
"->",
"inBackground",
"=",
"false",
";",
"}"
] | Flushes state if the event is the BEFORE feature.
@param string $eventName | [
"Flushes",
"state",
"if",
"the",
"event",
"is",
"the",
"BEFORE",
"feature",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php#L83-L91 | train |
Behat/Behat | src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php | OnlyFirstBackgroundFiresListener.markBeginningOrEndOfTheBackground | private function markBeginningOrEndOfTheBackground($eventName)
{
if (BackgroundTested::BEFORE === $eventName) {
$this->inBackground = true;
}
if (BackgroundTested::AFTER === $eventName) {
$this->inBackground = false;
}
} | php | private function markBeginningOrEndOfTheBackground($eventName)
{
if (BackgroundTested::BEFORE === $eventName) {
$this->inBackground = true;
}
if (BackgroundTested::AFTER === $eventName) {
$this->inBackground = false;
}
} | [
"private",
"function",
"markBeginningOrEndOfTheBackground",
"(",
"$",
"eventName",
")",
"{",
"if",
"(",
"BackgroundTested",
"::",
"BEFORE",
"===",
"$",
"eventName",
")",
"{",
"$",
"this",
"->",
"inBackground",
"=",
"true",
";",
"}",
"if",
"(",
"BackgroundTested",
"::",
"AFTER",
"===",
"$",
"eventName",
")",
"{",
"$",
"this",
"->",
"inBackground",
"=",
"false",
";",
"}",
"}"
] | Marks beginning or end of the background.
@param string $eventName | [
"Marks",
"beginning",
"or",
"end",
"of",
"the",
"background",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php#L98-L107 | train |
Behat/Behat | src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php | OnlyFirstBackgroundFiresListener.isSkippableEvent | private function isSkippableEvent(Event $event)
{
if (!$this->firstBackgroundEnded) {
return false;
}
return $event instanceof BackgroundTested || $this->isNonFailingConsequentBackgroundStep($event);
} | php | private function isSkippableEvent(Event $event)
{
if (!$this->firstBackgroundEnded) {
return false;
}
return $event instanceof BackgroundTested || $this->isNonFailingConsequentBackgroundStep($event);
} | [
"private",
"function",
"isSkippableEvent",
"(",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"firstBackgroundEnded",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"event",
"instanceof",
"BackgroundTested",
"||",
"$",
"this",
"->",
"isNonFailingConsequentBackgroundStep",
"(",
"$",
"event",
")",
";",
"}"
] | Checks if provided event is skippable.
@param Event $event
@return Boolean | [
"Checks",
"if",
"provided",
"event",
"is",
"skippable",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php#L130-L137 | train |
Behat/Behat | src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php | OnlyFirstBackgroundFiresListener.isBeforeStepEventWithOutput | private function isBeforeStepEventWithOutput(Event $event)
{
if ($event instanceof AfterStepSetup && $event->hasOutput()) {
$this->stepSetupHadOutput = true;
return true;
}
return false;
} | php | private function isBeforeStepEventWithOutput(Event $event)
{
if ($event instanceof AfterStepSetup && $event->hasOutput()) {
$this->stepSetupHadOutput = true;
return true;
}
return false;
} | [
"private",
"function",
"isBeforeStepEventWithOutput",
"(",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"instanceof",
"AfterStepSetup",
"&&",
"$",
"event",
"->",
"hasOutput",
"(",
")",
")",
"{",
"$",
"this",
"->",
"stepSetupHadOutput",
"=",
"true",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Checks if provided event is a BEFORE step with setup that produced output.
@param Event $event
@return Boolean | [
"Checks",
"if",
"provided",
"event",
"is",
"a",
"BEFORE",
"step",
"with",
"setup",
"that",
"produced",
"output",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php#L174-L183 | train |
Behat/Behat | src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php | OnlyFirstBackgroundFiresListener.isAfterStepWithOutput | private function isAfterStepWithOutput(Event $event)
{
if ($event instanceof AfterStepTested && ($this->stepSetupHadOutput || $event->hasOutput())) {
$this->stepSetupHadOutput = false;
return true;
}
return false;
} | php | private function isAfterStepWithOutput(Event $event)
{
if ($event instanceof AfterStepTested && ($this->stepSetupHadOutput || $event->hasOutput())) {
$this->stepSetupHadOutput = false;
return true;
}
return false;
} | [
"private",
"function",
"isAfterStepWithOutput",
"(",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"instanceof",
"AfterStepTested",
"&&",
"(",
"$",
"this",
"->",
"stepSetupHadOutput",
"||",
"$",
"event",
"->",
"hasOutput",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"stepSetupHadOutput",
"=",
"false",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Checks if provided event is an AFTER step with teardown that produced output.
@param Event $event
@return Boolean | [
"Checks",
"if",
"provided",
"event",
"is",
"an",
"AFTER",
"step",
"with",
"teardown",
"that",
"produced",
"output",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php#L192-L201 | train |
Behat/Behat | src/Behat/Behat/Context/Reader/AnnotatedContextReader.php | AnnotatedContextReader.readMethodCallees | private function readMethodCallees($class, ReflectionMethod $method)
{
$callees = array();
// read parent annotations
try {
$prototype = $method->getPrototype();
// error occurs on every second PHP stable release - getPrototype() returns itself
if ($prototype->getDeclaringClass()->getName() !== $method->getDeclaringClass()->getName()) {
$callees = array_merge($callees, $this->readMethodCallees($class, $prototype));
}
} catch (ReflectionException $e) {
}
if ($docBlock = $method->getDocComment()) {
$callees = array_merge($callees, $this->readDocBlockCallees($class, $method, $docBlock));
}
return $callees;
} | php | private function readMethodCallees($class, ReflectionMethod $method)
{
$callees = array();
// read parent annotations
try {
$prototype = $method->getPrototype();
// error occurs on every second PHP stable release - getPrototype() returns itself
if ($prototype->getDeclaringClass()->getName() !== $method->getDeclaringClass()->getName()) {
$callees = array_merge($callees, $this->readMethodCallees($class, $prototype));
}
} catch (ReflectionException $e) {
}
if ($docBlock = $method->getDocComment()) {
$callees = array_merge($callees, $this->readDocBlockCallees($class, $method, $docBlock));
}
return $callees;
} | [
"private",
"function",
"readMethodCallees",
"(",
"$",
"class",
",",
"ReflectionMethod",
"$",
"method",
")",
"{",
"$",
"callees",
"=",
"array",
"(",
")",
";",
"// read parent annotations",
"try",
"{",
"$",
"prototype",
"=",
"$",
"method",
"->",
"getPrototype",
"(",
")",
";",
"// error occurs on every second PHP stable release - getPrototype() returns itself",
"if",
"(",
"$",
"prototype",
"->",
"getDeclaringClass",
"(",
")",
"->",
"getName",
"(",
")",
"!==",
"$",
"method",
"->",
"getDeclaringClass",
"(",
")",
"->",
"getName",
"(",
")",
")",
"{",
"$",
"callees",
"=",
"array_merge",
"(",
"$",
"callees",
",",
"$",
"this",
"->",
"readMethodCallees",
"(",
"$",
"class",
",",
"$",
"prototype",
")",
")",
";",
"}",
"}",
"catch",
"(",
"ReflectionException",
"$",
"e",
")",
"{",
"}",
"if",
"(",
"$",
"docBlock",
"=",
"$",
"method",
"->",
"getDocComment",
"(",
")",
")",
"{",
"$",
"callees",
"=",
"array_merge",
"(",
"$",
"callees",
",",
"$",
"this",
"->",
"readDocBlockCallees",
"(",
"$",
"class",
",",
"$",
"method",
",",
"$",
"docBlock",
")",
")",
";",
"}",
"return",
"$",
"callees",
";",
"}"
] | Loads callees associated with specific method.
@param string $class
@param ReflectionMethod $method
@return Callee[] | [
"Loads",
"callees",
"associated",
"with",
"specific",
"method",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php#L80-L99 | train |
Behat/Behat | src/Behat/Behat/Context/Reader/AnnotatedContextReader.php | AnnotatedContextReader.readDocBlockCallees | private function readDocBlockCallees($class, ReflectionMethod $method, $docBlock)
{
$callees = array();
$description = $this->readDescription($docBlock);
$docBlock = $this->mergeMultilines($docBlock);
foreach (explode("\n", $docBlock) as $docLine) {
$docLine = preg_replace(self::DOCLINE_TRIMMER_REGEX, '', $docLine);
if ($this->isEmpty($docLine)) {
continue;
}
if ($this->isNotAnnotation($docLine)) {
continue;
}
if ($callee = $this->readDocLineCallee($class, $method, $docLine, $description)) {
$callees[] = $callee;
}
}
return $callees;
} | php | private function readDocBlockCallees($class, ReflectionMethod $method, $docBlock)
{
$callees = array();
$description = $this->readDescription($docBlock);
$docBlock = $this->mergeMultilines($docBlock);
foreach (explode("\n", $docBlock) as $docLine) {
$docLine = preg_replace(self::DOCLINE_TRIMMER_REGEX, '', $docLine);
if ($this->isEmpty($docLine)) {
continue;
}
if ($this->isNotAnnotation($docLine)) {
continue;
}
if ($callee = $this->readDocLineCallee($class, $method, $docLine, $description)) {
$callees[] = $callee;
}
}
return $callees;
} | [
"private",
"function",
"readDocBlockCallees",
"(",
"$",
"class",
",",
"ReflectionMethod",
"$",
"method",
",",
"$",
"docBlock",
")",
"{",
"$",
"callees",
"=",
"array",
"(",
")",
";",
"$",
"description",
"=",
"$",
"this",
"->",
"readDescription",
"(",
"$",
"docBlock",
")",
";",
"$",
"docBlock",
"=",
"$",
"this",
"->",
"mergeMultilines",
"(",
"$",
"docBlock",
")",
";",
"foreach",
"(",
"explode",
"(",
"\"\\n\"",
",",
"$",
"docBlock",
")",
"as",
"$",
"docLine",
")",
"{",
"$",
"docLine",
"=",
"preg_replace",
"(",
"self",
"::",
"DOCLINE_TRIMMER_REGEX",
",",
"''",
",",
"$",
"docLine",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isEmpty",
"(",
"$",
"docLine",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isNotAnnotation",
"(",
"$",
"docLine",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"$",
"callee",
"=",
"$",
"this",
"->",
"readDocLineCallee",
"(",
"$",
"class",
",",
"$",
"method",
",",
"$",
"docLine",
",",
"$",
"description",
")",
")",
"{",
"$",
"callees",
"[",
"]",
"=",
"$",
"callee",
";",
"}",
"}",
"return",
"$",
"callees",
";",
"}"
] | Reads callees from the method doc block.
@param string $class
@param ReflectionMethod $method
@param string $docBlock
@return Callee[] | [
"Reads",
"callees",
"from",
"the",
"method",
"doc",
"block",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php#L110-L133 | train |
Behat/Behat | src/Behat/Behat/Context/Reader/AnnotatedContextReader.php | AnnotatedContextReader.readDescription | private function readDescription($docBlock)
{
// Remove indentation
$description = preg_replace('/^[\s\t]*/m', '', $docBlock);
// Remove block comment syntax
$description = preg_replace('/^\/\*\*\s*|^\s*\*\s|^\s*\*\/$/m', '', $description);
// Remove annotations
$description = preg_replace('/^@.*$/m', '', $description);
// Ignore docs after a "--" separator
if (preg_match('/^--.*$/m', $description)) {
$descriptionParts = preg_split('/^--.*$/m', $description);
$description = array_shift($descriptionParts);
}
// Trim leading and trailing newlines
$description = trim($description, "\r\n");
return $description;
} | php | private function readDescription($docBlock)
{
// Remove indentation
$description = preg_replace('/^[\s\t]*/m', '', $docBlock);
// Remove block comment syntax
$description = preg_replace('/^\/\*\*\s*|^\s*\*\s|^\s*\*\/$/m', '', $description);
// Remove annotations
$description = preg_replace('/^@.*$/m', '', $description);
// Ignore docs after a "--" separator
if (preg_match('/^--.*$/m', $description)) {
$descriptionParts = preg_split('/^--.*$/m', $description);
$description = array_shift($descriptionParts);
}
// Trim leading and trailing newlines
$description = trim($description, "\r\n");
return $description;
} | [
"private",
"function",
"readDescription",
"(",
"$",
"docBlock",
")",
"{",
"// Remove indentation",
"$",
"description",
"=",
"preg_replace",
"(",
"'/^[\\s\\t]*/m'",
",",
"''",
",",
"$",
"docBlock",
")",
";",
"// Remove block comment syntax",
"$",
"description",
"=",
"preg_replace",
"(",
"'/^\\/\\*\\*\\s*|^\\s*\\*\\s|^\\s*\\*\\/$/m'",
",",
"''",
",",
"$",
"description",
")",
";",
"// Remove annotations",
"$",
"description",
"=",
"preg_replace",
"(",
"'/^@.*$/m'",
",",
"''",
",",
"$",
"description",
")",
";",
"// Ignore docs after a \"--\" separator",
"if",
"(",
"preg_match",
"(",
"'/^--.*$/m'",
",",
"$",
"description",
")",
")",
"{",
"$",
"descriptionParts",
"=",
"preg_split",
"(",
"'/^--.*$/m'",
",",
"$",
"description",
")",
";",
"$",
"description",
"=",
"array_shift",
"(",
"$",
"descriptionParts",
")",
";",
"}",
"// Trim leading and trailing newlines",
"$",
"description",
"=",
"trim",
"(",
"$",
"description",
",",
"\"\\r\\n\"",
")",
";",
"return",
"$",
"description",
";",
"}"
] | Extracts a description from the provided docblock,
with support for multiline descriptions.
@param string $docBlock
@return string | [
"Extracts",
"a",
"description",
"from",
"the",
"provided",
"docblock",
"with",
"support",
"for",
"multiline",
"descriptions",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php#L155-L176 | train |
Behat/Behat | src/Behat/Behat/Context/Reader/AnnotatedContextReader.php | AnnotatedContextReader.readDocLineCallee | private function readDocLineCallee($class, ReflectionMethod $method, $docLine, $description = null)
{
if ($this->isIgnoredAnnotation($docLine)) {
return null;
}
foreach ($this->readers as $reader) {
if ($callee = $reader->readCallee($class, $method, $docLine, $description)) {
return $callee;
}
}
return null;
} | php | private function readDocLineCallee($class, ReflectionMethod $method, $docLine, $description = null)
{
if ($this->isIgnoredAnnotation($docLine)) {
return null;
}
foreach ($this->readers as $reader) {
if ($callee = $reader->readCallee($class, $method, $docLine, $description)) {
return $callee;
}
}
return null;
} | [
"private",
"function",
"readDocLineCallee",
"(",
"$",
"class",
",",
"ReflectionMethod",
"$",
"method",
",",
"$",
"docLine",
",",
"$",
"description",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isIgnoredAnnotation",
"(",
"$",
"docLine",
")",
")",
"{",
"return",
"null",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"readers",
"as",
"$",
"reader",
")",
"{",
"if",
"(",
"$",
"callee",
"=",
"$",
"reader",
"->",
"readCallee",
"(",
"$",
"class",
",",
"$",
"method",
",",
"$",
"docLine",
",",
"$",
"description",
")",
")",
"{",
"return",
"$",
"callee",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Reads callee from provided doc line using registered annotation readers.
@param string $class
@param ReflectionMethod $method
@param string $docLine
@param null|string $description
@return null|Callee | [
"Reads",
"callee",
"from",
"provided",
"doc",
"line",
"using",
"registered",
"annotation",
"readers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php#L212-L225 | train |
Behat/Behat | src/Behat/Behat/Context/Reader/AnnotatedContextReader.php | AnnotatedContextReader.isIgnoredAnnotation | private function isIgnoredAnnotation($docLine)
{
$lowDocLine = strtolower($docLine);
foreach (self::$ignoreAnnotations as $ignoredAnnotation) {
if ($ignoredAnnotation == substr($lowDocLine, 0, strlen($ignoredAnnotation))) {
return true;
}
}
return false;
} | php | private function isIgnoredAnnotation($docLine)
{
$lowDocLine = strtolower($docLine);
foreach (self::$ignoreAnnotations as $ignoredAnnotation) {
if ($ignoredAnnotation == substr($lowDocLine, 0, strlen($ignoredAnnotation))) {
return true;
}
}
return false;
} | [
"private",
"function",
"isIgnoredAnnotation",
"(",
"$",
"docLine",
")",
"{",
"$",
"lowDocLine",
"=",
"strtolower",
"(",
"$",
"docLine",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"ignoreAnnotations",
"as",
"$",
"ignoredAnnotation",
")",
"{",
"if",
"(",
"$",
"ignoredAnnotation",
"==",
"substr",
"(",
"$",
"lowDocLine",
",",
"0",
",",
"strlen",
"(",
"$",
"ignoredAnnotation",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Checks if provided doc line is one of the ignored annotations.
@param string $docLine
@return Boolean | [
"Checks",
"if",
"provided",
"doc",
"line",
"is",
"one",
"of",
"the",
"ignored",
"annotations",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php#L234-L244 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.loadFactory | private function loadFactory(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\ContextFactory', array(
new Reference(ArgumentExtension::CONSTRUCTOR_ARGUMENT_ORGANISER_ID)
));
$container->setDefinition(self::FACTORY_ID, $definition);
} | php | private function loadFactory(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\ContextFactory', array(
new Reference(ArgumentExtension::CONSTRUCTOR_ARGUMENT_ORGANISER_ID)
));
$container->setDefinition(self::FACTORY_ID, $definition);
} | [
"private",
"function",
"loadFactory",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\ContextFactory'",
",",
"array",
"(",
"new",
"Reference",
"(",
"ArgumentExtension",
"::",
"CONSTRUCTOR_ARGUMENT_ORGANISER_ID",
")",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"FACTORY_ID",
",",
"$",
"definition",
")",
";",
"}"
] | Loads context factory.
@param ContainerBuilder $container | [
"Loads",
"context",
"factory",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L130-L136 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.loadArgumentResolverFactory | private function loadArgumentResolverFactory(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Argument\CompositeArgumentResolverFactory');
$container->setDefinition(self::AGGREGATE_RESOLVER_FACTORY_ID, $definition);
} | php | private function loadArgumentResolverFactory(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Argument\CompositeArgumentResolverFactory');
$container->setDefinition(self::AGGREGATE_RESOLVER_FACTORY_ID, $definition);
} | [
"private",
"function",
"loadArgumentResolverFactory",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Argument\\CompositeArgumentResolverFactory'",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"AGGREGATE_RESOLVER_FACTORY_ID",
",",
"$",
"definition",
")",
";",
"}"
] | Loads argument resolver factory used in the environment handler.
@param ContainerBuilder $container | [
"Loads",
"argument",
"resolver",
"factory",
"used",
"in",
"the",
"environment",
"handler",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L143-L147 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.loadEnvironmentHandler | private function loadEnvironmentHandler(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler', array(
new Reference(self::FACTORY_ID),
new Reference(self::AGGREGATE_RESOLVER_FACTORY_ID)
));
$definition->addTag(EnvironmentExtension::HANDLER_TAG, array('priority' => 50));
$container->setDefinition(self::getEnvironmentHandlerId(), $definition);
} | php | private function loadEnvironmentHandler(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler', array(
new Reference(self::FACTORY_ID),
new Reference(self::AGGREGATE_RESOLVER_FACTORY_ID)
));
$definition->addTag(EnvironmentExtension::HANDLER_TAG, array('priority' => 50));
$container->setDefinition(self::getEnvironmentHandlerId(), $definition);
} | [
"private",
"function",
"loadEnvironmentHandler",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Environment\\Handler\\ContextEnvironmentHandler'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"FACTORY_ID",
")",
",",
"new",
"Reference",
"(",
"self",
"::",
"AGGREGATE_RESOLVER_FACTORY_ID",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"EnvironmentExtension",
"::",
"HANDLER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"getEnvironmentHandlerId",
"(",
")",
",",
"$",
"definition",
")",
";",
"}"
] | Loads context environment handlers.
@param ContainerBuilder $container | [
"Loads",
"context",
"environment",
"handlers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L154-L162 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.loadEnvironmentReader | private function loadEnvironmentReader(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Environment\Reader\ContextEnvironmentReader');
$definition->addTag(EnvironmentExtension::READER_TAG, array('priority' => 50));
$container->setDefinition(self::getEnvironmentReaderId(), $definition);
} | php | private function loadEnvironmentReader(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Environment\Reader\ContextEnvironmentReader');
$definition->addTag(EnvironmentExtension::READER_TAG, array('priority' => 50));
$container->setDefinition(self::getEnvironmentReaderId(), $definition);
} | [
"private",
"function",
"loadEnvironmentReader",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Environment\\Reader\\ContextEnvironmentReader'",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"EnvironmentExtension",
"::",
"READER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"getEnvironmentReaderId",
"(",
")",
",",
"$",
"definition",
")",
";",
"}"
] | Loads context environment readers.
@param ContainerBuilder $container | [
"Loads",
"context",
"environment",
"readers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L169-L174 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.loadSuiteSetup | private function loadSuiteSetup(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Suite\Setup\SuiteWithContextsSetup', array(
new Reference(AutoloaderExtension::CLASS_LOADER_ID),
new Reference(FilesystemExtension::LOGGER_ID)
));
$definition->addTag(SuiteExtension::SETUP_TAG, array('priority' => 20));
$container->setDefinition(self::getSuiteSetupId(), $definition);
} | php | private function loadSuiteSetup(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Suite\Setup\SuiteWithContextsSetup', array(
new Reference(AutoloaderExtension::CLASS_LOADER_ID),
new Reference(FilesystemExtension::LOGGER_ID)
));
$definition->addTag(SuiteExtension::SETUP_TAG, array('priority' => 20));
$container->setDefinition(self::getSuiteSetupId(), $definition);
} | [
"private",
"function",
"loadSuiteSetup",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Suite\\Setup\\SuiteWithContextsSetup'",
",",
"array",
"(",
"new",
"Reference",
"(",
"AutoloaderExtension",
"::",
"CLASS_LOADER_ID",
")",
",",
"new",
"Reference",
"(",
"FilesystemExtension",
"::",
"LOGGER_ID",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"SuiteExtension",
"::",
"SETUP_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"20",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"getSuiteSetupId",
"(",
")",
",",
"$",
"definition",
")",
";",
"}"
] | Loads context environment setup.
@param ContainerBuilder $container | [
"Loads",
"context",
"environment",
"setup",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L181-L189 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.loadSnippetAppender | private function loadSnippetAppender(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Snippet\Appender\ContextSnippetAppender', array(
new Reference(FilesystemExtension::LOGGER_ID)
));
$definition->addTag(SnippetExtension::APPENDER_TAG, array('priority' => 50));
$container->setDefinition(SnippetExtension::APPENDER_TAG . '.context', $definition);
} | php | private function loadSnippetAppender(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Snippet\Appender\ContextSnippetAppender', array(
new Reference(FilesystemExtension::LOGGER_ID)
));
$definition->addTag(SnippetExtension::APPENDER_TAG, array('priority' => 50));
$container->setDefinition(SnippetExtension::APPENDER_TAG . '.context', $definition);
} | [
"private",
"function",
"loadSnippetAppender",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Snippet\\Appender\\ContextSnippetAppender'",
",",
"array",
"(",
"new",
"Reference",
"(",
"FilesystemExtension",
"::",
"LOGGER_ID",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"SnippetExtension",
"::",
"APPENDER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"SnippetExtension",
"::",
"APPENDER_TAG",
".",
"'.context'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads context snippet appender.
@param ContainerBuilder $container | [
"Loads",
"context",
"snippet",
"appender",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L196-L203 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.loadSnippetGenerators | private function loadSnippetGenerators(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Snippet\Generator\ContextSnippetGenerator', array(
new Reference(DefinitionExtension::PATTERN_TRANSFORMER_ID)
));
$definition->addTag(SnippetExtension::GENERATOR_TAG, array('priority' => 50));
$container->setDefinition(self::CONTEXT_SNIPPET_GENERATOR_ID, $definition);
} | php | private function loadSnippetGenerators(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Snippet\Generator\ContextSnippetGenerator', array(
new Reference(DefinitionExtension::PATTERN_TRANSFORMER_ID)
));
$definition->addTag(SnippetExtension::GENERATOR_TAG, array('priority' => 50));
$container->setDefinition(self::CONTEXT_SNIPPET_GENERATOR_ID, $definition);
} | [
"private",
"function",
"loadSnippetGenerators",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Snippet\\Generator\\ContextSnippetGenerator'",
",",
"array",
"(",
"new",
"Reference",
"(",
"DefinitionExtension",
"::",
"PATTERN_TRANSFORMER_ID",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"SnippetExtension",
"::",
"GENERATOR_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"CONTEXT_SNIPPET_GENERATOR_ID",
",",
"$",
"definition",
")",
";",
"}"
] | Loads context snippet generators.
@param ContainerBuilder $container | [
"Loads",
"context",
"snippet",
"generators",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L210-L217 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.loadDefaultClassGenerators | private function loadDefaultClassGenerators(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\ContextClass\SimpleClassGenerator');
$definition->addTag(self::CLASS_GENERATOR_TAG, array('priority' => 50));
$container->setDefinition(self::CLASS_GENERATOR_TAG . '.simple', $definition);
} | php | private function loadDefaultClassGenerators(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\ContextClass\SimpleClassGenerator');
$definition->addTag(self::CLASS_GENERATOR_TAG, array('priority' => 50));
$container->setDefinition(self::CLASS_GENERATOR_TAG . '.simple', $definition);
} | [
"private",
"function",
"loadDefaultClassGenerators",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\ContextClass\\SimpleClassGenerator'",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"self",
"::",
"CLASS_GENERATOR_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"CLASS_GENERATOR_TAG",
".",
"'.simple'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads default context class generators.
@param ContainerBuilder $container | [
"Loads",
"default",
"context",
"class",
"generators",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L237-L242 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.loadDefaultContextReaders | private function loadDefaultContextReaders(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Reader\AnnotatedContextReader');
$container->setDefinition(self::getAnnotatedContextReaderId(), $definition);
$definition = new Definition('Behat\Behat\Context\Reader\ContextReaderCachedPerContext', array(
new Reference(self::getAnnotatedContextReaderId())
));
$definition->addTag(self::READER_TAG, array('priority' => 50));
$container->setDefinition(self::getAnnotatedContextReaderId() . '.cached', $definition);
$definition = new Definition('Behat\Behat\Context\Reader\TranslatableContextReader', array(
new Reference(TranslatorExtension::TRANSLATOR_ID)
));
$container->setDefinition(self::READER_TAG . '.translatable', $definition);
$definition = new Definition('Behat\Behat\Context\Reader\ContextReaderCachedPerSuite', array(
new Reference(self::READER_TAG . '.translatable')
));
$definition->addTag(self::READER_TAG, array('priority' => 50));
$container->setDefinition(self::READER_TAG . '.translatable.cached', $definition);
} | php | private function loadDefaultContextReaders(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Context\Reader\AnnotatedContextReader');
$container->setDefinition(self::getAnnotatedContextReaderId(), $definition);
$definition = new Definition('Behat\Behat\Context\Reader\ContextReaderCachedPerContext', array(
new Reference(self::getAnnotatedContextReaderId())
));
$definition->addTag(self::READER_TAG, array('priority' => 50));
$container->setDefinition(self::getAnnotatedContextReaderId() . '.cached', $definition);
$definition = new Definition('Behat\Behat\Context\Reader\TranslatableContextReader', array(
new Reference(TranslatorExtension::TRANSLATOR_ID)
));
$container->setDefinition(self::READER_TAG . '.translatable', $definition);
$definition = new Definition('Behat\Behat\Context\Reader\ContextReaderCachedPerSuite', array(
new Reference(self::READER_TAG . '.translatable')
));
$definition->addTag(self::READER_TAG, array('priority' => 50));
$container->setDefinition(self::READER_TAG . '.translatable.cached', $definition);
} | [
"private",
"function",
"loadDefaultContextReaders",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Reader\\AnnotatedContextReader'",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"getAnnotatedContextReaderId",
"(",
")",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Reader\\ContextReaderCachedPerContext'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"getAnnotatedContextReaderId",
"(",
")",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"self",
"::",
"READER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"getAnnotatedContextReaderId",
"(",
")",
".",
"'.cached'",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Reader\\TranslatableContextReader'",
",",
"array",
"(",
"new",
"Reference",
"(",
"TranslatorExtension",
"::",
"TRANSLATOR_ID",
")",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"READER_TAG",
".",
"'.translatable'",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Context\\Reader\\ContextReaderCachedPerSuite'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"READER_TAG",
".",
"'.translatable'",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"self",
"::",
"READER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"READER_TAG",
".",
"'.translatable.cached'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads default context readers.
@param ContainerBuilder $container | [
"Loads",
"default",
"context",
"readers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L249-L270 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.processClassResolvers | private function processClassResolvers(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::CLASS_RESOLVER_TAG);
$definition = $container->getDefinition(self::getEnvironmentHandlerId());
foreach ($references as $reference) {
$definition->addMethodCall('registerClassResolver', array($reference));
}
} | php | private function processClassResolvers(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::CLASS_RESOLVER_TAG);
$definition = $container->getDefinition(self::getEnvironmentHandlerId());
foreach ($references as $reference) {
$definition->addMethodCall('registerClassResolver', array($reference));
}
} | [
"private",
"function",
"processClassResolvers",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"references",
"=",
"$",
"this",
"->",
"processor",
"->",
"findAndSortTaggedServices",
"(",
"$",
"container",
",",
"self",
"::",
"CLASS_RESOLVER_TAG",
")",
";",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"self",
"::",
"getEnvironmentHandlerId",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"references",
"as",
"$",
"reference",
")",
"{",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'registerClassResolver'",
",",
"array",
"(",
"$",
"reference",
")",
")",
";",
"}",
"}"
] | Processes all class resolvers.
@param ContainerBuilder $container | [
"Processes",
"all",
"class",
"resolvers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L277-L285 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.processArgumentResolverFactories | private function processArgumentResolverFactories($container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::SUITE_SCOPED_RESOLVER_FACTORY_TAG);
$definition = $container->getDefinition(self::AGGREGATE_RESOLVER_FACTORY_ID);
foreach ($references as $reference) {
$definition->addMethodCall('registerFactory', array($reference));
}
} | php | private function processArgumentResolverFactories($container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::SUITE_SCOPED_RESOLVER_FACTORY_TAG);
$definition = $container->getDefinition(self::AGGREGATE_RESOLVER_FACTORY_ID);
foreach ($references as $reference) {
$definition->addMethodCall('registerFactory', array($reference));
}
} | [
"private",
"function",
"processArgumentResolverFactories",
"(",
"$",
"container",
")",
"{",
"$",
"references",
"=",
"$",
"this",
"->",
"processor",
"->",
"findAndSortTaggedServices",
"(",
"$",
"container",
",",
"self",
"::",
"SUITE_SCOPED_RESOLVER_FACTORY_TAG",
")",
";",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"self",
"::",
"AGGREGATE_RESOLVER_FACTORY_ID",
")",
";",
"foreach",
"(",
"$",
"references",
"as",
"$",
"reference",
")",
"{",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'registerFactory'",
",",
"array",
"(",
"$",
"reference",
")",
")",
";",
"}",
"}"
] | Processes all argument resolver factories.
@param ContainerBuilder $container | [
"Processes",
"all",
"argument",
"resolver",
"factories",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L292-L300 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.processArgumentResolvers | private function processArgumentResolvers(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::ARGUMENT_RESOLVER_TAG);
$definition = $container->getDefinition(self::FACTORY_ID);
foreach ($references as $reference) {
$definition->addMethodCall('registerArgumentResolver', array($reference));
}
} | php | private function processArgumentResolvers(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::ARGUMENT_RESOLVER_TAG);
$definition = $container->getDefinition(self::FACTORY_ID);
foreach ($references as $reference) {
$definition->addMethodCall('registerArgumentResolver', array($reference));
}
} | [
"private",
"function",
"processArgumentResolvers",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"references",
"=",
"$",
"this",
"->",
"processor",
"->",
"findAndSortTaggedServices",
"(",
"$",
"container",
",",
"self",
"::",
"ARGUMENT_RESOLVER_TAG",
")",
";",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"self",
"::",
"FACTORY_ID",
")",
";",
"foreach",
"(",
"$",
"references",
"as",
"$",
"reference",
")",
"{",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'registerArgumentResolver'",
",",
"array",
"(",
"$",
"reference",
")",
")",
";",
"}",
"}"
] | Processes all argument resolvers.
@param ContainerBuilder $container | [
"Processes",
"all",
"argument",
"resolvers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L307-L315 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.processContextInitializers | private function processContextInitializers(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::INITIALIZER_TAG);
$definition = $container->getDefinition(self::FACTORY_ID);
foreach ($references as $reference) {
$definition->addMethodCall('registerContextInitializer', array($reference));
}
} | php | private function processContextInitializers(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::INITIALIZER_TAG);
$definition = $container->getDefinition(self::FACTORY_ID);
foreach ($references as $reference) {
$definition->addMethodCall('registerContextInitializer', array($reference));
}
} | [
"private",
"function",
"processContextInitializers",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"references",
"=",
"$",
"this",
"->",
"processor",
"->",
"findAndSortTaggedServices",
"(",
"$",
"container",
",",
"self",
"::",
"INITIALIZER_TAG",
")",
";",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"self",
"::",
"FACTORY_ID",
")",
";",
"foreach",
"(",
"$",
"references",
"as",
"$",
"reference",
")",
"{",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'registerContextInitializer'",
",",
"array",
"(",
"$",
"reference",
")",
")",
";",
"}",
"}"
] | Processes all context initializers.
@param ContainerBuilder $container | [
"Processes",
"all",
"context",
"initializers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L322-L330 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.processContextReaders | private function processContextReaders(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::READER_TAG);
$definition = $container->getDefinition(self::getEnvironmentReaderId());
foreach ($references as $reference) {
$definition->addMethodCall('registerContextReader', array($reference));
}
} | php | private function processContextReaders(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::READER_TAG);
$definition = $container->getDefinition(self::getEnvironmentReaderId());
foreach ($references as $reference) {
$definition->addMethodCall('registerContextReader', array($reference));
}
} | [
"private",
"function",
"processContextReaders",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"references",
"=",
"$",
"this",
"->",
"processor",
"->",
"findAndSortTaggedServices",
"(",
"$",
"container",
",",
"self",
"::",
"READER_TAG",
")",
";",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"self",
"::",
"getEnvironmentReaderId",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"references",
"as",
"$",
"reference",
")",
"{",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'registerContextReader'",
",",
"array",
"(",
"$",
"reference",
")",
")",
";",
"}",
"}"
] | Processes all context readers.
@param ContainerBuilder $container | [
"Processes",
"all",
"context",
"readers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L337-L345 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.processClassGenerators | private function processClassGenerators(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::CLASS_GENERATOR_TAG);
$definition = $container->getDefinition(self::getSuiteSetupId());
foreach ($references as $reference) {
$definition->addMethodCall('registerClassGenerator', array($reference));
}
} | php | private function processClassGenerators(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::CLASS_GENERATOR_TAG);
$definition = $container->getDefinition(self::getSuiteSetupId());
foreach ($references as $reference) {
$definition->addMethodCall('registerClassGenerator', array($reference));
}
} | [
"private",
"function",
"processClassGenerators",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"references",
"=",
"$",
"this",
"->",
"processor",
"->",
"findAndSortTaggedServices",
"(",
"$",
"container",
",",
"self",
"::",
"CLASS_GENERATOR_TAG",
")",
";",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"self",
"::",
"getSuiteSetupId",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"references",
"as",
"$",
"reference",
")",
"{",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'registerClassGenerator'",
",",
"array",
"(",
"$",
"reference",
")",
")",
";",
"}",
"}"
] | Processes all class generators.
@param ContainerBuilder $container | [
"Processes",
"all",
"class",
"generators",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L352-L360 | train |
Behat/Behat | src/Behat/Behat/Context/ServiceContainer/ContextExtension.php | ContextExtension.processAnnotationReaders | private function processAnnotationReaders(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::ANNOTATION_READER_TAG);
$definition = $container->getDefinition(self::getAnnotatedContextReaderId());
foreach ($references as $reference) {
$definition->addMethodCall('registerAnnotationReader', array($reference));
}
} | php | private function processAnnotationReaders(ContainerBuilder $container)
{
$references = $this->processor->findAndSortTaggedServices($container, self::ANNOTATION_READER_TAG);
$definition = $container->getDefinition(self::getAnnotatedContextReaderId());
foreach ($references as $reference) {
$definition->addMethodCall('registerAnnotationReader', array($reference));
}
} | [
"private",
"function",
"processAnnotationReaders",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"references",
"=",
"$",
"this",
"->",
"processor",
"->",
"findAndSortTaggedServices",
"(",
"$",
"container",
",",
"self",
"::",
"ANNOTATION_READER_TAG",
")",
";",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"self",
"::",
"getAnnotatedContextReaderId",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"references",
"as",
"$",
"reference",
")",
"{",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'registerAnnotationReader'",
",",
"array",
"(",
"$",
"reference",
")",
")",
";",
"}",
"}"
] | Processes all annotation readers.
@param ContainerBuilder $container | [
"Processes",
"all",
"annotation",
"readers",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L367-L375 | train |
Behat/Behat | src/Behat/Behat/Definition/Pattern/PatternTransformer.php | PatternTransformer.generatePattern | public function generatePattern($type, $stepText)
{
foreach ($this->policies as $policy) {
if ($policy->supportsPatternType($type)) {
return $policy->generatePattern($stepText);
}
}
throw new UnsupportedPatternTypeException(sprintf('Can not find policy for a pattern type `%s`.', $type), $type);
} | php | public function generatePattern($type, $stepText)
{
foreach ($this->policies as $policy) {
if ($policy->supportsPatternType($type)) {
return $policy->generatePattern($stepText);
}
}
throw new UnsupportedPatternTypeException(sprintf('Can not find policy for a pattern type `%s`.', $type), $type);
} | [
"public",
"function",
"generatePattern",
"(",
"$",
"type",
",",
"$",
"stepText",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"policies",
"as",
"$",
"policy",
")",
"{",
"if",
"(",
"$",
"policy",
"->",
"supportsPatternType",
"(",
"$",
"type",
")",
")",
"{",
"return",
"$",
"policy",
"->",
"generatePattern",
"(",
"$",
"stepText",
")",
";",
"}",
"}",
"throw",
"new",
"UnsupportedPatternTypeException",
"(",
"sprintf",
"(",
"'Can not find policy for a pattern type `%s`.'",
",",
"$",
"type",
")",
",",
"$",
"type",
")",
";",
"}"
] | Generates pattern.
@param string $type
@param string $stepText
@return Pattern
@throws UnsupportedPatternTypeException | [
"Generates",
"pattern",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php#L55-L64 | train |
Behat/Behat | src/Behat/Behat/Definition/Pattern/PatternTransformer.php | PatternTransformer.transformPatternToRegex | public function transformPatternToRegex($pattern)
{
if (!isset($this->patternToRegexpCache[$pattern])) {
$this->patternToRegexpCache[$pattern] = $this->transformPatternToRegexWithSupportedPolicy($pattern);
}
return $this->patternToRegexpCache[$pattern];
} | php | public function transformPatternToRegex($pattern)
{
if (!isset($this->patternToRegexpCache[$pattern])) {
$this->patternToRegexpCache[$pattern] = $this->transformPatternToRegexWithSupportedPolicy($pattern);
}
return $this->patternToRegexpCache[$pattern];
} | [
"public",
"function",
"transformPatternToRegex",
"(",
"$",
"pattern",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"patternToRegexpCache",
"[",
"$",
"pattern",
"]",
")",
")",
"{",
"$",
"this",
"->",
"patternToRegexpCache",
"[",
"$",
"pattern",
"]",
"=",
"$",
"this",
"->",
"transformPatternToRegexWithSupportedPolicy",
"(",
"$",
"pattern",
")",
";",
"}",
"return",
"$",
"this",
"->",
"patternToRegexpCache",
"[",
"$",
"pattern",
"]",
";",
"}"
] | Transforms pattern string to regex.
@param string $pattern
@return string
@throws UnknownPatternException | [
"Transforms",
"pattern",
"string",
"to",
"regex",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php#L75-L82 | train |
Behat/Behat | src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php | SuiteWithPathsSetup.createFeatureDirectory | private function createFeatureDirectory($path)
{
mkdir($path, 0777, true);
if ($this->logger) {
$this->logger->directoryCreated($path, 'place your *.feature files here');
}
} | php | private function createFeatureDirectory($path)
{
mkdir($path, 0777, true);
if ($this->logger) {
$this->logger->directoryCreated($path, 'place your *.feature files here');
}
} | [
"private",
"function",
"createFeatureDirectory",
"(",
"$",
"path",
")",
"{",
"mkdir",
"(",
"$",
"path",
",",
"0777",
",",
"true",
")",
";",
"if",
"(",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"directoryCreated",
"(",
"$",
"path",
",",
"'place your *.feature files here'",
")",
";",
"}",
"}"
] | Creates feature directory.
@param string $path | [
"Creates",
"feature",
"directory",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php#L70-L77 | train |
Behat/Behat | src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php | SuiteWithPathsSetup.locatePath | private function locatePath($path)
{
if ($this->isAbsolutePath($path)) {
return $path;
}
return $this->basePath . DIRECTORY_SEPARATOR . $path;
} | php | private function locatePath($path)
{
if ($this->isAbsolutePath($path)) {
return $path;
}
return $this->basePath . DIRECTORY_SEPARATOR . $path;
} | [
"private",
"function",
"locatePath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAbsolutePath",
"(",
"$",
"path",
")",
")",
"{",
"return",
"$",
"path",
";",
"}",
"return",
"$",
"this",
"->",
"basePath",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"path",
";",
"}"
] | Locates path from a relative one.
@param string $path
@return string | [
"Locates",
"path",
"from",
"a",
"relative",
"one",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php#L86-L93 | train |
Behat/Behat | src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php | ServicesResolver.filterCall | public function filterCall(Call $call)
{
if ($container = $this->getContainer($call)) {
$autowirer = new ArgumentAutowirer($container);
$newArguments = $autowirer->autowireArguments($call->getCallee()->getReflection(), $call->getArguments());
return $this->repackageCallIfNewArguments($call, $newArguments);
}
return $call;
} | php | public function filterCall(Call $call)
{
if ($container = $this->getContainer($call)) {
$autowirer = new ArgumentAutowirer($container);
$newArguments = $autowirer->autowireArguments($call->getCallee()->getReflection(), $call->getArguments());
return $this->repackageCallIfNewArguments($call, $newArguments);
}
return $call;
} | [
"public",
"function",
"filterCall",
"(",
"Call",
"$",
"call",
")",
"{",
"if",
"(",
"$",
"container",
"=",
"$",
"this",
"->",
"getContainer",
"(",
"$",
"call",
")",
")",
"{",
"$",
"autowirer",
"=",
"new",
"ArgumentAutowirer",
"(",
"$",
"container",
")",
";",
"$",
"newArguments",
"=",
"$",
"autowirer",
"->",
"autowireArguments",
"(",
"$",
"call",
"->",
"getCallee",
"(",
")",
"->",
"getReflection",
"(",
")",
",",
"$",
"call",
"->",
"getArguments",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"repackageCallIfNewArguments",
"(",
"$",
"call",
",",
"$",
"newArguments",
")",
";",
"}",
"return",
"$",
"call",
";",
"}"
] | Filters a call and returns a new one.
@param Call $call
@return Call
@throws UnsupportedCallException
@throws ContainerExceptionInterface | [
"Filters",
"a",
"call",
"and",
"returns",
"a",
"new",
"one",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php#L52-L62 | train |
Behat/Behat | src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php | ServicesResolver.getContainer | private function getContainer(Call $call)
{
if (!$call instanceof EnvironmentCall) {
throw new UnsupportedCallException(sprintf(
'ServicesResolver can not filter `%s` call.',
get_class($call)
), $call);
}
$environment = $call->getEnvironment();
if (!$environment instanceof ServiceContainerEnvironment) {
throw new UnsupportedCallException(sprintf(
'ServicesResolver can not filter `%s` call.',
get_class($call)
), $call);
}
return $environment->getServiceContainer();
} | php | private function getContainer(Call $call)
{
if (!$call instanceof EnvironmentCall) {
throw new UnsupportedCallException(sprintf(
'ServicesResolver can not filter `%s` call.',
get_class($call)
), $call);
}
$environment = $call->getEnvironment();
if (!$environment instanceof ServiceContainerEnvironment) {
throw new UnsupportedCallException(sprintf(
'ServicesResolver can not filter `%s` call.',
get_class($call)
), $call);
}
return $environment->getServiceContainer();
} | [
"private",
"function",
"getContainer",
"(",
"Call",
"$",
"call",
")",
"{",
"if",
"(",
"!",
"$",
"call",
"instanceof",
"EnvironmentCall",
")",
"{",
"throw",
"new",
"UnsupportedCallException",
"(",
"sprintf",
"(",
"'ServicesResolver can not filter `%s` call.'",
",",
"get_class",
"(",
"$",
"call",
")",
")",
",",
"$",
"call",
")",
";",
"}",
"$",
"environment",
"=",
"$",
"call",
"->",
"getEnvironment",
"(",
")",
";",
"if",
"(",
"!",
"$",
"environment",
"instanceof",
"ServiceContainerEnvironment",
")",
"{",
"throw",
"new",
"UnsupportedCallException",
"(",
"sprintf",
"(",
"'ServicesResolver can not filter `%s` call.'",
",",
"get_class",
"(",
"$",
"call",
")",
")",
",",
"$",
"call",
")",
";",
"}",
"return",
"$",
"environment",
"->",
"getServiceContainer",
"(",
")",
";",
"}"
] | Gets container from the call.
@param Call $call
@return null|ContainerInterface
@throws UnsupportedCallException if given call is not EnvironmentCall or environment is not ServiceContainerEnvironment | [
"Gets",
"container",
"from",
"the",
"call",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php#L73-L92 | train |
Behat/Behat | src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php | ServicesResolver.repackageCallIfNewArguments | private function repackageCallIfNewArguments(Call $call, array $arguments)
{
if ($arguments === $call->getArguments()) {
return $call;
}
return $this->repackageCallWithNewArguments($call, $arguments);
} | php | private function repackageCallIfNewArguments(Call $call, array $arguments)
{
if ($arguments === $call->getArguments()) {
return $call;
}
return $this->repackageCallWithNewArguments($call, $arguments);
} | [
"private",
"function",
"repackageCallIfNewArguments",
"(",
"Call",
"$",
"call",
",",
"array",
"$",
"arguments",
")",
"{",
"if",
"(",
"$",
"arguments",
"===",
"$",
"call",
"->",
"getArguments",
"(",
")",
")",
"{",
"return",
"$",
"call",
";",
"}",
"return",
"$",
"this",
"->",
"repackageCallWithNewArguments",
"(",
"$",
"call",
",",
"$",
"arguments",
")",
";",
"}"
] | Repackages old calls with new arguments, but only if two differ.
@param Call $call
@param array $arguments
@return Call
@throws UnsupportedCallException if given call is not DefinitionCall or TransformationCall | [
"Repackages",
"old",
"calls",
"with",
"new",
"arguments",
"but",
"only",
"if",
"two",
"differ",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php#L104-L111 | train |
Behat/Behat | src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php | ServicesResolver.repackageCallWithNewArguments | private function repackageCallWithNewArguments(Call $call, array $newArguments)
{
if ($call instanceof DefinitionCall) {
return $this->repackageDefinitionCall($call, $newArguments);
}
if ($call instanceof TransformationCall) {
return $this->repackageTransformationCall($call, $newArguments);
}
throw new UnsupportedCallException(
sprintf(
'ServicesResolver can not filter `%s` call.',
get_class($call)
), $call
);
} | php | private function repackageCallWithNewArguments(Call $call, array $newArguments)
{
if ($call instanceof DefinitionCall) {
return $this->repackageDefinitionCall($call, $newArguments);
}
if ($call instanceof TransformationCall) {
return $this->repackageTransformationCall($call, $newArguments);
}
throw new UnsupportedCallException(
sprintf(
'ServicesResolver can not filter `%s` call.',
get_class($call)
), $call
);
} | [
"private",
"function",
"repackageCallWithNewArguments",
"(",
"Call",
"$",
"call",
",",
"array",
"$",
"newArguments",
")",
"{",
"if",
"(",
"$",
"call",
"instanceof",
"DefinitionCall",
")",
"{",
"return",
"$",
"this",
"->",
"repackageDefinitionCall",
"(",
"$",
"call",
",",
"$",
"newArguments",
")",
";",
"}",
"if",
"(",
"$",
"call",
"instanceof",
"TransformationCall",
")",
"{",
"return",
"$",
"this",
"->",
"repackageTransformationCall",
"(",
"$",
"call",
",",
"$",
"newArguments",
")",
";",
"}",
"throw",
"new",
"UnsupportedCallException",
"(",
"sprintf",
"(",
"'ServicesResolver can not filter `%s` call.'",
",",
"get_class",
"(",
"$",
"call",
")",
")",
",",
"$",
"call",
")",
";",
"}"
] | Repackages old calls with new arguments.
@param Call $call
@param array $newArguments
@return DefinitionCall|TransformationCall
@throws UnsupportedCallException | [
"Repackages",
"old",
"calls",
"with",
"new",
"arguments",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php#L123-L139 | train |
Behat/Behat | src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php | ServicesResolver.repackageDefinitionCall | private function repackageDefinitionCall(DefinitionCall $call, array $newArguments)
{
$definition = $call->getCallee();
if (!$definition instanceof Definition) {
throw new UnsupportedCallException(
sprintf(
'Something is wrong in callee associated with `%s` call.',
get_class($call)
), $call
);
}
return new DefinitionCall(
$call->getEnvironment(),
$call->getFeature(),
$call->getStep(),
$definition,
$newArguments,
$call->getErrorReportingLevel()
);
} | php | private function repackageDefinitionCall(DefinitionCall $call, array $newArguments)
{
$definition = $call->getCallee();
if (!$definition instanceof Definition) {
throw new UnsupportedCallException(
sprintf(
'Something is wrong in callee associated with `%s` call.',
get_class($call)
), $call
);
}
return new DefinitionCall(
$call->getEnvironment(),
$call->getFeature(),
$call->getStep(),
$definition,
$newArguments,
$call->getErrorReportingLevel()
);
} | [
"private",
"function",
"repackageDefinitionCall",
"(",
"DefinitionCall",
"$",
"call",
",",
"array",
"$",
"newArguments",
")",
"{",
"$",
"definition",
"=",
"$",
"call",
"->",
"getCallee",
"(",
")",
";",
"if",
"(",
"!",
"$",
"definition",
"instanceof",
"Definition",
")",
"{",
"throw",
"new",
"UnsupportedCallException",
"(",
"sprintf",
"(",
"'Something is wrong in callee associated with `%s` call.'",
",",
"get_class",
"(",
"$",
"call",
")",
")",
",",
"$",
"call",
")",
";",
"}",
"return",
"new",
"DefinitionCall",
"(",
"$",
"call",
"->",
"getEnvironment",
"(",
")",
",",
"$",
"call",
"->",
"getFeature",
"(",
")",
",",
"$",
"call",
"->",
"getStep",
"(",
")",
",",
"$",
"definition",
",",
"$",
"newArguments",
",",
"$",
"call",
"->",
"getErrorReportingLevel",
"(",
")",
")",
";",
"}"
] | Repackages definition call with new arguments.
@param DefinitionCall $call
@param array $newArguments
@return DefinitionCall
@throws UnsupportedCallException | [
"Repackages",
"definition",
"call",
"with",
"new",
"arguments",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php#L151-L172 | train |
Behat/Behat | src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php | ServicesResolver.repackageTransformationCall | private function repackageTransformationCall(TransformationCall $call, array $newArguments)
{
$transformation = $call->getCallee();
if (!$transformation instanceof Transformation) {
throw new UnsupportedCallException(
sprintf(
'Something is wrong in callee associated with `%s` call.',
get_class($call)
), $call
);
}
return new TransformationCall(
$call->getEnvironment(),
$call->getDefinition(),
$transformation,
$newArguments
);
} | php | private function repackageTransformationCall(TransformationCall $call, array $newArguments)
{
$transformation = $call->getCallee();
if (!$transformation instanceof Transformation) {
throw new UnsupportedCallException(
sprintf(
'Something is wrong in callee associated with `%s` call.',
get_class($call)
), $call
);
}
return new TransformationCall(
$call->getEnvironment(),
$call->getDefinition(),
$transformation,
$newArguments
);
} | [
"private",
"function",
"repackageTransformationCall",
"(",
"TransformationCall",
"$",
"call",
",",
"array",
"$",
"newArguments",
")",
"{",
"$",
"transformation",
"=",
"$",
"call",
"->",
"getCallee",
"(",
")",
";",
"if",
"(",
"!",
"$",
"transformation",
"instanceof",
"Transformation",
")",
"{",
"throw",
"new",
"UnsupportedCallException",
"(",
"sprintf",
"(",
"'Something is wrong in callee associated with `%s` call.'",
",",
"get_class",
"(",
"$",
"call",
")",
")",
",",
"$",
"call",
")",
";",
"}",
"return",
"new",
"TransformationCall",
"(",
"$",
"call",
"->",
"getEnvironment",
"(",
")",
",",
"$",
"call",
"->",
"getDefinition",
"(",
")",
",",
"$",
"transformation",
",",
"$",
"newArguments",
")",
";",
"}"
] | Repackages transformation call with new arguments.
@param TransformationCall $call
@param array $newArguments
@return TransformationCall
@throws UnsupportedCallException | [
"Repackages",
"transformation",
"call",
"with",
"new",
"arguments",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php#L184-L203 | train |
Behat/Behat | src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php | LazyFeatureIterator.getSuiteFilters | private function getSuiteFilters(Suite $suite)
{
if (!$suite->hasSetting('filters') || !is_array($suite->getSetting('filters'))) {
return array();
}
$filters = array();
foreach ($suite->getSetting('filters') as $type => $filterString) {
$filters[] = $this->createFilter($type, $filterString, $suite);
}
return $filters;
} | php | private function getSuiteFilters(Suite $suite)
{
if (!$suite->hasSetting('filters') || !is_array($suite->getSetting('filters'))) {
return array();
}
$filters = array();
foreach ($suite->getSetting('filters') as $type => $filterString) {
$filters[] = $this->createFilter($type, $filterString, $suite);
}
return $filters;
} | [
"private",
"function",
"getSuiteFilters",
"(",
"Suite",
"$",
"suite",
")",
"{",
"if",
"(",
"!",
"$",
"suite",
"->",
"hasSetting",
"(",
"'filters'",
")",
"||",
"!",
"is_array",
"(",
"$",
"suite",
"->",
"getSetting",
"(",
"'filters'",
")",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"filters",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"suite",
"->",
"getSetting",
"(",
"'filters'",
")",
"as",
"$",
"type",
"=>",
"$",
"filterString",
")",
"{",
"$",
"filters",
"[",
"]",
"=",
"$",
"this",
"->",
"createFilter",
"(",
"$",
"type",
",",
"$",
"filterString",
",",
"$",
"suite",
")",
";",
"}",
"return",
"$",
"filters",
";",
"}"
] | Returns list of filters from suite settings.
@param Suite $suite
@return FilterInterface[] | [
"Returns",
"list",
"of",
"filters",
"from",
"suite",
"settings",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php#L132-L144 | train |
Behat/Behat | src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php | LazyFeatureIterator.createFilter | private function createFilter($type, $filterString, Suite $suite)
{
if ('role' === $type) {
return new RoleFilter($filterString);
}
if ('name' === $type) {
return new NameFilter($filterString);
}
if ('tags' === $type) {
return new TagFilter($filterString);
}
if ('narrative' === $type) {
return new NarrativeFilter($filterString);
}
throw new SuiteConfigurationException(sprintf(
'`%s` filter is not supported by the `%s` suite. Supported types are `%s`.',
$type,
$suite->getName(),
implode('`, `', array('role', 'name', 'tags'))
), $suite->getName());
} | php | private function createFilter($type, $filterString, Suite $suite)
{
if ('role' === $type) {
return new RoleFilter($filterString);
}
if ('name' === $type) {
return new NameFilter($filterString);
}
if ('tags' === $type) {
return new TagFilter($filterString);
}
if ('narrative' === $type) {
return new NarrativeFilter($filterString);
}
throw new SuiteConfigurationException(sprintf(
'`%s` filter is not supported by the `%s` suite. Supported types are `%s`.',
$type,
$suite->getName(),
implode('`, `', array('role', 'name', 'tags'))
), $suite->getName());
} | [
"private",
"function",
"createFilter",
"(",
"$",
"type",
",",
"$",
"filterString",
",",
"Suite",
"$",
"suite",
")",
"{",
"if",
"(",
"'role'",
"===",
"$",
"type",
")",
"{",
"return",
"new",
"RoleFilter",
"(",
"$",
"filterString",
")",
";",
"}",
"if",
"(",
"'name'",
"===",
"$",
"type",
")",
"{",
"return",
"new",
"NameFilter",
"(",
"$",
"filterString",
")",
";",
"}",
"if",
"(",
"'tags'",
"===",
"$",
"type",
")",
"{",
"return",
"new",
"TagFilter",
"(",
"$",
"filterString",
")",
";",
"}",
"if",
"(",
"'narrative'",
"===",
"$",
"type",
")",
"{",
"return",
"new",
"NarrativeFilter",
"(",
"$",
"filterString",
")",
";",
"}",
"throw",
"new",
"SuiteConfigurationException",
"(",
"sprintf",
"(",
"'`%s` filter is not supported by the `%s` suite. Supported types are `%s`.'",
",",
"$",
"type",
",",
"$",
"suite",
"->",
"getName",
"(",
")",
",",
"implode",
"(",
"'`, `'",
",",
"array",
"(",
"'role'",
",",
"'name'",
",",
"'tags'",
")",
")",
")",
",",
"$",
"suite",
"->",
"getName",
"(",
")",
")",
";",
"}"
] | Creates filter of provided type.
@param string $type
@param string $filterString
@param Suite $suite
@return FilterInterface
@throws SuiteConfigurationException If filter type is not recognised | [
"Creates",
"filter",
"of",
"provided",
"type",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php#L157-L181 | train |
Behat/Behat | src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php | LazyFeatureIterator.moveToNextAvailableFeature | private function moveToNextAvailableFeature()
{
while (!count($this->features) && $this->position < count($this->paths)) {
$this->features = $this->parseFeature($this->paths[$this->position]);
$this->position++;
}
$this->currentFeature = array_shift($this->features);
} | php | private function moveToNextAvailableFeature()
{
while (!count($this->features) && $this->position < count($this->paths)) {
$this->features = $this->parseFeature($this->paths[$this->position]);
$this->position++;
}
$this->currentFeature = array_shift($this->features);
} | [
"private",
"function",
"moveToNextAvailableFeature",
"(",
")",
"{",
"while",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"features",
")",
"&&",
"$",
"this",
"->",
"position",
"<",
"count",
"(",
"$",
"this",
"->",
"paths",
")",
")",
"{",
"$",
"this",
"->",
"features",
"=",
"$",
"this",
"->",
"parseFeature",
"(",
"$",
"this",
"->",
"paths",
"[",
"$",
"this",
"->",
"position",
"]",
")",
";",
"$",
"this",
"->",
"position",
"++",
";",
"}",
"$",
"this",
"->",
"currentFeature",
"=",
"array_shift",
"(",
"$",
"this",
"->",
"features",
")",
";",
"}"
] | Parses paths consequently. | [
"Parses",
"paths",
"consequently",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php#L186-L194 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadParameters | private function loadParameters(ContainerBuilder $container)
{
$container->setParameter('gherkin.paths.lib', $this->getLibPath());
$container->setParameter('gherkin.paths.i18n', '%gherkin.paths.lib%/i18n.php');
$container->setParameter(
'suite.generic.default_settings',
array(
'paths' => array('%paths.base%/features'),
'contexts' => array('FeatureContext')
)
);
} | php | private function loadParameters(ContainerBuilder $container)
{
$container->setParameter('gherkin.paths.lib', $this->getLibPath());
$container->setParameter('gherkin.paths.i18n', '%gherkin.paths.lib%/i18n.php');
$container->setParameter(
'suite.generic.default_settings',
array(
'paths' => array('%paths.base%/features'),
'contexts' => array('FeatureContext')
)
);
} | [
"private",
"function",
"loadParameters",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"container",
"->",
"setParameter",
"(",
"'gherkin.paths.lib'",
",",
"$",
"this",
"->",
"getLibPath",
"(",
")",
")",
";",
"$",
"container",
"->",
"setParameter",
"(",
"'gherkin.paths.i18n'",
",",
"'%gherkin.paths.lib%/i18n.php'",
")",
";",
"$",
"container",
"->",
"setParameter",
"(",
"'suite.generic.default_settings'",
",",
"array",
"(",
"'paths'",
"=>",
"array",
"(",
"'%paths.base%/features'",
")",
",",
"'contexts'",
"=>",
"array",
"(",
"'FeatureContext'",
")",
")",
")",
";",
"}"
] | Loads default container parameters.
@param ContainerBuilder $container | [
"Loads",
"default",
"container",
"parameters",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L136-L147 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.getLibPath | private function getLibPath()
{
$reflection = new ReflectionClass('Behat\Gherkin\Gherkin');
$libPath = rtrim(dirname($reflection->getFilename()) . '/../../../', DIRECTORY_SEPARATOR);
return $libPath;
} | php | private function getLibPath()
{
$reflection = new ReflectionClass('Behat\Gherkin\Gherkin');
$libPath = rtrim(dirname($reflection->getFilename()) . '/../../../', DIRECTORY_SEPARATOR);
return $libPath;
} | [
"private",
"function",
"getLibPath",
"(",
")",
"{",
"$",
"reflection",
"=",
"new",
"ReflectionClass",
"(",
"'Behat\\Gherkin\\Gherkin'",
")",
";",
"$",
"libPath",
"=",
"rtrim",
"(",
"dirname",
"(",
"$",
"reflection",
"->",
"getFilename",
"(",
")",
")",
".",
"'/../../../'",
",",
"DIRECTORY_SEPARATOR",
")",
";",
"return",
"$",
"libPath",
";",
"}"
] | Returns gherkin library path.
@return string | [
"Returns",
"gherkin",
"library",
"path",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L154-L160 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadGherkin | private function loadGherkin(ContainerBuilder $container)
{
$definition = new Definition('Behat\Gherkin\Gherkin');
$container->setDefinition(self::MANAGER_ID, $definition);
} | php | private function loadGherkin(ContainerBuilder $container)
{
$definition = new Definition('Behat\Gherkin\Gherkin');
$container->setDefinition(self::MANAGER_ID, $definition);
} | [
"private",
"function",
"loadGherkin",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Gherkin\\Gherkin'",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"MANAGER_ID",
",",
"$",
"definition",
")",
";",
"}"
] | Loads gherkin service.
@param ContainerBuilder $container | [
"Loads",
"gherkin",
"service",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L167-L171 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadKeywords | private function loadKeywords(ContainerBuilder $container)
{
$definition = new Definition('Behat\Gherkin\Keywords\CachedArrayKeywords', array(
'%gherkin.paths.i18n%'
));
$container->setDefinition(self::KEYWORDS_ID, $definition);
$definition = new Definition('Behat\Gherkin\Keywords\KeywordsDumper', array(
new Reference(self::KEYWORDS_ID)
));
$container->setDefinition(self::KEYWORDS_DUMPER_ID, $definition);
} | php | private function loadKeywords(ContainerBuilder $container)
{
$definition = new Definition('Behat\Gherkin\Keywords\CachedArrayKeywords', array(
'%gherkin.paths.i18n%'
));
$container->setDefinition(self::KEYWORDS_ID, $definition);
$definition = new Definition('Behat\Gherkin\Keywords\KeywordsDumper', array(
new Reference(self::KEYWORDS_ID)
));
$container->setDefinition(self::KEYWORDS_DUMPER_ID, $definition);
} | [
"private",
"function",
"loadKeywords",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Gherkin\\Keywords\\CachedArrayKeywords'",
",",
"array",
"(",
"'%gherkin.paths.i18n%'",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"KEYWORDS_ID",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Gherkin\\Keywords\\KeywordsDumper'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"KEYWORDS_ID",
")",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"self",
"::",
"KEYWORDS_DUMPER_ID",
",",
"$",
"definition",
")",
";",
"}"
] | Loads keyword services.
@param ContainerBuilder $container | [
"Loads",
"keyword",
"services",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L178-L189 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadParser | private function loadParser(ContainerBuilder $container)
{
$definition = new Definition('Behat\Gherkin\Parser', array(
new Reference('gherkin.lexer')
));
$container->setDefinition('gherkin.parser', $definition);
$definition = new Definition('Behat\Gherkin\Lexer', array(
new Reference('gherkin.keywords')
));
$container->setDefinition('gherkin.lexer', $definition);
} | php | private function loadParser(ContainerBuilder $container)
{
$definition = new Definition('Behat\Gherkin\Parser', array(
new Reference('gherkin.lexer')
));
$container->setDefinition('gherkin.parser', $definition);
$definition = new Definition('Behat\Gherkin\Lexer', array(
new Reference('gherkin.keywords')
));
$container->setDefinition('gherkin.lexer', $definition);
} | [
"private",
"function",
"loadParser",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Gherkin\\Parser'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'gherkin.lexer'",
")",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'gherkin.parser'",
",",
"$",
"definition",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Gherkin\\Lexer'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'gherkin.keywords'",
")",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'gherkin.lexer'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads gherkin parser.
@param ContainerBuilder $container | [
"Loads",
"gherkin",
"parser",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L196-L207 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadDefaultLoaders | private function loadDefaultLoaders(ContainerBuilder $container, $cachePath)
{
$definition = new Definition('Behat\Gherkin\Loader\GherkinFileLoader', array(
new Reference('gherkin.parser')
));
if ($cachePath) {
$cacheDefinition = new Definition('Behat\Gherkin\Cache\FileCache', array($cachePath));
} else {
$cacheDefinition = new Definition('Behat\Gherkin\Cache\MemoryCache');
}
$definition->addMethodCall('setCache', array($cacheDefinition));
$definition->addMethodCall('setBasePath', array('%paths.base%'));
$definition->addTag(self::LOADER_TAG, array('priority' => 50));
$container->setDefinition('gherkin.loader.gherkin_file', $definition);
} | php | private function loadDefaultLoaders(ContainerBuilder $container, $cachePath)
{
$definition = new Definition('Behat\Gherkin\Loader\GherkinFileLoader', array(
new Reference('gherkin.parser')
));
if ($cachePath) {
$cacheDefinition = new Definition('Behat\Gherkin\Cache\FileCache', array($cachePath));
} else {
$cacheDefinition = new Definition('Behat\Gherkin\Cache\MemoryCache');
}
$definition->addMethodCall('setCache', array($cacheDefinition));
$definition->addMethodCall('setBasePath', array('%paths.base%'));
$definition->addTag(self::LOADER_TAG, array('priority' => 50));
$container->setDefinition('gherkin.loader.gherkin_file', $definition);
} | [
"private",
"function",
"loadDefaultLoaders",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"cachePath",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Gherkin\\Loader\\GherkinFileLoader'",
",",
"array",
"(",
"new",
"Reference",
"(",
"'gherkin.parser'",
")",
")",
")",
";",
"if",
"(",
"$",
"cachePath",
")",
"{",
"$",
"cacheDefinition",
"=",
"new",
"Definition",
"(",
"'Behat\\Gherkin\\Cache\\FileCache'",
",",
"array",
"(",
"$",
"cachePath",
")",
")",
";",
"}",
"else",
"{",
"$",
"cacheDefinition",
"=",
"new",
"Definition",
"(",
"'Behat\\Gherkin\\Cache\\MemoryCache'",
")",
";",
"}",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'setCache'",
",",
"array",
"(",
"$",
"cacheDefinition",
")",
")",
";",
"$",
"definition",
"->",
"addMethodCall",
"(",
"'setBasePath'",
",",
"array",
"(",
"'%paths.base%'",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"self",
"::",
"LOADER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'gherkin.loader.gherkin_file'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads gherkin loaders.
@param ContainerBuilder $container
@param string $cachePath | [
"Loads",
"gherkin",
"loaders",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L215-L231 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadProfileFilters | private function loadProfileFilters(ContainerBuilder $container, array $filters)
{
$gherkin = $container->getDefinition(self::MANAGER_ID);
foreach ($filters as $type => $filterString) {
$filter = $this->createFilterDefinition($type, $filterString);
$gherkin->addMethodCall('addFilter', array($filter));
}
} | php | private function loadProfileFilters(ContainerBuilder $container, array $filters)
{
$gherkin = $container->getDefinition(self::MANAGER_ID);
foreach ($filters as $type => $filterString) {
$filter = $this->createFilterDefinition($type, $filterString);
$gherkin->addMethodCall('addFilter', array($filter));
}
} | [
"private",
"function",
"loadProfileFilters",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"filters",
")",
"{",
"$",
"gherkin",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"self",
"::",
"MANAGER_ID",
")",
";",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"type",
"=>",
"$",
"filterString",
")",
"{",
"$",
"filter",
"=",
"$",
"this",
"->",
"createFilterDefinition",
"(",
"$",
"type",
",",
"$",
"filterString",
")",
";",
"$",
"gherkin",
"->",
"addMethodCall",
"(",
"'addFilter'",
",",
"array",
"(",
"$",
"filter",
")",
")",
";",
"}",
"}"
] | Loads profile-level gherkin filters.
@param ContainerBuilder $container
@param array $filters | [
"Loads",
"profile",
"-",
"level",
"gherkin",
"filters",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L239-L246 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadSyntaxController | private function loadSyntaxController(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Gherkin\Cli\SyntaxController', array(
new Reference(self::KEYWORDS_DUMPER_ID),
new Reference(TranslatorExtension::TRANSLATOR_ID)
));
$definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 600));
$container->setDefinition(CliExtension::CONTROLLER_TAG . '.gherkin_syntax', $definition);
} | php | private function loadSyntaxController(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Gherkin\Cli\SyntaxController', array(
new Reference(self::KEYWORDS_DUMPER_ID),
new Reference(TranslatorExtension::TRANSLATOR_ID)
));
$definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 600));
$container->setDefinition(CliExtension::CONTROLLER_TAG . '.gherkin_syntax', $definition);
} | [
"private",
"function",
"loadSyntaxController",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Gherkin\\Cli\\SyntaxController'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"KEYWORDS_DUMPER_ID",
")",
",",
"new",
"Reference",
"(",
"TranslatorExtension",
"::",
"TRANSLATOR_ID",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"CliExtension",
"::",
"CONTROLLER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"600",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"CliExtension",
"::",
"CONTROLLER_TAG",
".",
"'.gherkin_syntax'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads syntax controller.
@param ContainerBuilder $container | [
"Loads",
"syntax",
"controller",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L253-L261 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadFilterController | private function loadFilterController(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Gherkin\Cli\FilterController', array(
new Reference(self::MANAGER_ID)
));
$definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 700));
$container->setDefinition(CliExtension::CONTROLLER_TAG . '.gherkin_filters', $definition);
} | php | private function loadFilterController(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Gherkin\Cli\FilterController', array(
new Reference(self::MANAGER_ID)
));
$definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 700));
$container->setDefinition(CliExtension::CONTROLLER_TAG . '.gherkin_filters', $definition);
} | [
"private",
"function",
"loadFilterController",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Gherkin\\Cli\\FilterController'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"MANAGER_ID",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"CliExtension",
"::",
"CONTROLLER_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"700",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"CliExtension",
"::",
"CONTROLLER_TAG",
".",
"'.gherkin_filters'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads filter controller.
@param ContainerBuilder $container | [
"Loads",
"filter",
"controller",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L268-L275 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadSuiteWithPathsSetup | private function loadSuiteWithPathsSetup(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Gherkin\Suite\Setup\SuiteWithPathsSetup', array(
'%paths.base%',
new Reference(FilesystemExtension::LOGGER_ID)
));
$definition->addTag(SuiteExtension::SETUP_TAG, array('priority' => 50));
$container->setDefinition(SuiteExtension::SETUP_TAG . '.suite_with_paths', $definition);
} | php | private function loadSuiteWithPathsSetup(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Gherkin\Suite\Setup\SuiteWithPathsSetup', array(
'%paths.base%',
new Reference(FilesystemExtension::LOGGER_ID)
));
$definition->addTag(SuiteExtension::SETUP_TAG, array('priority' => 50));
$container->setDefinition(SuiteExtension::SETUP_TAG . '.suite_with_paths', $definition);
} | [
"private",
"function",
"loadSuiteWithPathsSetup",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Gherkin\\Suite\\Setup\\SuiteWithPathsSetup'",
",",
"array",
"(",
"'%paths.base%'",
",",
"new",
"Reference",
"(",
"FilesystemExtension",
"::",
"LOGGER_ID",
")",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"SuiteExtension",
"::",
"SETUP_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"50",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"SuiteExtension",
"::",
"SETUP_TAG",
".",
"'.suite_with_paths'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads suite with paths setup.
@param ContainerBuilder $container | [
"Loads",
"suite",
"with",
"paths",
"setup",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L282-L290 | train |
Behat/Behat | src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | GherkinExtension.loadFilesystemFeatureLocator | private function loadFilesystemFeatureLocator(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Gherkin\Specification\Locator\FilesystemFeatureLocator', array(
new Reference(self::MANAGER_ID),
'%paths.base%'
));
$definition->addTag(SpecificationExtension::LOCATOR_TAG, array('priority' => 60));
$container->setDefinition(SpecificationExtension::LOCATOR_TAG . '.filesystem_feature', $definition);
} | php | private function loadFilesystemFeatureLocator(ContainerBuilder $container)
{
$definition = new Definition('Behat\Behat\Gherkin\Specification\Locator\FilesystemFeatureLocator', array(
new Reference(self::MANAGER_ID),
'%paths.base%'
));
$definition->addTag(SpecificationExtension::LOCATOR_TAG, array('priority' => 60));
$container->setDefinition(SpecificationExtension::LOCATOR_TAG . '.filesystem_feature', $definition);
} | [
"private",
"function",
"loadFilesystemFeatureLocator",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"'Behat\\Behat\\Gherkin\\Specification\\Locator\\FilesystemFeatureLocator'",
",",
"array",
"(",
"new",
"Reference",
"(",
"self",
"::",
"MANAGER_ID",
")",
",",
"'%paths.base%'",
")",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"SpecificationExtension",
"::",
"LOCATOR_TAG",
",",
"array",
"(",
"'priority'",
"=>",
"60",
")",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"SpecificationExtension",
"::",
"LOCATOR_TAG",
".",
"'.filesystem_feature'",
",",
"$",
"definition",
")",
";",
"}"
] | Loads filesystem feature locator.
@param ContainerBuilder $container | [
"Loads",
"filesystem",
"feature",
"locator",
"."
] | eb6c5d39420a47c08344598b58ec5f8d26a75b9b | https://github.com/Behat/Behat/blob/eb6c5d39420a47c08344598b58ec5f8d26a75b9b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php#L297-L305 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.