@@ -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 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $directory = $input->getArgument('directory'); |
94 | 94 | $finder = (new FeatureResolve($directory))->__invoke(); |
95 | 95 | |
96 | - $output->writeln("\nFinding files on <info>" . $directory . "</info>\n"); |
|
96 | + $output->writeln("\nFinding files on <info>".$directory."</info>\n"); |
|
97 | 97 | |
98 | 98 | $tagFormatter = new Tags(); |
99 | 99 | $featureDescription = new FeatureDescription(); |
@@ -107,20 +107,20 @@ discard block |
||
107 | 107 | $contentWithoutComments = $this->removeComments($fileContent); |
108 | 108 | $feature = $this->parser->parse($fileContent); |
109 | 109 | |
110 | - $formatted = $feature->hasTags() ? $tagFormatter->format($feature->getTags()) . "\n" : ''; |
|
111 | - $formatted .= $featureDescription->format($feature) . "\n\n"; |
|
112 | - $formatted .= $feature->hasBackground() ? $background->format($feature->getBackground()) . "\n" : ''; |
|
110 | + $formatted = $feature->hasTags() ? $tagFormatter->format($feature->getTags())."\n" : ''; |
|
111 | + $formatted .= $featureDescription->format($feature)."\n\n"; |
|
112 | + $formatted .= $feature->hasBackground() ? $background->format($feature->getBackground())."\n" : ''; |
|
113 | 113 | $formatted .= $feature->hasScenarios() ? $scenario->format($feature->getScenarios()) : ''; |
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 | $diff = new Differ("--- Original\n+++ Expected\n", false); |
122 | 122 | |
123 | - $output->writeln('<error>Wrong style: ' . $file->getRealPath() . '</error>'); |
|
123 | + $output->writeln('<error>Wrong style: '.$file->getRealPath().'</error>'); |
|
124 | 124 | $output->writeln($diff->diff($contentWithoutComments, $formatted)); |
125 | 125 | } |
126 | 126 | } |
@@ -143,17 +143,17 @@ discard block |
||
143 | 143 | implode( |
144 | 144 | array_filter( |
145 | 145 | array_map( |
146 | - function ($line) { |
|
146 | + function($line) { |
|
147 | 147 | if (0 === mb_strpos(ltrim($line), '#')) { |
148 | 148 | return ''; |
149 | 149 | } |
150 | 150 | |
151 | - return rtrim($line) . "\n"; |
|
151 | + return rtrim($line)."\n"; |
|
152 | 152 | }, |
153 | 153 | explode("\n", $fileContent) |
154 | 154 | ) |
155 | 155 | ) |
156 | 156 | ) |
157 | - ) . "\n"; |
|
157 | + )."\n"; |
|
158 | 158 | } |
159 | 159 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $directory = $input->getArgument('directory'); |
89 | 89 | $finder = (new FeatureResolve($directory))->__invoke(); |
90 | 90 | |
91 | - $output->writeln("\nFinding files on <info>" . $directory . "</info>\n"); |
|
91 | + $output->writeln("\nFinding files on <info>".$directory."</info>\n"); |
|
92 | 92 | |
93 | 93 | $tagFormatter = new Tags(); |
94 | 94 | $featureDescription = new FeatureDescription(); |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | $fileContent = $file->getContents(); |
102 | 102 | $feature = $this->parser->parse($fileContent); |
103 | 103 | |
104 | - $formatted = $feature->hasTags() ? $tagFormatter->format($feature->getTags()) . "\n" : ''; |
|
105 | - $formatted .= $featureDescription->format($feature) . "\n\n"; |
|
106 | - $formatted .= $feature->hasBackground() ? $background->format($feature->getBackground()) . "\n" : ''; |
|
104 | + $formatted = $feature->hasTags() ? $tagFormatter->format($feature->getTags())."\n" : ''; |
|
105 | + $formatted .= $featureDescription->format($feature)."\n\n"; |
|
106 | + $formatted .= $feature->hasBackground() ? $background->format($feature->getBackground())."\n" : ''; |
|
107 | 107 | $formatted .= $feature->hasScenarios() ? $scenario->format($feature->getScenarios()) : ''; |
108 | 108 | |
109 | 109 | $filePointer = $file->openFile('w'); |
110 | 110 | $filePointer->fwrite($formatted); |
111 | 111 | |
112 | - $output->writeln('<info>' . $file->getRealPath() . '</info>'); |
|
112 | + $output->writeln('<info>'.$file->getRealPath().'</info>'); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |