@@ -70,21 +70,19 @@ discard block |
||
70 | 70 | public function languageByName($name, $params = []) |
71 | 71 | { |
72 | 72 | return isset($this->_languages['name'][$name]) ? |
73 | - $this->_languages['name'][$name]($params) : |
|
74 | - new PlainText($params); |
|
73 | + $this->_languages['name'][$name]($params) : new PlainText($params); |
|
75 | 74 | } |
76 | 75 | |
77 | 76 | public function languageByMime($mime, $params = []) |
78 | 77 | { |
79 | 78 | return isset($this->_languages['mime'][$mime]) ? |
80 | - $this->_languages['mime'][$mime]($params) : |
|
81 | - new PlainText($params); |
|
79 | + $this->_languages['mime'][$mime]($params) : new PlainText($params); |
|
82 | 80 | } |
83 | 81 | |
84 | 82 | public function languageByExt($filename, $params = []) |
85 | 83 | { |
86 | - foreach($this->_languages['extension'] as $mask => $class) { |
|
87 | - if(fnmatch($mask, $filename)) { |
|
84 | + foreach ($this->_languages['extension'] as $mask => $class) { |
|
85 | + if (fnmatch($mask, $filename)) { |
|
88 | 86 | return $class($params); |
89 | 87 | } |
90 | 88 | } |
@@ -110,7 +108,7 @@ discard block |
||
110 | 108 | |
111 | 109 | public function registeredLanguages($by = 'name', $class = false) |
112 | 110 | { |
113 | - return array_map(function ($e) use($class) { |
|
111 | + return array_map(function($e) use($class) { |
|
114 | 112 | return $e([])->getFQN($class); |
115 | 113 | }, $this->_languages[$by]); |
116 | 114 | } |
@@ -150,7 +148,7 @@ discard block |
||
150 | 148 | |
151 | 149 | public function init() |
152 | 150 | { |
153 | - foreach(include __DIR__.'/Config/metadata.php' as $alias) { |
|
151 | + foreach (include __DIR__.'/Config/metadata.php' as $alias) { |
|
154 | 152 | $class = $alias[0]; |
155 | 153 | unset($alias[0]); |
156 | 154 | |
@@ -166,13 +164,13 @@ discard block |
||
166 | 164 | */ |
167 | 165 | public function register($class, array $options) |
168 | 166 | { |
169 | - if(!is_callable($class) && is_subclass_of($class, Language::class)) { |
|
167 | + if (!is_callable($class) && is_subclass_of($class, Language::class)) { |
|
170 | 168 | $class = function($arguments = []) use ($class) { |
171 | 169 | return new $class($arguments); |
172 | 170 | }; |
173 | 171 | } |
174 | 172 | |
175 | - foreach(array_intersect_key($options, array_flip(['name', 'mime', 'extension'])) as $name => $values) { |
|
173 | + foreach (array_intersect_key($options, array_flip(['name', 'mime', 'extension'])) as $name => $values) { |
|
176 | 174 | $this->_languages[$name] = array_merge($this->_languages[$name], array_fill_keys($values, $class)); |
177 | 175 | } |
178 | 176 | } |
@@ -36,14 +36,14 @@ |
||
36 | 36 | new OpenRule(new RegexMatcher('/(<[\w\.-]+)[:\/>:\s]/')), |
37 | 37 | new CloseRule(new SubStringMatcher('>'), ['context' => ['!string', '!comment']]) |
38 | 38 | ], |
39 | - 'tag.close' => new Rule(new RegexMatcher('/(<\/' . self::IDENTIFIER . '>)/')), |
|
39 | + 'tag.close' => new Rule(new RegexMatcher('/(<\/'.self::IDENTIFIER.'>)/')), |
|
40 | 40 | |
41 | - 'symbol.tag' => new Rule(new RegexMatcher('/<\\/?' . self::IDENTIFIER . '/', [ |
|
41 | + 'symbol.tag' => new Rule(new RegexMatcher('/<\\/?'.self::IDENTIFIER.'/', [ |
|
42 | 42 | 'name' => Token::NAME, |
43 | 43 | 'namespace' => '$.namespace' |
44 | 44 | ]), ['context' => ['tag', '!string']]), |
45 | 45 | |
46 | - 'symbol.attribute' => new Rule(new RegexMatcher('/' . self::IDENTIFIER . '=/', [ |
|
46 | + 'symbol.attribute' => new Rule(new RegexMatcher('/'.self::IDENTIFIER.'=/', [ |
|
47 | 47 | 'name' => Token::NAME, |
48 | 48 | 'namespace' => '$.namespace' |
49 | 49 | ]), ['context' => ['tag', '!string']]), |