Searcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A search() 0 4 1
1
<?php
2
3
namespace ClientBundle\Searcher;
4
5
use ClientBundle\Repository\ClientRepository;
6
7
/**
8
 * Class Searcher
9
 */
10
class Searcher
11
{
12
    private $repository;
13
14
    /**
15
     * Searcher constructor.
16
     * @param ClientRepository $repository
17
     */
18
    public function __construct(ClientRepository $repository)
19
    {
20
        $this->repository = $repository;
21
    }
22
23
    /**
24
     * @param string $tags
25
     * @return array
26
     */
27
    public function search($tags)
28
    {
29
        return $this->repository->getIdArrayByTags($tags);
0 ignored issues
show
Documentation introduced by
$tags is of type string, but the function expects a object<ClientBundle\Entity\Tags>.

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...
30
    }
31
}
32