TwitalFormulaLoader   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A load() 0 4 1
1
<?php
2
3
namespace Goetas\TwitalBundle\Assetic;
4
5
use Assetic\Extension\Twig\TwigFormulaLoader;
6
use Assetic\Factory\Resource\ResourceInterface;
7
use Goetas\Twital\TwitalLoader;
8
use Goetas\TwitalBundle\Assetic\Resource\TwitalResource;
9
use Twig\Environment;
10
11
/**
12
 *
13
 * @author Asmir Mustafic <[email protected]>
14
 *
15
 */
16
class TwitalFormulaLoader extends TwigFormulaLoader
17
{
18
19
    private $twital;
20 1
21
    public function __construct(TwitalLoader $twital, Environment $twig)
22 1
    {
23 1
        $this->twital = $twital;
24 1
        parent::__construct($twig);
0 ignored issues
show
Documentation introduced by
$twig is of type object<Twig\Environment>, but the function expects a object<Twig_Environment>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
25
    }
26 1
27
    public function load(ResourceInterface $resource)
28 1
    {
29
        return parent::load(new TwitalResource($this->twital, $resource));
30
    }
31
}
32