@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function setRules($rules) |
48 | 48 | { |
49 | 49 | if (empty($rules)) { |
50 | - $this->_rules = [ 'none' => Validator::CONTEXT_IN_ONE_OF ]; |
|
50 | + $this->_rules = ['none' => Validator::CONTEXT_IN_ONE_OF]; |
|
51 | 51 | } else { |
52 | 52 | foreach ($rules as $key => $rule) { |
53 | 53 | list($plain, $type) = $this->_parse($rule); |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | private function _clean($rule, &$required) |
60 | 60 | { |
61 | 61 | if (strpos($rule, '.') !== false) { |
62 | - $parents = array_filter(array_keys($required), function ($key) use ($rule) { |
|
63 | - return fnmatch($key . '.*', $rule); |
|
62 | + $parents = array_filter(array_keys($required), function($key) use ($rule) { |
|
63 | + return fnmatch($key.'.*', $rule); |
|
64 | 64 | }); |
65 | 65 | |
66 | 66 | foreach ($parents as $remove) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | { |
165 | 165 | static $validator; |
166 | 166 | if (!$validator) { |
167 | - $validator = new DelegateValidator(function () { |
|
167 | + $validator = new DelegateValidator(function() { |
|
168 | 168 | return true; |
169 | 169 | }); |
170 | 170 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | foreach (array_keys($this->_pending) as $position) { |
64 | 64 | uasort( |
65 | 65 | $this->_tokens[$position], |
66 | - Token::class . '::compare' |
|
66 | + Token::class.'::compare' |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | $this->_pending = []; |
@@ -67,7 +67,7 @@ |
||
67 | 67 | protected function getDefaultInputDefinition() |
68 | 68 | { |
69 | 69 | $input = parent::getDefaultInputDefinition(); |
70 | - $input->setOptions(array_filter($input->getOptions(), function (InputOption $option) { |
|
70 | + $input->setOptions(array_filter($input->getOptions(), function(InputOption $option) { |
|
71 | 71 | return $option->getShortcut() != 'q'; |
72 | 72 | })); |
73 | 73 | $input->addOption(new InputOption('no-output', 's', InputOption::VALUE_NONE, 'Disables output, useful for debug')); |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | if ($this->wants('detailed-time')) { |
86 | - $this->_slashed('Times [s]', array_map(function ($t) { |
|
86 | + $this->_slashed('Times [s]', array_map(function($t) { |
|
87 | 87 | return number_format($t, 5); |
88 | 88 | }, $this->_times)); |
89 | - $this->_slashed('Performance [chars/s]', array_map(function ($t) { |
|
89 | + $this->_slashed('Performance [chars/s]', array_map(function($t) { |
|
90 | 90 | return number_format(strlen($this->_source) / $t); |
91 | 91 | }, $this->_times)); |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | if ($this->wants('density')) { |
99 | - $this->_slashed('Token density [tokens/kB]', array_map(function ($c) { |
|
99 | + $this->_slashed('Token density [tokens/kB]', array_map(function($c) { |
|
100 | 100 | return number_format($c / strlen($this->_source) * 1024, 1); |
101 | 101 | }, $this->_counts)); |
102 | 102 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | protected function tokenize() |
113 | 113 | { |
114 | - $tokens = $this->benchmark(function () { |
|
114 | + $tokens = $this->benchmark(function() { |
|
115 | 115 | return $this->_language->tokenize($this->_source); |
116 | 116 | }, $this->_times['tokenization']); |
117 | 117 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | protected function parse(Tokens $tokens) |
142 | 142 | { |
143 | - $tokens = $this->benchmark(function () use ($tokens) { |
|
143 | + $tokens = $this->benchmark(function() use ($tokens) { |
|
144 | 144 | return $this->_language->parse($tokens); |
145 | 145 | }, $this->_times['parsing']); |
146 | 146 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | protected function format(Tokens $tokens) |
156 | 156 | { |
157 | - return $this->benchmark(function () use ($tokens) { |
|
157 | + return $this->benchmark(function() use ($tokens) { |
|
158 | 158 | return $this->_formatter->format($tokens); |
159 | 159 | }, $this->_times['formatting']); |
160 | 160 | } |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | { |
164 | 164 | $this->_output->writeln(sprintf( |
165 | 165 | "$message %s: %s", |
166 | - implode(' / ', array_map(function ($f) { |
|
166 | + implode(' / ', array_map(function($f) { |
|
167 | 167 | return "<comment>{$f}</comment>"; |
168 | 168 | }, array_keys($data))), |
169 | - implode(' / ', array_map(function ($f) { |
|
169 | + implode(' / ', array_map(function($f) { |
|
170 | 170 | return "<info>{$f}</info>"; |
171 | 171 | }, array_values($data))) |
172 | 172 | )); |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | if ($input->getOption('dry')) { |
31 | 31 | $output->writeln($this->generate()); |
32 | 32 | } else { |
33 | - $path = __DIR__ . '/../../../Docs/A-languages.md'; |
|
33 | + $path = __DIR__.'/../../../Docs/A-languages.md'; |
|
34 | 34 | |
35 | 35 | $output->writeln("<info>Opening file ./Docs/A-languages.md ...</info>", OutputInterface::VERBOSITY_VERBOSE); |
36 | 36 | $content = file_get_contents($path); |
37 | 37 | file_put_contents($path, preg_replace( |
38 | 38 | '/^<!-- aliasbegin -->\R.*?^<!-- aliasend -->\R/ms', |
39 | - "<!-- aliasbegin -->\n" . $this->generate() . "<!-- aliasend -->\n", |
|
39 | + "<!-- aliasbegin -->\n".$this->generate()."<!-- aliasend -->\n", |
|
40 | 40 | $content |
41 | 41 | )); |
42 | 42 | $output->writeln("<info>Closing file ./Docs/A-languages.md ...</info>", OutputInterface::VERBOSITY_VERBOSE); |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | |
64 | 64 | ksort($result); |
65 | 65 | |
66 | - $return = "Class | Name | MIME | Extension\n"; |
|
67 | - $return .= "------|------|------|----------\n"; |
|
66 | + $return = "Class | Name | MIME | Extension\n"; |
|
67 | + $return .= "------|------|------|----------\n"; |
|
68 | 68 | foreach ($result as $class => $aliases) { |
69 | - $return .= '`' . $class . '` | '; |
|
70 | - $return .= (isset($aliases['name']) ? '`' . implode('`, `', $aliases['name']) . '`' : 'none') . ' | '; |
|
71 | - $return .= (isset($aliases['mime']) ? '`' . implode('`, `', $aliases['mime']) . '`' : 'none') . ' | '; |
|
72 | - $return .= (isset($aliases['extension']) ? '`' . implode('`, `', $aliases['extension']) . '`' : 'none') . "\n"; |
|
69 | + $return .= '`'.$class.'` | '; |
|
70 | + $return .= (isset($aliases['name']) ? '`'.implode('`, `', $aliases['name']).'`' : 'none').' | '; |
|
71 | + $return .= (isset($aliases['mime']) ? '`'.implode('`, `', $aliases['mime']).'`' : 'none').' | '; |
|
72 | + $return .= (isset($aliases['extension']) ? '`'.implode('`, `', $aliases['extension']).'`' : 'none')."\n"; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $return; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'debug', |
44 | 44 | 'd', |
45 | 45 | InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
46 | - 'Debug features: ' . implode(', ', array_map(function ($f) { |
|
46 | + 'Debug features: '.implode(', ', array_map(function($f) { |
|
47 | 47 | return "<info>{$f}</info>"; |
48 | 48 | }, $this->_debug)) |
49 | 49 | ) |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); |
58 | 58 | } |
59 | 59 | |
60 | - $output->writeln($this->getApplication()->getLongVersion() . "\n", Output::VERBOSITY_VERBOSE); |
|
60 | + $output->writeln($this->getApplication()->getLongVersion()."\n", Output::VERBOSITY_VERBOSE); |
|
61 | 61 | $formatter = KeyLighter::get()->getFormatter($input->getOption('format')) ?: KeyLighter::get()->getDefaultFormatter(); |
62 | 62 | |
63 | 63 | foreach ($input->getArgument('path') as $filename) { |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | $this->_keylighter = KeyLighter::get(); |
40 | 40 | $this->_formatter = new TestFormatter(); |
41 | 41 | |
42 | - $this->_input = realpath(__DIR__ . '/../../../Tests/Samples'); |
|
43 | - $this->_output = realpath(__DIR__ . '/../../../Tests/Expected/Test'); |
|
42 | + $this->_input = realpath(__DIR__.'/../../../Tests/Samples'); |
|
43 | + $this->_output = realpath(__DIR__.'/../../../Tests/Expected/Test'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | if ($this->review($input, $output, $tokens, $reviewer)) { |
71 | 71 | $result = StringHelper::normalize($this->_formatter->format($tokens)); |
72 | 72 | |
73 | - if (!file_exists($this->_output . '/' . dirname($pathname))) { |
|
74 | - mkdir($this->_output . '/' . dirname($pathname), 0755, true); |
|
73 | + if (!file_exists($this->_output.'/'.dirname($pathname))) { |
|
74 | + mkdir($this->_output.'/'.dirname($pathname), 0755, true); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | file_put_contents("{$this->_output}/$pathname.tkn", $result); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | protected function configure() |
33 | 33 | { |
34 | 34 | $this->setName('languages') |
35 | - ->addArgument('by', InputArgument::OPTIONAL, 'Alias type, one of ' . implode(', ', array_map(function ($f) { |
|
35 | + ->addArgument('by', InputArgument::OPTIONAL, 'Alias type, one of '.implode(', ', array_map(function($f) { |
|
36 | 36 | return "<info>{$f}</info>"; |
37 | 37 | }, $this->types)), 'name') |
38 | 38 | ->addOption('no-group', 'g', InputOption::VALUE_NONE, 'Do not group languages by type') |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | $table->setHeaders([ucfirst($input->getArgument('by')), $input->getOption('classes') ? 'Class name' : 'Language']); |
53 | 53 | } |
54 | 54 | |
55 | - $table->setRows(array_map(function ($language) { |
|
55 | + $table->setRows(array_map(function($language) { |
|
56 | 56 | return [ |
57 | - implode(', ', array_map(function ($f) { |
|
57 | + implode(', ', array_map(function($f) { |
|
58 | 58 | return "<comment>{$f}</comment>"; |
59 | 59 | }, $language['aliases'])), |
60 | 60 | $language['class'] |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $table->setHeaders(['Name', 'Formatter']); |
45 | 45 | } |
46 | 46 | |
47 | - $table->setRows(array_map(function ($alias, $class) { |
|
47 | + $table->setRows(array_map(function($alias, $class) { |
|
48 | 48 | return [ |
49 | 49 | "<comment>{$alias}</comment>", |
50 | 50 | get_class($class) |