BrandRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A findByPhrase() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Loevgaard\SyliusBrandPlugin\Doctrine\ORM;
6
7
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
8
9
class BrandRepository extends EntityRepository implements BrandRepositoryInterface
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function findByPhrase(string $phrase): array
15
    {
16
        return $this->createQueryBuilder('o')
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->createQuer...getQuery()->getResult() could return the type integer which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
17
            ->andWhere('o.name LIKE :phrase OR o.code LIKE :phrase')
18
            ->setParameter('phrase', '%' . $phrase . '%')
19
            ->getQuery()
20
            ->getResult()
21
            ;
22
    }
23
}
24