Issues (3627)

bundles/ReportBundle/Event/ReportQueryEvent.php (1 issue)

1
<?php
2
3
/*
4
 * @copyright   2018 Mautic Contributors. All rights reserved
5
 * @author      Mautic
6
 *
7
 * @link        http://mautic.org
8
 *
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\ReportBundle\Event;
13
14
use Doctrine\DBAL\Query\QueryBuilder;
15
use Mautic\ReportBundle\Entity\Report;
16
17
/**
18
 * Class ReportDataEvent.
19
 */
20
class ReportQueryEvent extends AbstractReportEvent
21
{
22
    /**
23
     * @var QueryBuilder
24
     */
25
    private $query;
26
27
    /**
28
     * @var array
29
     */
30
    private $options = [];
31
32
    /**
33
     * @var int
34
     */
35
    private $totalResults = 0;
36
37
    /**
38
     * ReportDataEvent constructor.
39
     *
40
     * @param $totalResults
41
     */
42
    public function __construct(Report $report, QueryBuilder $query, $totalResults, array $options)
43
    {
44
        $this->context      = $report->getSource();
45
        $this->report       = $report;
46
        $this->query        = $query;
47
        $this->options      = $options;
48
        $this->totalResults = (int) $totalResults;
49
    }
50
51
    /**
52
     * @return array
53
     */
54
    public function getQuery()
55
    {
56
        return $this->query;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->query returns the type Doctrine\DBAL\Query\QueryBuilder which is incompatible with the documented return type array.
Loading history...
57
    }
58
59
    /**
60
     * @param QueryBuilder $query
61
     *
62
     * @return ReportDataEvent
63
     */
64
    public function setQuery($query)
65
    {
66
        $this->query = $query;
67
    }
68
69
    /**
70
     * @return array
71
     */
72
    public function getOptions()
73
    {
74
        return $this->options;
75
    }
76
77
    /**
78
     * @return int
79
     */
80
    public function getTotalResults()
81
    {
82
        return $this->totalResults;
83
    }
84
}
85