ArgumentInstanceOf::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Mock\Argument;
6
7
use PHPUnit\Framework\Assert;
8
9
class ArgumentInstanceOf implements ArgumentInterface
10
{
11
    /**
12
     * @var string
13
     */
14
    private $class;
15
16
    public function __construct(string $class)
17
    {
18
        $this->class = $class;
19 2
    }
20
21 2
    /**
22 2
     * @param mixed $argument
23
     */
24
    public function assert($argument, array $context)
25
    {
26
        Assert::assertInstanceOf(
27
            $this->class,
28 2
            $argument,
29
            sprintf(
30 2
                'Method "%s" on class "%s" at call %d, argument %d',
31 2
                $context['method'],
32 2
                $context['class'],
33 2
                $context['at'],
34 2
                $context['index']
35 2
            )
36 2
        );
37 2
    }
38
}
39