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.
Completed
Push — master ( 0b01a7...3b0906 )
by Odiseo
08:33
created

NumberOfOrdersDataFetcher::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 13
nc 1
nop 1
dl 0
loc 21
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
namespace Odiseo\SyliusReportPlugin\DataFetcher;
4
5
use Odiseo\SyliusReportPlugin\Form\Type\DataFetcher\NumberOfOrdersType;
6
use Sylius\Component\Core\OrderPaymentStates;
7
use Sylius\Component\Order\Model\Order;
8
9
/**
10
 * @author Łukasz Chruściel <[email protected]>
11
 * @author Diego D'amico <[email protected]>
12
 */
13
class NumberOfOrdersDataFetcher extends TimePeriodDataFetcher
14
{
15
    protected function setupQueryFilter(array $configuration = []): void
16
    {
17
        $qb = $this->queryFilter->getQueryBuilder();
18
19
        $qb
20
            ->select('DATE(payment.updatedAt) as date', 'COUNT(o.id) as NumberOfOrders')
21
            ->from(Order::class, 'o')
22
        ;
23
        $this->queryFilter->addLeftJoin('o.items', 'oi');
24
        $this->queryFilter->addLeftJoin('oi.variant', 'v');
25
        $this->queryFilter->addLeftJoin('v.product', 'p');
26
        $this->queryFilter->addLeftJoin('p.productTaxons', 'pt');
27
        $this->queryFilter->addLeftJoin('o.customer', 'c');
28
        $this->queryFilter->addLeftJoin('c.user', 'user');
29
        $this->queryFilter->addLeftJoin('o.payments', 'payment');
30
31
        $qb
32
            ->where($qb->expr()->eq('o.payment_state', OrderPaymentStates::STATE_PAID))
33
        ;
34
35
        $this->queryFilter->addTimePeriod($configuration);
36
        $this->queryFilter->addChannel($configuration, 'o.channel');
37
        $this->queryFilter->addUserGender($configuration);
38
        $this->queryFilter->addUserCountry($configuration, 'shipping');
39
        $this->queryFilter->addUserCity($configuration, 'shipping');
40
        $this->queryFilter->addUserProvince($configuration, 'shipping');
41
        $this->queryFilter->addUserPostcode($configuration, 'shipping');
42
        $this->queryFilter->addUserCountry($configuration, 'billing');
43
        $this->queryFilter->addUserCity($configuration, 'billing');
44
        $this->queryFilter->addUserProvince($configuration, 'billing');
45
        $this->queryFilter->addUserPostcode($configuration, 'billing');
46
        $this->queryFilter->addProduct($configuration);
47
        $this->queryFilter->addProductBrand($configuration);
48
        $this->queryFilter->addProductCategory($configuration);
49
        $this->queryFilter->addOrderNumbers($configuration);
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function getType(): string
56
    {
57
        return NumberOfOrdersType::class;
58
    }
59
}
60