| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 2 | public function __invoke($name) |
|
| 28 | { |
||
| 29 | 2 | $pos = strrpos($name, self::PHP_EXT); |
|
| 30 | 2 | $mobileFile = substr($name, 0, $pos) . self::MOBILE_EXT; |
|
| 31 | 2 | $detect = new \Mobile_Detect(null, $this->userAgent); |
|
| 32 | 2 | $isMobile = $detect->isMobile() && ! $detect->isTablet(); |
|
| 33 | 2 | if ($isMobile && file_exists($mobileFile)) { |
|
| 34 | 1 | return $mobileFile; |
|
| 35 | } |
||
| 36 | 1 | $file = substr($name, 0, $pos) . self::TWIG_EXT; |
|
| 37 | |||
| 38 | 1 | return $file; |
|
| 39 | } |
||
| 40 | } |
||
| 41 |