Total Complexity | 7 |
Total Lines | 67 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class Select extends Query |
||
15 | { |
||
16 | /** @var string[] */ |
||
17 | public $columns; |
||
18 | |||
19 | /** @var Where */ |
||
20 | public $where; |
||
21 | |||
22 | /** @var Limit */ |
||
23 | public $limit; |
||
24 | |||
25 | /** @var OrderBy */ |
||
26 | protected $orderBy; |
||
27 | |||
28 | public function __construct(RepositoryInterface $repository) |
||
29 | { |
||
30 | parent::__construct($repository); |
||
31 | $this->init(); |
||
32 | } |
||
33 | |||
34 | protected function init() |
||
40 | } |
||
41 | |||
42 | /** @return string */ |
||
43 | public function toString() |
||
44 | { |
||
45 | return 'SELECT ' . implode(',', $this->columns) . ' FROM ' |
||
46 | . $this->table |
||
47 | . $this->where |
||
48 | . $this->orderBy |
||
49 | . $this->limit; |
||
50 | } |
||
51 | |||
52 | /** @return mixed[] */ |
||
53 | public function getValues() |
||
56 | } |
||
57 | |||
58 | /** @return int */ |
||
59 | public function count() |
||
60 | { |
||
61 | $this->columns = ['count(*)']; |
||
62 | $stmt = $this->conn->stmt($this, $this->getValues()); |
||
63 | $this->init(); |
||
64 | |||
65 | return $stmt->fetchColumn(); |
||
66 | } |
||
67 | |||
68 | /** @return mixed[] */ |
||
69 | public function execute() |
||
75 | } |
||
76 | |||
77 | /** @param string $orderBy */ |
||
78 | public function orderBy($orderBy) |
||
83 |