@@ -33,21 +33,21 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function format(FeatureNode $feature) |
| 35 | 35 | { |
| 36 | - $shortDesc = $feature->getKeyword() . ': ' . $feature->getTitle() . "\n"; |
|
| 36 | + $shortDesc = $feature->getKeyword().': '.$feature->getTitle()."\n"; |
|
| 37 | 37 | |
| 38 | - if (! $feature->hasDescription()) { |
|
| 38 | + if (!$feature->hasDescription()) { |
|
| 39 | 39 | return rtrim($shortDesc); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $longDesc = implode( |
| 43 | 43 | array_map( |
| 44 | - function ($descriptionLine) { |
|
| 45 | - return $this->indent() . trim($descriptionLine) . "\n"; |
|
| 44 | + function($descriptionLine) { |
|
| 45 | + return $this->indent().trim($descriptionLine)."\n"; |
|
| 46 | 46 | }, |
| 47 | 47 | explode("\n", $feature->getDescription()) |
| 48 | 48 | ) |
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | - return $shortDesc . rtrim($longDesc); |
|
| 51 | + return $shortDesc.rtrim($longDesc); |
|
| 52 | 52 | } |
| 53 | 53 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function format(OutlineNode $scenario) |
| 35 | 35 | { |
| 36 | - if (! $scenario->hasExamples()) { |
|
| 36 | + if (!$scenario->hasExamples()) { |
|
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | return implode( |
| 42 | 42 | array_merge( |
| 43 | 43 | [ |
| 44 | - $this->indent(self::INDENTATION * 2) . rtrim($scenario->getExampleTable()->getKeyword()) . ":\n", |
|
| 44 | + $this->indent(self::INDENTATION * 2).rtrim($scenario->getExampleTable()->getKeyword()).":\n", |
|
| 45 | 45 | ], |
| 46 | 46 | array_map( |
| 47 | - function ($arguments) { |
|
| 48 | - return $this->indent(self::INDENTATION * 2 + 2) . trim($arguments) . "\n"; |
|
| 47 | + function($arguments) { |
|
| 48 | + return $this->indent(self::INDENTATION * 2 + 2).trim($arguments)."\n"; |
|
| 49 | 49 | }, |
| 50 | 50 | explode("\n", $scenario->getExampleTable()->getTableAsString()) |
| 51 | 51 | ) |
@@ -34,8 +34,8 @@ |
||
| 34 | 34 | return implode( |
| 35 | 35 | ' ', |
| 36 | 36 | array_map( |
| 37 | - function ($tag) { |
|
| 38 | - return '@' . trim($tag); |
|
| 37 | + function($tag) { |
|
| 38 | + return '@'.trim($tag); |
|
| 39 | 39 | }, |
| 40 | 40 | $tags |
| 41 | 41 | ) |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | return rtrim(implode( |
| 48 | 48 | array_map( |
| 49 | - function (ScenarioInterface $scenario) { |
|
| 49 | + function(ScenarioInterface $scenario) { |
|
| 50 | 50 | return $this->getTags($scenario) |
| 51 | 51 | . $this->getScenarioDescription($scenario) |
| 52 | 52 | . $this->getSteps($scenario) |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | }, |
| 55 | 55 | $scenarios |
| 56 | 56 | ) |
| 57 | - )) . "\n"; |
|
| 57 | + ))."\n"; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | private function getTags(ScenarioInterface $scenario) |
| 66 | 66 | { |
| 67 | - if (! $scenario->hasTags()) { |
|
| 67 | + if (!$scenario->hasTags()) { |
|
| 68 | 68 | return $this->indent(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - return $this->indent() . (new Tags())->format($scenario->getTags()) . "\n"; |
|
| 71 | + return $this->indent().(new Tags())->format($scenario->getTags())."\n"; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | private function getScenarioDescription(ScenarioInterface $scenario) |
| 80 | 80 | { |
| 81 | 81 | $titleLines = $this->getTitleLines($scenario); |
| 82 | - $scenarioTitle = trim($scenario->getKeyword() . ': ' . array_shift($titleLines)); |
|
| 82 | + $scenarioTitle = trim($scenario->getKeyword().': '.array_shift($titleLines)); |
|
| 83 | 83 | |
| 84 | 84 | if ($scenario->hasTags()) { |
| 85 | - $scenarioTitle = $this->indent() . $scenarioTitle; |
|
| 85 | + $scenarioTitle = $this->indent().$scenarioTitle; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return implode( |
| 89 | - "\n" . $this->indent(12), |
|
| 89 | + "\n".$this->indent(12), |
|
| 90 | 90 | array_merge( |
| 91 | 91 | [$scenarioTitle], |
| 92 | 92 | $titleLines |
| 93 | 93 | ) |
| 94 | - ) . "\n"; |
|
| 94 | + )."\n"; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function getSteps(ScenarioInterface $scenario) |
| 103 | 103 | { |
| 104 | - if (! $scenario->hasSteps()) { |
|
| 104 | + if (!$scenario->hasSteps()) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $step = new Step($this->align); |
| 109 | 109 | |
| 110 | - return $step->format($scenario->getSteps()) . "\n"; |
|
| 110 | + return $step->format($scenario->getSteps())."\n"; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | private function getExamples($scenario) |
| 119 | 119 | { |
| 120 | - if (! $scenario instanceof OutlineNode) { |
|
| 120 | + if (!$scenario instanceof OutlineNode) { |
|
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | return implode( |
| 54 | 54 | array_map( |
| 55 | - function (StepNode $step) { |
|
| 56 | - return $this->getStepText($step) . $this->getArguments($step); |
|
| 55 | + function(StepNode $step) { |
|
| 56 | + return $this->getStepText($step).$this->getArguments($step); |
|
| 57 | 57 | }, |
| 58 | 58 | $steps |
| 59 | 59 | ) |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $this->indent($spacesQuantity + self::INDENTATION), |
| 89 | 89 | trim($step->getKeyword()), |
| 90 | 90 | trim($step->getText()) |
| 91 | - )) . "\n"; |
|
| 91 | + ))."\n"; |
|
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
@@ -99,18 +99,18 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function getArguments(StepNode $step) |
| 101 | 101 | { |
| 102 | - if (! $step->hasArguments()) { |
|
| 102 | + if (!$step->hasArguments()) { |
|
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return implode( |
| 107 | 107 | array_map( |
| 108 | - function (ArgumentInterface $argument) { |
|
| 108 | + function(ArgumentInterface $argument) { |
|
| 109 | 109 | if (in_array($argument->getNodeType(), ['Table', 'ExampleTable'])) { |
| 110 | 110 | return implode( |
| 111 | 111 | array_map( |
| 112 | - function ($arguments) { |
|
| 113 | - return $this->indent(self::INDENTATION * 2 + 4) . trim($arguments) . "\n"; |
|
| 112 | + function($arguments) { |
|
| 113 | + return $this->indent(self::INDENTATION * 2 + 4).trim($arguments)."\n"; |
|
| 114 | 114 | }, |
| 115 | 115 | explode("\n", $argument->getTableAsString()) |
| 116 | 116 | ) |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | return $this->encapsulateAsPyString( |
| 122 | 122 | implode( |
| 123 | 123 | array_map( |
| 124 | - function ($arguments) { |
|
| 125 | - return rtrim($this->indent(self::INDENTATION * 2 + 2) . trim($arguments)) . "\n"; |
|
| 124 | + function($arguments) { |
|
| 125 | + return rtrim($this->indent(self::INDENTATION * 2 + 2).trim($arguments))."\n"; |
|
| 126 | 126 | }, |
| 127 | 127 | $argument->getStrings() |
| 128 | 128 | ) |
@@ -142,6 +142,6 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | private function encapsulateAsPyString($string) |
| 144 | 144 | { |
| 145 | - return sprintf('%s%s%1$s', $this->indent(8) . '"""' . "\n", $string); |
|
| 145 | + return sprintf('%s%s%1$s', $this->indent(8).'"""'."\n", $string); |
|
| 146 | 146 | } |
| 147 | 147 | } |
@@ -43,12 +43,12 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | public function format(BackgroundNode $background) |
| 45 | 45 | { |
| 46 | - $shortDesc = $this->getBackgroundShortDescription($background) . "\n"; |
|
| 46 | + $shortDesc = $this->getBackgroundShortDescription($background)."\n"; |
|
| 47 | 47 | |
| 48 | 48 | $step = new Step($this->align); |
| 49 | 49 | $steps = $step->format($background->getSteps()); |
| 50 | 50 | |
| 51 | - return $this->indent() . $shortDesc . $steps; |
|
| 51 | + return $this->indent().$shortDesc.$steps; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -63,10 +63,10 @@ |
||
| 63 | 63 | |
| 64 | 64 | public function __invoke($feature) |
| 65 | 65 | { |
| 66 | - $formatted = $feature->getLanguage() && $feature->getLanguage() !== 'en' ? '# language: ' . trim($feature->getLanguage()) . "\n" : ''; |
|
| 67 | - $formatted .= $feature->hasTags() ? $this->tags->format($feature->getTags()) . "\n" : ''; |
|
| 68 | - $formatted .= $this->featureDescription->format($feature) . "\n\n"; |
|
| 69 | - $formatted .= $feature->hasBackground() ? $this->background->format($feature->getBackground()) . "\n" : ''; |
|
| 66 | + $formatted = $feature->getLanguage() && $feature->getLanguage() !== 'en' ? '# language: '.trim($feature->getLanguage())."\n" : ''; |
|
| 67 | + $formatted .= $feature->hasTags() ? $this->tags->format($feature->getTags())."\n" : ''; |
|
| 68 | + $formatted .= $this->featureDescription->format($feature)."\n\n"; |
|
| 69 | + $formatted .= $feature->hasBackground() ? $this->background->format($feature->getBackground())."\n" : ''; |
|
| 70 | 70 | $formatted .= $feature->hasScenarios() ? $this->scenario->format($feature->getScenarios()) : ''; |
| 71 | 71 | |
| 72 | 72 | return $formatted; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $directory = $input->getArgument('directory'); |
| 90 | 90 | $finder = (new FeatureResolve($directory))->__invoke(); |
| 91 | 91 | |
| 92 | - $output->writeln("\nFinding files on <info>" . $directory . "</info>\n"); |
|
| 92 | + $output->writeln("\nFinding files on <info>".$directory."</info>\n"); |
|
| 93 | 93 | |
| 94 | 94 | /* @var $file \Symfony\Component\Finder\SplFileInfo */ |
| 95 | 95 | foreach ($finder as $file) { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $filePointer = $file->openFile('w'); |
| 109 | 109 | $filePointer->fwrite($formatted); |
| 110 | 110 | |
| 111 | - $output->writeln('<info>' . $file->getRealPath() . '</info>'); |
|
| 111 | + $output->writeln('<info>'.$file->getRealPath().'</info>'); |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $directory = $input->getArgument('directory'); |
| 96 | 96 | $finder = (new FeatureResolve($directory))->__invoke(); |
| 97 | 97 | |
| 98 | - $output->writeln("\nFinding files on <info>" . $directory . "</info>\n"); |
|
| 98 | + $output->writeln("\nFinding files on <info>".$directory."</info>\n"); |
|
| 99 | 99 | |
| 100 | 100 | /* @var $file \Symfony\Component\Finder\SplFileInfo */ |
| 101 | 101 | foreach ($finder as $file) { |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | if ($formatted !== $contentWithoutComments) { |
| 116 | 116 | |
| 117 | - if (! defined('FAILED')) { |
|
| 117 | + if (!defined('FAILED')) { |
|
| 118 | 118 | define('FAILED', true); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $outputBuilder = new UnifiedDiffOutputBuilder("--- Original\n+++ Expected\n", false); |
| 122 | 122 | $diff = new Differ($outputBuilder); |
| 123 | 123 | |
| 124 | - $output->writeln('<error>Wrong style: ' . $file->getRealPath() . '</error>'); |
|
| 124 | + $output->writeln('<error>Wrong style: '.$file->getRealPath().'</error>'); |
|
| 125 | 125 | $output->writeln($diff->diff($contentWithoutComments, $formatted)); |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -144,17 +144,17 @@ discard block |
||
| 144 | 144 | implode( |
| 145 | 145 | array_filter( |
| 146 | 146 | array_map( |
| 147 | - function ($line) { |
|
| 147 | + function($line) { |
|
| 148 | 148 | if (0 === mb_strpos(ltrim($line), '#')) { |
| 149 | 149 | return ''; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - return rtrim($line) . "\n"; |
|
| 152 | + return rtrim($line)."\n"; |
|
| 153 | 153 | }, |
| 154 | 154 | explode("\n", $fileContent) |
| 155 | 155 | ) |
| 156 | 156 | ) |
| 157 | 157 | ) |
| 158 | - ) . "\n"; |
|
| 158 | + )."\n"; |
|
| 159 | 159 | } |
| 160 | 160 | } |