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.

BannerRepository   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A findByChannelAndTaxon() 0 3 1
A findByTaxon() 0 3 1
A findByChannel() 0 3 1
A findByEnabledQueryBuilder() 0 22 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusBannerPlugin\Repository;
6
7
use Doctrine\ORM\QueryBuilder;
8
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
9
use Sylius\Component\Channel\Model\ChannelInterface;
10
use Sylius\Component\Taxonomy\Model\TaxonInterface;
11
12
class BannerRepository extends EntityRepository implements BannerRepositoryInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function findByEnabledQueryBuilder(?ChannelInterface $channel, ?TaxonInterface $taxon): QueryBuilder
18
    {
19
        $queryBuilder = $this->createQueryBuilder('b')
20
            ->andWhere('b.enabled = :enabled')
21
            ->setParameter('enabled', true)
22
        ;
23
24
        if ($channel instanceof ChannelInterface) {
25
            $queryBuilder->innerJoin('b.channels', 'channel')
26
                ->andWhere('channel = :channel')
27
                ->setParameter('channel', $channel)
28
            ;
29
        }
30
31
        if ($taxon instanceof TaxonInterface) {
32
            $queryBuilder->innerJoin('b.taxons', 'taxon')
33
                ->andWhere('taxon = :taxon')
34
                ->setParameter('taxon', $taxon)
35
            ;
36
        }
37
38
        return $queryBuilder;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function findByChannel(ChannelInterface $channel): array
45
    {
46
        return $this->findByEnabledQueryBuilder($channel, null)->getQuery()->getResult();
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function findByTaxon(TaxonInterface $taxon): array
53
    {
54
        return $this->findByEnabledQueryBuilder(null, $taxon)->getQuery()->getResult();
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function findByChannelAndTaxon(ChannelInterface $channel, TaxonInterface $taxon): array
61
    {
62
        return $this->findByEnabledQueryBuilder($channel, $taxon)->getQuery()->getResult();
63
    }
64
}
65