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.
Passed
Push — master ( 8da90f...aec830 )
by
unknown
05:51
created

BannerRepository::findByTaxon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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) {
25
            $queryBuilder->innerJoin('b.channels', 'channel')
26
                ->andWhere('channel = :channel')
27
                ->setParameter('channel', $channel)
28
            ;
29
        }
30
31
        if ($taxon) {
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