Queue::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Equip\Queue;
4
5
use Equip\Command\OptionsInterface;
6
use Equip\Queue\Driver\DriverInterface;
7
8
class Queue
9
{
10
    /**
11
     * @var DriverInterface
12
     */
13
    private $driver;
14
15
    /**
16
     * @param DriverInterface $driver
17
     */
18 1
    public function __construct(DriverInterface $driver)
19
    {
20 1
        $this->driver = $driver;
21 1
    }
22
23
    /**
24
     * Add a message to the queue
25
     *
26
     * @param string $queue
27
     * @param string $command
28
     *
29
     * @return bool
30
     */
31 1
    public function add($queue, $command)
32
    {
33 1
        return $this->driver->enqueue($queue, $command);
0 ignored issues
show
Documentation introduced by
$command is of type string, but the function expects a object.

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...
34
    }
35
}
36