@@ 195-210 (lines=16) @@ | ||
192 | * |
|
193 | * @throws Exceptions\CompileException |
|
194 | */ |
|
195 | public function macroIsDevice(MacroNode $node, PhpWriter $writer) : string |
|
196 | { |
|
197 | $arguments = self::prepareMacroArguments($node->args); |
|
198 | ||
199 | if ($arguments['device'] === NULL) { |
|
200 | throw new Exceptions\CompileException('Please provide device name.'); |
|
201 | } |
|
202 | ||
203 | // Create magic method name |
|
204 | $magicMethodName = 'is' . ucfirst(strtolower((string) $arguments["device"])); |
|
205 | ||
206 | return $writer->write(' |
|
207 | $_resultMD = property_exists($this, "filters") ? %escape(call_user_func($this->filters->isDevice, "' . $arguments['device'] . '")) : $template->getMobileDetectService()->'. $magicMethodName.'(); |
|
208 | if ($_resultMD) { |
|
209 | '); |
|
210 | } |
|
211 | ||
212 | /** |
|
213 | * @param MacroNode $node |
|
@@ 220-235 (lines=16) @@ | ||
217 | * |
|
218 | * @throws Exceptions\CompileException |
|
219 | */ |
|
220 | public function macroIsOS(MacroNode $node, PhpWriter $writer) : string |
|
221 | { |
|
222 | $arguments = self::prepareMacroArguments($node->args); |
|
223 | ||
224 | if ($arguments['os'] === NULL) { |
|
225 | throw new Exceptions\CompileException('Please provide OS name.'); |
|
226 | } |
|
227 | ||
228 | // Create magic method name |
|
229 | $magicMethodName = 'is' . ucfirst(strtolower((string) $arguments["os"])); |
|
230 | ||
231 | return $writer->write(' |
|
232 | $_resultMD = property_exists($this, "filters") ? %escape(call_user_func($this->filters->isOs, "' . $arguments['os'] . '")) : $template->getMobileDetectService()->'. $magicMethodName.'(); |
|
233 | if ($_resultMD) { |
|
234 | '); |
|
235 | } |
|
236 | ||
237 | /** |
|
238 | * {isFullView /} |