GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 037104...b3593d )
by
unknown
10s
created

ChainTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testFilter() 0 9 1
A testGetExceptionWithInvalidFilter() 0 5 1
1
<?php
2
namespace HtImgModuleTest\Imagine\Filter;
3
4
use Imagine\Gd\Imagine;
5
use HtImgModule\Imagine\Filter\Background;
6
use HtImgModule\Imagine\Filter\Chain;
7
8
class ChainTest extends \PHPUnit_Framework_TestCase
9
{
10
    public function testFilter()
11
    {
12
        $imagine = new Imagine();
13
        $filter1 = new Background($imagine, [1050, 1060], '#ddd');
14
        $filter2 = new Background($imagine, [1550, 1560], '#bbb');
15
        $chain = new Chain([$filter1, $filter2]);
16
        $archos = $imagine->open('resources/Archos.jpg');
17
        $chain->apply($archos);
18
    }
19
20
    public function testGetExceptionWithInvalidFilter()
21
    {
22
        $this->setExpectedException('HtImgModule\Exception\InvalidArgumentException');
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
23
        $chain = new Chain(['asdf', 'asdfsdf']);
0 ignored issues
show
Documentation introduced by
array('asdf', 'asdfsdf') is of type array<integer,string,{"0":"string","1":"string"}>, but the function expects a array<integer,object<Ima...ilter\FilterInterface>>.

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...
Unused Code introduced by
$chain is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
24
    }
25
}
26