@@ -7,8 +7,8 @@ |
||
7 | 7 | public static function init() |
8 | 8 | { |
9 | 9 | date_default_timezone_set('Europe/Moscow'); |
10 | - error_reporting( E_ALL ); |
|
11 | - ini_set('display_errors',1); |
|
10 | + error_reporting(E_ALL); |
|
11 | + ini_set('display_errors', 1); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -20,21 +20,21 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - private $degenerations=[]; |
|
23 | + private $degenerations = []; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Query constructor. |
27 | 27 | * @param $sql |
28 | 28 | * @param array $degenerations |
29 | 29 | */ |
30 | - public function __construct($sql,$degenerations=[]) |
|
30 | + public function __construct($sql, $degenerations = []) |
|
31 | 31 | { |
32 | 32 | if (!trim($sql)) |
33 | 33 | { |
34 | 34 | throw new QueryException('Empty Query'); |
35 | 35 | } |
36 | 36 | $this->sql = $sql; |
37 | - $this->degenerations=$degenerations; |
|
37 | + $this->degenerations = $degenerations; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | { |
51 | 51 | // FORMAT\s(\w)*$ |
52 | 52 | if (null === $this->format) return false; |
53 | - $supportFormats= |
|
53 | + $supportFormats = |
|
54 | 54 | "FORMAT\\s+TSV|FORMAT\\s+TSVRaw|FORMAT\\s+TSVWithNames|FORMAT\\s+TSVWithNamesAndTypes|FORMAT\\s+Vertical|FORMAT\\s+JSONCompact|FORMAT\\s+JSONEachRow|FORMAT\\s+TSKV|FORMAT\\s+TabSeparatedWithNames|FORMAT\\s+TabSeparatedWithNamesAndTypes|FORMAT\\s+TabSeparatedRaw|FORMAT\\s+BlockTabSeparated|FORMAT\\s+CSVWithNames|FORMAT\\s+CSV|FORMAT\\s+JSON|FORMAT\\s+TabSeparated"; |
55 | 55 | |
56 | - $matches=[]; |
|
57 | - if (preg_match_all('%('.$supportFormats.')%ius',$this->sql,$matches)){ |
|
56 | + $matches = []; |
|
57 | + if (preg_match_all('%(' . $supportFormats . ')%ius', $this->sql, $matches)) { |
|
58 | 58 | |
59 | 59 | // skip add "format json" |
60 | 60 | if (isset($matches[0])) |
61 | 61 | { |
62 | 62 | |
63 | - $this->format=trim(str_ireplace('format','',$matches[0][0])); |
|
63 | + $this->format = trim(str_ireplace('format', '', $matches[0][0])); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | foreach ($this->degenerations as $degeneration) |
96 | 96 | { |
97 | 97 | if ($degeneration instanceof Degeneration) { |
98 | - $this->sql=$degeneration->process($this->sql); |
|
98 | + $this->sql = $degeneration->process($this->sql); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |