Passed
Push — master ( ff59f5...a77bae )
by Dāvis
07:04
created

MobileExtension::getFunctions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Sludio\HelperBundle\Mobile\Twig;
4
5
use Sludio\HelperBundle\Script\Twig\TwigTrait;
6
7
class MobileExtension extends \Twig_Extension
8
{
9
    use TwigTrait;
10
11
    public $detector;
12
13
    public function __construct($shortFunctions)
14
    {
15
        $this->shortFunctions = $shortFunctions;
16
        $this->detector = new \Mobile_Detect();
0 ignored issues
show
Bug introduced by
The type Mobile_Detect was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
    }
18
19
    public function getFunctions()
20
    {
21
        $input = [
22
            'is_mobile' => [
23
                $this->detector,
24
                'isMobile',
25
            ],
26
            'is_tablet' => [
27
                $this->detector,
28
                'isTablet',
29
            ],
30
        ];
31
32
        return $this->makeArray($input, 'function');
33
    }
34
}
35