@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param $styles |
| 34 | 34 | */ |
| 35 | 35 | public function __construct($styles = false) { |
| 36 | - $this->_styles = $styles ?: include __DIR__.'/../Styles/Cli/Default.php'; |
|
| 36 | + $this->_styles = $styles ?: include __DIR__ . '/../Styles/Cli/Default.php'; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function format($source, \Traversable $tokens) |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $last = $token->pos; |
| 53 | 53 | } |
| 54 | - $result .= substr($source, $last).Console::reset(); |
|
| 54 | + $result .= substr($source, $last) . Console::reset(); |
|
| 55 | 55 | |
| 56 | 56 | return $result; |
| 57 | 57 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function getColor($token) |
| 60 | 60 | { |
| 61 | 61 | do { |
| 62 | - if(isset($this->_styles[$token])) { |
|
| 62 | + if (isset($this->_styles[$token])) { |
|
| 63 | 63 | return $this->_styles[$token]; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -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]); |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | public function match($source) |
| 22 | 22 | { |
| 23 | - return array_filter(parent::match($source), function (Token $token) { |
|
| 23 | + return array_filter(parent::match($source), function(Token $token) { |
|
| 24 | 24 | if ($token->isEnd()) { |
| 25 | 25 | $token->setStart(null); |
| 26 | 26 | |
@@ -29,9 +29,9 @@ |
||
| 29 | 29 | $valid = false; |
| 30 | 30 | if ($this->isStart()) { |
| 31 | 31 | $lang = $this->_rule->getLanguage(); |
| 32 | - if($lang === null && $this->getLanguage() !== $language) { |
|
| 32 | + if ($lang === null && $this->getLanguage() !== $language) { |
|
| 33 | 33 | $valid = true; |
| 34 | - } elseif($language === $lang && $this->_rule->validateContext($context)) { |
|
| 34 | + } elseif ($language === $lang && $this->_rule->validateContext($context)) { |
|
| 35 | 35 | $valid = true; |
| 36 | 36 | } |
| 37 | 37 | } else { |
@@ -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 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $needle = [$needle]; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $results = array_map(function ($str) use ($haystack, $offset) { |
|
| 53 | + $results = array_map(function($str) use ($haystack, $offset) { |
|
| 54 | 54 | return [$str, strpos($haystack, $str, $offset)]; |
| 55 | 55 | }, $needle); |
| 56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $results = array_filter( |
| 62 | 62 | array_combine(ArrayHelper::column($results, 0), ArrayHelper::column($results, 1)), |
| 63 | - function ($a) { |
|
| 63 | + function($a) { |
|
| 64 | 64 | return $a !== false; |
| 65 | 65 | } |
| 66 | 66 | ); |
@@ -45,14 +45,14 @@ |
||
| 45 | 45 | |
| 46 | 46 | public static function rearrange(array $array, array $keys) |
| 47 | 47 | { |
| 48 | - return array_combine($keys, array_map(function ($key) use ($array) { |
|
| 48 | + return array_combine($keys, array_map(function($key) use ($array) { |
|
| 49 | 49 | return $array[$key]; |
| 50 | 50 | }, $keys)); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public static function column(array $array, $index) |
| 54 | 54 | { |
| 55 | - return array_map(function ($e) use ($index) { return $e[$index]; }, $array); |
|
| 55 | + return array_map(function($e) use ($index) { return $e[$index]; }, $array); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public static function find(array $array, callable $tester) |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | public function match($source) |
| 22 | 22 | { |
| 23 | - return array_filter(parent::match($source), function (Token $token) { |
|
| 23 | + return array_filter(parent::match($source), function(Token $token) { |
|
| 24 | 24 | if ($token->isEnd()) { |
| 25 | 25 | $token->setStart(null); |
| 26 | 26 | |