Completed
Push — master ( f08c1d...ffbb02 )
by smiley
02:22
created

Select::sql()   B

Complexity

Conditions 7
Paths 64

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 8.2222
c 0
b 0
f 0
cc 7
eloc 11
nc 64
nop 0
1
<?php
2
/**
3
 *
4
 * @filesource   Select.php
5
 * @created      03.06.2017
6
 * @package      chillerlan\Database\Query\Dialects\MySQL
7
 * @author       Smiley <[email protected]>
8
 * @copyright    2017 Smiley
9
 * @license      MIT
10
 */
11
12
namespace chillerlan\Database\Query\Dialects\MySQL;
13
14
use chillerlan\Database\Query\SelectAbstract;
15
16
/**
17
 * Class Select
18
 */
19
class Select extends SelectAbstract{
20
21
	/**
22
	 * @return string
23
	 */
24
	public function sql():string{
25
#		print_r([$this->cols, $this->from, $this->orderby, $this->groupby, $this->where]);
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
26
27
		$glue = ','.PHP_EOL."\t";
28
#		var_dump($this->bindValues());
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
29
30
		$sql  = 'SELECT ';
31
		$sql .= $this->distinct ? 'DISTINCT ' : '';
32
		$sql .= implode($glue , $this->cols).PHP_EOL;
33
		$sql .= !empty($this->from) ? 'FROM '.implode($glue , $this->from) : '';
34
		$sql .= $this->_getWhere();
35
		$sql .= !empty($this->groupby) ? PHP_EOL.'GROUP BY '.implode($glue, $this->groupby) : '';
36
		$sql .= !empty($this->orderby) ? PHP_EOL.'ORDER BY '.implode($glue, $this->orderby) : '';
37
		$sql .= $this->limit ? PHP_EOL.'LIMIT '.($this->offset ? '?, ?' : '?') : '';
38
39
		return $sql;
40
	}
41
42
}
43