@@ -15,7 +15,7 @@ |
||
15 | 15 | public static function postInstall() |
16 | 16 | { |
17 | 17 | $configPath = __DIR__ . '/../config22/'; |
18 | - mkdir( $configPath, 0777 ); |
|
18 | + mkdir($configPath, 0777); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | * @param QueryBuild $queryBuild |
40 | 40 | * @param null $table |
41 | 41 | */ |
42 | - public function __construct( QueryBuild $queryBuild, $table = null ) |
|
42 | + public function __construct(QueryBuild $queryBuild, $table = null) |
|
43 | 43 | { |
44 | - parent::__construct( $queryBuild, $table ); |
|
44 | + parent::__construct($queryBuild, $table); |
|
45 | 45 | } |
46 | 46 | |
47 | - public function getSyntax( $replacement = self::REPLACEMENT_NONE ) |
|
47 | + public function getSyntax($replacement = self::REPLACEMENT_NONE) |
|
48 | 48 | { |
49 | 49 | |
50 | 50 | $syntax = array(); |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * PRIORITY |
64 | 64 | */ |
65 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
65 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * IGNORE clause |
69 | 69 | */ |
70 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
70 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::IGNORE) ? 'IGNORE' : ''; |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * TABLE update |
74 | 74 | */ |
75 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
75 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::TABLE); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * FIELDS update |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | */ |
95 | 95 | $syntax[] = $this->getLimitSyntax(); |
96 | 96 | |
97 | - $syntax = implode( ' ', $syntax ); |
|
97 | + $syntax = implode(' ', $syntax); |
|
98 | 98 | |
99 | - return $this->getSyntaxReplace( $syntax, $replacement ); |
|
99 | + return $this->getSyntaxReplace($syntax, $replacement); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | { |
109 | 109 | |
110 | 110 | if ( |
111 | - $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && |
|
112 | - !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) |
|
111 | + $this->queryStructure->getElement((QueryStructure::WHERE_TRIGGER)) && |
|
112 | + !count($this->queryStructure->getElement(QueryStructure::WHERE)) |
|
113 | 113 | ) |
114 | - throw new QueryException( 'Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
114 | + throw new QueryException('Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER); |
|
115 | 115 | |
116 | 116 | return DbService::getInstance()->query( |
117 | 117 | $this->getSyntax(), |
118 | - $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) |
|
118 | + $this->queryStructure->getElement(QueryStructure::BIND_PARAMS) |
|
119 | 119 | ); |
120 | 120 | } |
121 | 121 | } |
122 | 122 | \ No newline at end of file |
@@ -110,8 +110,9 @@ |
||
110 | 110 | if ( |
111 | 111 | $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && |
112 | 112 | !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) |
113 | - ) |
|
114 | - throw new QueryException( 'Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
113 | + ) { |
|
114 | + throw new QueryException( 'Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
115 | + } |
|
115 | 116 | |
116 | 117 | return DbService::getInstance()->query( |
117 | 118 | $this->getSyntax(), |
@@ -43,22 +43,22 @@ discard block |
||
43 | 43 | protected $tablePrefix; |
44 | 44 | |
45 | 45 | |
46 | - public function __construct( QueryBuild $queryBuild, $query = '' ) |
|
46 | + public function __construct(QueryBuild $queryBuild, $query = '') |
|
47 | 47 | { |
48 | 48 | $this->queryBuild = $queryBuild; |
49 | 49 | $this->queryStructure = new QueryStructure(); |
50 | - $this->queryStructure->setElement( QueryStructure::STATEMENT, $this->statement ); |
|
51 | - $this->queryStructure->setElement( QueryStructure::QUERY_TYPE, $this->queryBuild->getType() ); |
|
52 | - $this->queryStructure->setElement( QueryStructure::QUERY_STRING, $query ); |
|
50 | + $this->queryStructure->setElement(QueryStructure::STATEMENT, $this->statement); |
|
51 | + $this->queryStructure->setElement(QueryStructure::QUERY_TYPE, $this->queryBuild->getType()); |
|
52 | + $this->queryStructure->setElement(QueryStructure::QUERY_STRING, $query); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @param array $params |
57 | 57 | * @return $this |
58 | 58 | */ |
59 | - public function withBindParams( array $params = [] ) |
|
59 | + public function withBindParams(array $params = []) |
|
60 | 60 | { |
61 | - $this->queryStructure->replaceElement( QueryStructure::BIND_PARAMS, $params ); |
|
61 | + $this->queryStructure->replaceElement(QueryStructure::BIND_PARAMS, $params); |
|
62 | 62 | |
63 | 63 | return $this; |
64 | 64 | } |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @param bool|int $replacement |
68 | 68 | * @return mixed |
69 | 69 | */ |
70 | - public function getSyntax( $replacement = self::REPLACEMENT_NONE ) |
|
70 | + public function getSyntax($replacement = self::REPLACEMENT_NONE) |
|
71 | 71 | { |
72 | - return $this->queryStructure->getElement( QueryStructure::QUERY_STRING ); |
|
72 | + return $this->queryStructure->getElement(QueryStructure::QUERY_STRING); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getBindParams() |
79 | 79 | { |
80 | - return $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ); |
|
80 | + return $this->queryStructure->getElement(QueryStructure::BIND_PARAMS); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | public function execute() |
87 | 87 | { |
88 | 88 | return DbService::getInstance()->query( |
89 | - $this->queryStructure->getElement( QueryStructure::QUERY_STRING ), |
|
90 | - $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) |
|
89 | + $this->queryStructure->getElement(QueryStructure::QUERY_STRING), |
|
90 | + $this->queryStructure->getElement(QueryStructure::BIND_PARAMS) |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * @param bool $replacement |
19 | 19 | * @return string |
20 | 20 | */ |
21 | - public function getSyntax( $replacement = self::REPLACEMENT_NONE ); |
|
21 | + public function getSyntax($replacement = self::REPLACEMENT_NONE); |
|
22 | 22 | |
23 | 23 | public function execute(); |
24 | 24 |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | * @param string $table |
64 | 64 | * @throws QueryException |
65 | 65 | */ |
66 | - public function __construct( QueryBuild $queryBuild, $table = '' ) |
|
66 | + public function __construct(QueryBuild $queryBuild, $table = '') |
|
67 | 67 | { |
68 | 68 | |
69 | - $table = $this->validateTable( $table ); |
|
69 | + $table = $this->validateTable($table); |
|
70 | 70 | |
71 | 71 | $this->queryBuild = $queryBuild; |
72 | 72 | $this->queryStructure = new QueryStructure(); |
73 | - $this->queryStructure->setElement( QueryStructure::TABLE, $table ); |
|
74 | - $this->queryStructure->setElement( QueryStructure::STATEMENT, $this->statement ); |
|
75 | - $this->queryStructure->setElement( QueryStructure::QUERY_TYPE, $this->queryBuild->getType() ); |
|
73 | + $this->queryStructure->setElement(QueryStructure::TABLE, $table); |
|
74 | + $this->queryStructure->setElement(QueryStructure::STATEMENT, $this->statement); |
|
75 | + $this->queryStructure->setElement(QueryStructure::QUERY_TYPE, $this->queryBuild->getType()); |
|
76 | 76 | |
77 | 77 | } |
78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function getBindParams() |
83 | 83 | { |
84 | - return $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ); |
|
84 | + return $this->queryStructure->getElement(QueryStructure::BIND_PARAMS); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | * @param QueryBuild $queryBuild |
37 | 37 | * @param null $table |
38 | 38 | */ |
39 | - public function __construct( QueryBuild $queryBuild, $table = null ) |
|
39 | + public function __construct(QueryBuild $queryBuild, $table = null) |
|
40 | 40 | { |
41 | - parent::__construct( $queryBuild, $table ); |
|
42 | - $this->queryStructure->setElement( QueryStructure::FIELDS, array() ); |
|
41 | + parent::__construct($queryBuild, $table); |
|
42 | + $this->queryStructure->setElement(QueryStructure::FIELDS, array()); |
|
43 | 43 | } |
44 | 44 | |
45 | - public function getSyntax( $replacement = self::REPLACEMENT_NONE ) |
|
45 | + public function getSyntax($replacement = self::REPLACEMENT_NONE) |
|
46 | 46 | { |
47 | 47 | $syntax = array(); |
48 | 48 | |
@@ -59,26 +59,26 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * PRIORITY |
61 | 61 | */ |
62 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
62 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY); |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * IGNORE clause |
66 | 66 | */ |
67 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
67 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::IGNORE) ? 'IGNORE' : ''; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * INTO table |
71 | 71 | */ |
72 | - $syntax[] = 'INTO ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
72 | + $syntax[] = 'INTO ' . $this->queryStructure->getElement(QueryStructure::TABLE); |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * FIELDS update |
76 | 76 | */ |
77 | 77 | $syntax[] = $this->getInsertMultipleRowsSyntax(); |
78 | 78 | |
79 | - $syntax = implode( ' ', $syntax ); |
|
79 | + $syntax = implode(' ', $syntax); |
|
80 | 80 | |
81 | - return $this->getSyntaxReplace( $syntax, $replacement ); |
|
81 | + return $this->getSyntaxReplace($syntax, $replacement); |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | return DbService::getInstance()->query( |
88 | 88 | $this->getSyntax(), |
89 | - $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) |
|
89 | + $this->queryStructure->getElement(QueryStructure::BIND_PARAMS) |
|
90 | 90 | ); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * @param QueryBuild $queryBuild |
37 | 37 | * @param null $table |
38 | 38 | */ |
39 | - public function __construct( QueryBuild $queryBuild, $table = null ) |
|
39 | + public function __construct(QueryBuild $queryBuild, $table = null) |
|
40 | 40 | { |
41 | - parent::__construct( $queryBuild, $table ); |
|
41 | + parent::__construct($queryBuild, $table); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function multiple() |
48 | 48 | { |
49 | - return new QueryInsertMultiple( $this->queryBuild, $this->queryStructure->getElement( QueryStructure::TABLE ) ); |
|
49 | + return new QueryInsertMultiple($this->queryBuild, $this->queryStructure->getElement(QueryStructure::TABLE)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @param bool|int $replacement |
54 | 54 | * @return mixed|string |
55 | 55 | */ |
56 | - public function getSyntax( $replacement = self::REPLACEMENT_NONE ) |
|
56 | + public function getSyntax($replacement = self::REPLACEMENT_NONE) |
|
57 | 57 | { |
58 | 58 | $syntax = array(); |
59 | 59 | |
@@ -70,26 +70,26 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * PRIORITY |
72 | 72 | */ |
73 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
73 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * IGNORE clause |
77 | 77 | */ |
78 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
|
78 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::IGNORE) ? 'IGNORE' : ''; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * INTO table |
82 | 82 | */ |
83 | - $syntax[] = 'INTO ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
83 | + $syntax[] = 'INTO ' . $this->queryStructure->getElement(QueryStructure::TABLE); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * FIELDS update |
87 | 87 | */ |
88 | 88 | $syntax[] = $this->getSettingFieldsSyntax(); |
89 | 89 | |
90 | - $syntax = implode( ' ', $syntax ); |
|
90 | + $syntax = implode(' ', $syntax); |
|
91 | 91 | |
92 | - return $this->getSyntaxReplace( $syntax, $replacement ); |
|
92 | + return $this->getSyntaxReplace($syntax, $replacement); |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | return DbService::getInstance()->query( |
100 | 100 | $this->getSyntax(), |
101 | - $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) |
|
101 | + $this->queryStructure->getElement(QueryStructure::BIND_PARAMS) |
|
102 | 102 | ); |
103 | 103 | } |
104 | 104 |
@@ -42,21 +42,21 @@ discard block |
||
42 | 42 | * @param QueryBuild $queryBuild |
43 | 43 | * @param string|QueryStatement $table |
44 | 44 | */ |
45 | - public function __construct( QueryBuild $queryBuild, $table ) |
|
45 | + public function __construct(QueryBuild $queryBuild, $table) |
|
46 | 46 | { |
47 | - parent::__construct( $queryBuild, $table ); |
|
47 | + parent::__construct($queryBuild, $table); |
|
48 | 48 | |
49 | - if ( is_a( $table, QuerySelect::class ) ) { |
|
49 | + if (is_a($table, QuerySelect::class)) { |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @var QuerySelect $table |
53 | 53 | */ |
54 | 54 | $tableName = '( ' . $table->getSyntax() . ' )'; |
55 | - $this->queryStructure->setElement( QueryStructure::TABLE, $tableName ); |
|
55 | + $this->queryStructure->setElement(QueryStructure::TABLE, $tableName); |
|
56 | 56 | |
57 | 57 | $tableSelectParams = $table->getBindParams(); |
58 | - foreach ( $tableSelectParams as $key => $value ) |
|
59 | - $this->queryStructure->setParams( $key, $value ); |
|
58 | + foreach ($tableSelectParams as $key => $value) |
|
59 | + $this->queryStructure->setParams($key, $value); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function first() |
68 | 68 | { |
69 | - $this->queryStructure->setElement( QueryStructure::FIRST, 1 ); |
|
69 | + $this->queryStructure->setElement(QueryStructure::FIRST, 1); |
|
70 | 70 | |
71 | 71 | return $this; |
72 | 72 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function count() |
78 | 78 | { |
79 | - $this->queryStructure->setElement( QueryStructure::COUNT, 1 ); |
|
79 | + $this->queryStructure->setElement(QueryStructure::COUNT, 1); |
|
80 | 80 | |
81 | 81 | return $this; |
82 | 82 | } |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | * @param $column |
86 | 86 | * @return $this |
87 | 87 | */ |
88 | - public function column( $column ) |
|
88 | + public function column($column) |
|
89 | 89 | { |
90 | - $column = QueryHelper::clearMultipleSpaces( $column ); |
|
91 | - $this->queryStructure->setElement( QueryStructure::COLUMN, $column ); |
|
90 | + $column = QueryHelper::clearMultipleSpaces($column); |
|
91 | + $this->queryStructure->setElement(QueryStructure::COLUMN, $column); |
|
92 | 92 | |
93 | 93 | return $this; |
94 | 94 | } |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | * @param bool|int $replacement |
99 | 99 | * @return mixed|string |
100 | 100 | */ |
101 | - public function getSyntax( $replacement = self::REPLACEMENT_NONE ) |
|
101 | + public function getSyntax($replacement = self::REPLACEMENT_NONE) |
|
102 | 102 | { |
103 | 103 | |
104 | - if ( $this->queryStructure->getElement( QueryStructure::COUNT ) ) { |
|
105 | - $this->queryStructure->setElement( QueryStructure::FIELDS, 'COUNT(*)' ); |
|
106 | - $this->queryStructure->setElement( QueryStructure::LIMIT, 1 ); |
|
107 | - $this->queryStructure->setElement( QueryStructure::DISTINCT, 0 ); //??? |
|
104 | + if ($this->queryStructure->getElement(QueryStructure::COUNT)) { |
|
105 | + $this->queryStructure->setElement(QueryStructure::FIELDS, 'COUNT(*)'); |
|
106 | + $this->queryStructure->setElement(QueryStructure::LIMIT, 1); |
|
107 | + $this->queryStructure->setElement(QueryStructure::DISTINCT, 0); //??? |
|
108 | 108 | } |
109 | 109 | |
110 | - if ( $this->queryStructure->getElement( QueryStructure::FIRST ) ) |
|
111 | - $this->queryStructure->setElement( QueryStructure::LIMIT, 1 ); |
|
110 | + if ($this->queryStructure->getElement(QueryStructure::FIRST)) |
|
111 | + $this->queryStructure->setElement(QueryStructure::LIMIT, 1); |
|
112 | 112 | |
113 | 113 | $syntax = array(); |
114 | 114 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * PRIORITY |
127 | 127 | */ |
128 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
128 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * DISTINCT clause |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | /** |
136 | 136 | * FIELDS |
137 | 137 | */ |
138 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::FIELDS ); |
|
138 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::FIELDS); |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * FROM table or queryStructure |
142 | 142 | */ |
143 | - $syntax[] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
143 | + $syntax[] = 'FROM ' . $this->queryStructure->getElement(QueryStructure::TABLE); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * JOIN CLAUSES |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | */ |
173 | 173 | $syntax[] = $this->getLimitSyntax(); |
174 | 174 | |
175 | - $syntax = implode( ' ', $syntax ); |
|
175 | + $syntax = implode(' ', $syntax); |
|
176 | 176 | |
177 | - return $this->getSyntaxReplace( $syntax, $replacement ); |
|
177 | + return $this->getSyntaxReplace($syntax, $replacement); |
|
178 | 178 | |
179 | 179 | } |
180 | 180 | |
@@ -185,21 +185,21 @@ discard block |
||
185 | 185 | public function execute() |
186 | 186 | { |
187 | 187 | |
188 | - switch ( true ) { |
|
189 | - case $this->queryStructure->getElement( QueryStructure::COUNT ): |
|
190 | - return DbService::getInstance()->single( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
|
188 | + switch (true) { |
|
189 | + case $this->queryStructure->getElement(QueryStructure::COUNT): |
|
190 | + return DbService::getInstance()->single($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS)); |
|
191 | 191 | break; |
192 | - case $this->queryStructure->getElement( QueryStructure::FIRST ): |
|
193 | - if ( $this->queryStructure->getElement( QueryStructure::COLUMN ) ) |
|
194 | - return DbService::getInstance()->single( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
|
192 | + case $this->queryStructure->getElement(QueryStructure::FIRST): |
|
193 | + if ($this->queryStructure->getElement(QueryStructure::COLUMN)) |
|
194 | + return DbService::getInstance()->single($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS)); |
|
195 | 195 | |
196 | - return DbService::getInstance()->row( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
|
196 | + return DbService::getInstance()->row($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS)); |
|
197 | 197 | break; |
198 | - case $this->queryStructure->getElement( QueryStructure::COLUMN ): |
|
199 | - return DbService::getInstance()->column( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
|
198 | + case $this->queryStructure->getElement(QueryStructure::COLUMN): |
|
199 | + return DbService::getInstance()->column($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS)); |
|
200 | 200 | break; |
201 | 201 | default: |
202 | - return DbService::getInstance()->query( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
|
202 | + return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS)); |
|
203 | 203 | break; |
204 | 204 | } |
205 | 205 | } |
@@ -55,8 +55,9 @@ discard block |
||
55 | 55 | $this->queryStructure->setElement( QueryStructure::TABLE, $tableName ); |
56 | 56 | |
57 | 57 | $tableSelectParams = $table->getBindParams(); |
58 | - foreach ( $tableSelectParams as $key => $value ) |
|
59 | - $this->queryStructure->setParams( $key, $value ); |
|
58 | + foreach ( $tableSelectParams as $key => $value ) { |
|
59 | + $this->queryStructure->setParams( $key, $value ); |
|
60 | + } |
|
60 | 61 | |
61 | 62 | } |
62 | 63 | } |
@@ -107,8 +108,9 @@ discard block |
||
107 | 108 | $this->queryStructure->setElement( QueryStructure::DISTINCT, 0 ); //??? |
108 | 109 | } |
109 | 110 | |
110 | - if ( $this->queryStructure->getElement( QueryStructure::FIRST ) ) |
|
111 | - $this->queryStructure->setElement( QueryStructure::LIMIT, 1 ); |
|
111 | + if ( $this->queryStructure->getElement( QueryStructure::FIRST ) ) { |
|
112 | + $this->queryStructure->setElement( QueryStructure::LIMIT, 1 ); |
|
113 | + } |
|
112 | 114 | |
113 | 115 | $syntax = array(); |
114 | 116 | |
@@ -190,8 +192,9 @@ discard block |
||
190 | 192 | return DbService::getInstance()->single( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
191 | 193 | break; |
192 | 194 | case $this->queryStructure->getElement( QueryStructure::FIRST ): |
193 | - if ( $this->queryStructure->getElement( QueryStructure::COLUMN ) ) |
|
194 | - return DbService::getInstance()->single( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
|
195 | + if ( $this->queryStructure->getElement( QueryStructure::COLUMN ) ) { |
|
196 | + return DbService::getInstance()->single( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
|
197 | + } |
|
195 | 198 | |
196 | 199 | return DbService::getInstance()->row( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) ); |
197 | 200 | break; |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | * @param QueryBuild $queryBuild |
41 | 41 | * @param null $table |
42 | 42 | */ |
43 | - public function __construct( QueryBuild $queryBuild, $table = null ) |
|
43 | + public function __construct(QueryBuild $queryBuild, $table = null) |
|
44 | 44 | { |
45 | - parent::__construct( $queryBuild, $table ); |
|
45 | + parent::__construct($queryBuild, $table); |
|
46 | 46 | } |
47 | 47 | |
48 | - public function getSyntax( $replacement = self::REPLACEMENT_NONE ) |
|
48 | + public function getSyntax($replacement = self::REPLACEMENT_NONE) |
|
49 | 49 | { |
50 | 50 | $syntax = array(); |
51 | 51 | |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * PRIORITY |
64 | 64 | */ |
65 | - $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
|
65 | + $syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * TABLE update |
69 | 69 | */ |
70 | - $syntax[] = 'FROM ' . $this->queryStructure->getElement( QueryStructure::TABLE ); |
|
70 | + $syntax[] = 'FROM ' . $this->queryStructure->getElement(QueryStructure::TABLE); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * WHERE clause |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | */ |
85 | 85 | $syntax[] = $this->getLimitSyntax(); |
86 | 86 | |
87 | - $syntax = implode( ' ', $syntax ); |
|
87 | + $syntax = implode(' ', $syntax); |
|
88 | 88 | |
89 | - return $this->getSyntaxReplace( $syntax, $replacement ); |
|
89 | + return $this->getSyntaxReplace($syntax, $replacement); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | { |
98 | 98 | |
99 | 99 | if ( |
100 | - $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && |
|
101 | - !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) |
|
100 | + $this->queryStructure->getElement((QueryStructure::WHERE_TRIGGER)) && |
|
101 | + !count($this->queryStructure->getElement(QueryStructure::WHERE)) |
|
102 | 102 | ) |
103 | - throw new QueryException( 'Where or Having clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
103 | + throw new QueryException('Where or Having clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER); |
|
104 | 104 | |
105 | 105 | return DbService::getInstance()->query( |
106 | 106 | $this->getSyntax(), |
107 | - $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) |
|
107 | + $this->queryStructure->getElement(QueryStructure::BIND_PARAMS) |
|
108 | 108 | ); |
109 | 109 | |
110 | 110 | } |
@@ -99,8 +99,9 @@ |
||
99 | 99 | if ( |
100 | 100 | $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && |
101 | 101 | !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) |
102 | - ) |
|
103 | - throw new QueryException( 'Where or Having clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
102 | + ) { |
|
103 | + throw new QueryException( 'Where or Having clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER ); |
|
104 | + } |
|
104 | 105 | |
105 | 106 | return DbService::getInstance()->query( |
106 | 107 | $this->getSyntax(), |