@@ -113,7 +113,7 @@ |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * @param mixed $class |
|
| 116 | + * @param string $class |
|
| 117 | 117 | * |
| 118 | 118 | * @throws \InvalidArgumentException |
| 119 | 119 | */ |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function create($params) { |
| 48 | 48 | $params[0] = !empty($params[0]) ? $this->getName($params[0]) : $this->_base; |
| 49 | - if(empty($params['rule'])) { |
|
| 49 | + if (empty($params['rule'])) { |
|
| 50 | 50 | $params['rule'] = $this->_rule; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if(isset($params['pos'])) { |
|
| 53 | + if (isset($params['pos'])) { |
|
| 54 | 54 | $params['pos'] += $this->_offset; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | /** @var Token $token */ |
| 67 | 67 | $token = new $this->_class($params); |
| 68 | 68 | |
| 69 | - if($this->_type == 0x3) { |
|
| 69 | + if ($this->_type == 0x3) { |
|
| 70 | 70 | return $token; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if($this->_type === Token::START) { |
|
| 73 | + if ($this->_type === Token::START) { |
|
| 74 | 74 | $token->setEnd(false); |
| 75 | 75 | return $token; |
| 76 | 76 | } else { |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function setClass($class) |
| 121 | 121 | { |
| 122 | - if(!is_a($class, 'Kadet\Highlighter\Parser\Token', true)) { |
|
| 122 | + if (!is_a($class, 'Kadet\Highlighter\Parser\Token', true)) { |
|
| 123 | 123 | throw new \InvalidArgumentException('$class must extend Kadet\Highlighter\Parser\Token'); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -91,19 +91,19 @@ |
||
| 91 | 91 | $multiplier = $a->isEnd() ? -1 : 1; |
| 92 | 92 | |
| 93 | 93 | if (($a->isStart() && $b->isEnd()) || ($a->isEnd() && $b->isStart())) { |
| 94 | - if($a->getStart() == $b) { |
|
| 94 | + if ($a->getStart() == $b) { |
|
| 95 | 95 | return 1; |
| 96 | - } elseif($a->getEnd() == $b) { |
|
| 96 | + } elseif ($a->getEnd() == $b) { |
|
| 97 | 97 | return -1; |
| 98 | 98 | } else { |
| 99 | 99 | return $multiplier; |
| 100 | 100 | } |
| 101 | 101 | } elseif (($rule = Helper::cmp($b->_rule->priority, $a->_rule->priority)) !== 0) { |
| 102 | - return $multiplier*$rule; |
|
| 102 | + return $multiplier * $rule; |
|
| 103 | 103 | } elseif (($rule = Helper::cmp($b->index, $a->index)) !== 0) { |
| 104 | - return $multiplier*$rule; |
|
| 104 | + return $multiplier * $rule; |
|
| 105 | 105 | } else { |
| 106 | - return $multiplier*($a->id < $b->id ? -1 : 1); |
|
| 106 | + return $multiplier * ($a->id < $b->id ? -1 : 1); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param $styles |
| 36 | 36 | */ |
| 37 | 37 | public function __construct($styles = false) { |
| 38 | - $this->_styles = $styles ?: include __DIR__.'/../Styles/Cli/Default.php'; |
|
| 38 | + $this->_styles = $styles ?: include __DIR__ . '/../Styles/Cli/Default.php'; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function format(TokenIterator $tokens) |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $last = $token->pos; |
| 57 | 57 | } |
| 58 | - $result .= substr($source, $last).Console::reset(); |
|
| 58 | + $result .= substr($source, $last) . Console::reset(); |
|
| 59 | 59 | |
| 60 | 60 | return $result; |
| 61 | 61 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getLanguage($name) { |
| 51 | 51 | $embedded = []; |
| 52 | - if(($pos = strpos($name, '>')) !== false) { |
|
| 52 | + if (($pos = strpos($name, '>')) !== false) { |
|
| 53 | 53 | $embedded[] = self::getLanguage(trim(substr($name, $pos + 1))); |
| 54 | 54 | $name = trim(substr($name, 0, $pos)); |
| 55 | 55 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | public function highlight($source, $language, FormatterInterface $formatter = null) { |
| 84 | 84 | $formatter = $formatter ?: $this->getDefaultFormatter(); |
| 85 | 85 | |
| 86 | - if(!$language instanceof Language) { |
|
| 86 | + if (!$language instanceof Language) { |
|
| 87 | 87 | $language = $this->getLanguage($language); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | 'INTERSECT', 'INTERVAL', 'INTO', 'IS', 'ITERATE', 'LANGUAGE', 'LARGE', 'LATERAL', 'LEADING', |
| 41 | 41 | 'LEAVE', 'LEFT', 'LIKE', 'LOCAL', 'LOOP', 'MATCH', 'MEMBER', 'MERGE', 'METHOD', 'MODIFIES', |
| 42 | 42 | 'MODULE', 'MONTH', 'MULTISET', 'NATIONAL', 'NATURAL', 'NCHAR', 'NCLOB', 'NEW', 'NO', 'NONE', 'NOT', |
| 43 | - 'OF', 'OLD', 'ON', 'ONLY', 'OPEN', 'OR', 'ORDER', 'OUT','OUTER', 'OUTPUT', 'OVER', |
|
| 43 | + 'OF', 'OLD', 'ON', 'ONLY', 'OPEN', 'OR', 'ORDER', 'OUT', 'OUTER', 'OUTPUT', 'OVER', |
|
| 44 | 44 | 'OVERLAPS', 'PARAMETER', 'PARTITION', 'PRECISION', 'PREPARE', 'PRIMARY', 'PROCEDURE', 'RANGE', 'READS', |
| 45 | 45 | 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'RELEASE', |
| 46 | 46 | 'REPEAT', 'RESIGNAL', 'RESULT', 'RETURN', 'RETURNS', 'REVOKE', 'RIGHT', 'ROLLBACK', 'ROLLUP', 'ROW', |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | public static function rearrange(array $array, array $keys) |
| 22 | 22 | { |
| 23 | - return array_combine($keys, array_map(function ($key) use ($array) { |
|
| 23 | + return array_combine($keys, array_map(function($key) use ($array) { |
|
| 24 | 24 | return $array[$key]; |
| 25 | 25 | }, $keys)); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public static function column(array $array, $index) |
| 29 | 29 | { |
| 30 | - return array_map(function ($e) use ($index) { return $e[$index]; }, $array); |
|
| 30 | + return array_map(function($e) use ($index) { return $e[$index]; }, $array); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public static function find(array $array, callable $tester) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public static function resolve(array $array, $key, $fallback = null) { |
| 45 | 45 | do { |
| 46 | - if(isset($array[$key])) { |
|
| 46 | + if (isset($array[$key])) { |
|
| 47 | 47 | return $array[$key]; |
| 48 | 48 | } |
| 49 | 49 | |