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