@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | reset($required); |
| 129 | 129 | while (list($rule, $type) = each($required)) { |
| 130 | 130 | $matched = !($type & self::CONTEXT_EXACTLY) ? |
| 131 | - count(array_filter($context, function ($a) use ($rule) { |
|
| 131 | + count(array_filter($context, function($a) use ($rule) { |
|
| 132 | 132 | return $a === $rule || fnmatch($rule . '.*', $a); |
| 133 | 133 | })) > 0 : |
| 134 | 134 | in_array($rule, $context, true); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | private function _unsetUnnecessaryRules($rule, &$required) |
| 160 | 160 | { |
| 161 | 161 | if (strpos($rule, '.') !== false) { |
| 162 | - foreach (array_filter(array_keys($this->_context), function ($key) use ($rule) { |
|
| 162 | + foreach (array_filter(array_keys($this->_context), function($key) use ($rule) { |
|
| 163 | 163 | return fnmatch($key . '.*', $rule); |
| 164 | 164 | }) as $remove) { |
| 165 | 165 | unset($required[$remove]); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | ], $options); |
| 35 | 35 | |
| 36 | 36 | if ($options['escape']) { |
| 37 | - $words = array_map(function ($word) { |
|
| 37 | + $words = array_map(function($word) { |
|
| 38 | 38 | return preg_quote($word, '/'); |
| 39 | 39 | }, $words); |
| 40 | 40 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $all = []; |
| 53 | 53 | |
| 54 | 54 | foreach ($this->multiLine as $name => $comment) { |
| 55 | - $comment = array_map(function ($e) { return preg_quote($e, '/'); }, $comment); |
|
| 55 | + $comment = array_map(function($e) { return preg_quote($e, '/'); }, $comment); |
|
| 56 | 56 | |
| 57 | 57 | $all[] = [$name, "/{$comment[0]}(.*?){$comment[1]}/ms"]; |
| 58 | 58 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * @return ConsoleHelper |
| 28 | 28 | */ |
| 29 | 29 | public static function get() { |
| 30 | - if(!isset(self::$_instance)) { |
|
| 30 | + if (!isset(self::$_instance)) { |
|
| 31 | 31 | self::$_instance = new ConsoleHelper(); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | ]; |
| 32 | 32 | |
| 33 | 33 | public function styled($style, $text) { |
| 34 | - return $this->open($style).$text.$this->close(); |
|
| 34 | + return $this->open($style) . $text . $this->close(); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function open($style) |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public function close() |
| 49 | 49 | { |
| 50 | 50 | $this->_current = empty($this->_stack) ? $this->_default : array_pop($this->_stack); |
| 51 | - return "\033[0m".$this->_set(array_diff($this->_current, $this->_default)); |
|
| 51 | + return "\033[0m" . $this->_set(array_diff($this->_current, $this->_default)); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | private function _color($name, $bg = false) |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | private function _style($name, $value) { |
| 80 | - switch($name) { |
|
| 80 | + switch ($name) { |
|
| 81 | 81 | case 'color': |
| 82 | 82 | return $this->_color($value); |
| 83 | 83 | case 'background': |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | private function _set($style) { |
| 101 | - $escape = "\e[".implode(';', array_map(function($style, $name) { |
|
| 101 | + $escape = "\e[" . implode(';', array_map(function($style, $name) { |
|
| 102 | 102 | return $this->_style($style, $name); |
| 103 | - }, array_keys($style), $style)).'m'; |
|
| 103 | + }, array_keys($style), $style)) . 'm'; |
|
| 104 | 104 | |
| 105 | 105 | return $escape === "\e[m" ? null : $escape; |
| 106 | 106 | } |
@@ -34,9 +34,9 @@ |
||
| 34 | 34 | |
| 35 | 35 | if ($this->isStart()) { |
| 36 | 36 | $lang = $this->_rule->language; |
| 37 | - if($lang === null && $this->getInjected() !== $language) { |
|
| 37 | + if ($lang === null && $this->getInjected() !== $language) { |
|
| 38 | 38 | $valid = true; |
| 39 | - } elseif($language === $lang && $this->_rule->validateContext($context)) { |
|
| 39 | + } elseif ($language === $lang && $this->_rule->validateContext($context)) { |
|
| 40 | 40 | $valid = true; |
| 41 | 41 | } |
| 42 | 42 | } else { |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * @return ConsoleHelper |
| 28 | 28 | */ |
| 29 | 29 | public static function get() { |
| 30 | - if(!isset(self::$_instance)) { |
|
| 30 | + if (!isset(self::$_instance)) { |
|
| 31 | 31 | self::$_instance = new ConsoleHelper(); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | protected function validate(Language $language, $context) |
| 43 | 43 | { |
| 44 | - if($language !== $this->getRule()->language) { |
|
| 44 | + if ($language !== $this->getRule()->language) { |
|
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -56,10 +56,10 @@ |
||
| 56 | 56 | public function sort() { |
| 57 | 57 | ksort($this->_tokens); |
| 58 | 58 | |
| 59 | - foreach(array_keys($this->_pending) as $position) { |
|
| 59 | + foreach (array_keys($this->_pending) as $position) { |
|
| 60 | 60 | uasort( |
| 61 | 61 | $this->_tokens[$position], |
| 62 | - Token::class.'::compare' |
|
| 62 | + Token::class . '::compare' |
|
| 63 | 63 | ); |
| 64 | 64 | } |
| 65 | 65 | $this->_pending = []; |