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

SalesTotalDataFetcher::getData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 26
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

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