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.

AddressRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 18
c 1
b 0
f 1
dl 0
loc 40
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findByProvinceName() 0 9 1
A findByPostcode() 0 7 1
A findByCityName() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusReportPlugin\Repository;
6
7
use Sylius\Bundle\CoreBundle\Doctrine\ORM\AddressRepository as BaseAddressRepository;
8
use Sylius\Component\Addressing\Model\Province;
9
10
/**
11
 * @author Diego D'amico <[email protected]>
12
 */
13
class AddressRepository extends BaseAddressRepository implements AddressRepositoryInterface
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public function findByCityName(string $cityName): array
19
    {
20
        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...
21
            ->andWhere('o.city LIKE :city')
22
            ->setParameter('city', '%' . $cityName . '%')
23
            ->getQuery()
24
            ->getResult()
25
        ;
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public function findByProvinceName(string $provinceName): array
32
    {
33
        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...
34
            ->leftJoin(Province::class, 'p', 'WITH', 'p.code = o.provinceCode')
35
            ->where('o.provinceName LIKE :province')
36
            ->orWhere('p.name LIKE :province')
37
            ->setParameter('province', '%' . $provinceName . '%')
38
            ->getQuery()
39
            ->getResult()
40
        ;
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46
    public function findByPostcode(string $postcode): array
47
    {
48
        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...
49
            ->andWhere('o.postcode LIKE :postcode')
50
            ->setParameter('postcode', '%' . $postcode . '%')
51
            ->getQuery()
52
            ->getResult()
53
        ;
54
    }
55
}
56