Passed
Push — master ( d44413...7ff405 )
by Adrian
04:24
created
src/Traits/DefaultPriority.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      */
23 23
     public function defaultPriority()
24 24
     {
25
-        $this->queryStructure->setElement(QueryStructure::PRIORITY, '');
25
+        $this->queryStructure->setElement( QueryStructure::PRIORITY, '' );
26 26
 
27 27
         return $this;
28 28
     }
Please login to merge, or discard this patch.
src/Dependencies/QueryHelper.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
      * @param string $string
16 16
      * @return mixed|string
17 17
      */
18
-    public static function clearMultipleSpaces($string = '')
18
+    public static function clearMultipleSpaces( $string = '' )
19 19
     {
20
-        $string = preg_replace('/\s+/', ' ', $string);
21
-        $string = trim($string);
20
+        $string = preg_replace( '/\s+/', ' ', $string );
21
+        $string = trim( $string );
22 22
 
23 23
         return $string;
24 24
     }
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
      * @param $val
28 28
      * @return bool
29 29
      */
30
-    public static function isInteger($val)
30
+    public static function isInteger( $val )
31 31
     {
32
-        $val = trim($val);
32
+        $val = trim( $val );
33 33
 
34
-        return is_numeric($val) && floor($val) == $val;
34
+        return is_numeric( $val ) && floor( $val ) == $val;
35 35
     }
36 36
 
37 37
     /**
@@ -39,34 +39,34 @@  discard block
 block discarded – undo
39 39
      * @return bool
40 40
      * @i
41 41
      */
42
-    public static function isDecimal($val)
42
+    public static function isDecimal( $val )
43 43
     {
44
-        $val = trim($val);
44
+        $val = trim( $val );
45 45
 
46
-        return is_numeric($val) && floor($val) != $val;
46
+        return is_numeric( $val ) && floor( $val ) != $val;
47 47
     }
48 48
 
49
-    public static function isValidOrderBy($order_by_parameter)
49
+    public static function isValidOrderBy( $order_by_parameter )
50 50
     {
51 51
 
52
-        $columns = array('first_name', 'last_name', 'zip', 'created_at');
52
+        $columns = array( 'first_name', 'last_name', 'zip', 'created_at' );
53 53
 
54
-        $parts = preg_split("/[\s,]+/", $order_by_parameter);
54
+        $parts = preg_split( "/[\s,]+/", $order_by_parameter );
55 55
 
56
-        foreach ($parts as $part) {
57
-            $subparts = preg_split("/\s+/", $part);
56
+        foreach ( $parts as $part ) {
57
+            $subparts = preg_split( "/\s+/", $part );
58 58
 
59
-            if (count($subparts) < 0 || count($subparts) > 2) {
59
+            if ( count( $subparts ) < 0 || count( $subparts ) > 2 ) {
60 60
                 // Too many or too few parts.
61 61
                 return false;
62 62
             }
63 63
 
64
-            if (!in_array($subparts[0], $columns)) {
64
+            if ( !in_array( $subparts[ 0 ], $columns ) ) {
65 65
                 // Column name is invalid.
66 66
                 return false;
67 67
             }
68 68
 
69
-            if (count($subparts) == 2 && !in_array(strtoupper($subparts[1]), array('ASC', 'DESC'))) {
69
+            if ( count( $subparts ) == 2 && !in_array( strtoupper( $subparts[ 1 ] ), array( 'ASC', 'DESC' ) ) ) {
70 70
                 // ASC or DESC is invalid
71 71
                 return false;
72 72
             }
@@ -81,24 +81,24 @@  discard block
 block discarded – undo
81 81
      * @param string $delimiter
82 82
      * @return array
83 83
      */
84
-    public static function explode($string, $delimiter = ',')
84
+    public static function explode( $string, $delimiter = ',' )
85 85
     {
86
-        $brutArray = explode($delimiter, $string);
86
+        $brutArray = explode( $delimiter, $string );
87 87
         $newArray = array();
88
-        foreach ($brutArray as $value) {
89
-            $value = trim($value);
90
-            if ('' !== $value)
91
-                $newArray[] = $value;
88
+        foreach ( $brutArray as $value ) {
89
+            $value = trim( $value );
90
+            if ( '' !== $value )
91
+                $newArray[ ] = $value;
92 92
         }
93 93
 
94 94
         return $newArray;
95 95
     }
96 96
 
97
-    public static function alphaNum($string)
97
+    public static function alphaNum( $string )
98 98
     {
99
-        $string = preg_replace("/[^a-zA-Z0-9 _,]+/", "", $string);
99
+        $string = preg_replace( "/[^a-zA-Z0-9 _,]+/", "", $string );
100 100
 
101
-        return self::clearMultipleSpaces($string);
101
+        return self::clearMultipleSpaces( $string );
102 102
     }
103 103
 
104 104
     /**
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
      * @param string $delimiter
107 107
      * @return string
108 108
      */
109
-    public static function implode(array $array, $delimiter = ',')
109
+    public static function implode( array $array, $delimiter = ',' )
110 110
     {
111
-        $string = implode($delimiter, $array);
112
-        $string = trim($string);
113
-        $string = trim($string, trim($delimiter));
114
-        $string = trim($string);
111
+        $string = implode( $delimiter, $array );
112
+        $string = trim( $string );
113
+        $string = trim( $string, trim( $delimiter ) );
114
+        $string = trim( $string );
115 115
 
116 116
         return $string;
117 117
     }
@@ -120,36 +120,36 @@  discard block
 block discarded – undo
120 120
      * @param $string
121 121
      * @return mixed|string
122 122
      */
123
-    public static function clearQuotes($string)
123
+    public static function clearQuotes( $string )
124 124
     {
125
-        $search = array('"', "'");
125
+        $search = array( '"', "'" );
126 126
         $replace = '';
127
-        $string = str_replace($search, $replace, $string);
127
+        $string = str_replace( $search, $replace, $string );
128 128
 
129
-        return self::clearMultipleSpaces($string);
129
+        return self::clearMultipleSpaces( $string );
130 130
     }
131 131
 
132 132
     /**
133 133
      * @param int $length
134 134
      * @return string
135 135
      */
136
-    public static function random($length = 5)
136
+    public static function random( $length = 5 )
137 137
     {
138 138
         $characters = 'abcdefghijklmnopqrstuvwxyz';
139
-        $charactersLength = strlen($characters);
139
+        $charactersLength = strlen( $characters );
140 140
         $randomString = '';
141
-        for ($i = 0; $i < $length; $i++)
142
-            $randomString .= $characters[ rand(0, $charactersLength - 1) ];
141
+        for ( $i = 0; $i < $length; $i++ )
142
+            $randomString .= $characters[ rand( 0, $charactersLength - 1 ) ];
143 143
 
144
-        return str_shuffle($randomString);
144
+        return str_shuffle( $randomString );
145 145
     }
146 146
 
147
-    public static function limitString($rowCount, $offset = null)
147
+    public static function limitString( $rowCount, $offset = null )
148 148
     {
149
-        $rowCount = intval($rowCount);
150
-        if (is_null($offset))
149
+        $rowCount = intval( $rowCount );
150
+        if ( is_null( $offset ) )
151 151
             return $rowCount;
152
-        $offset = intval($offset);
152
+        $offset = intval( $offset );
153 153
 
154 154
         return "$offset, $rowCount";
155 155
     }
Please login to merge, or discard this patch.
src/Dependencies/QueryTimer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function __construct()
29 29
     {
30
-        $this->queryStart = microtime(true);
30
+        $this->queryStart = microtime( true );
31 31
     }
32 32
 
33 33
     /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function getDuration()
37 37
     {
38
-        $this->queryEnd = microtime(true);
38
+        $this->queryEnd = microtime( true );
39 39
 
40 40
         return $this->queryEnd - $this->queryStart;
41 41
     }
Please login to merge, or discard this patch.
src/Dependencies/QueryStructure.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     /**
61 61
      * @var array
62 62
      */
63
-    private static $usedInstanceIds = [];
63
+    private static $usedInstanceIds = [ ];
64 64
 
65 65
     /**
66 66
      * @var array
@@ -85,24 +85,24 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $this->syntaxEL = $this->init();
87 87
 
88
-        foreach ($this->syntaxEL as $name => $value)
89
-            $this->typeEL[ $name ] = gettype($value);
88
+        foreach ( $this->syntaxEL as $name => $value )
89
+            $this->typeEL[ $name ] = gettype( $value );
90 90
 
91 91
     }
92 92
 
93 93
     private function init()
94 94
     {
95
-        return [self::TABLE => '', self::EXPLAIN => 0, self::STATEMENT => '', self::PRIORITY => '', self::FIELDS => '*', self::SET_FIELDS => array(), self::WHERE => array(), self::HAVING => array(), self::WHERE_INVERT => 0, self::HAVING_INVERT => 0, self::LIMIT => 0, self::ORDER_BY => array(), self::GROUP_BY => array(), self::COUNT => 0, self::COLUMN => '', self::FIRST => 0, self::DISTINCT => 0, self::JOIN => array(), self::IGNORE => 0, self::MULTIPLE_ROWS => 0, self::QUERY => '', self::BIND_PARAMS => array(), self::REPLACEMENT => 0, self::QUERY_TYPE => 0, self::QUERY_STRING => '', self::QUERY_COMMENT => '', self::QUERY_IDENTIFIER => 'DEFAULT', self::WHERE_TRIGGER => 1, self::INSTANCE => $this->makeStatementInstance()];
95
+        return [ self::TABLE => '', self::EXPLAIN => 0, self::STATEMENT => '', self::PRIORITY => '', self::FIELDS => '*', self::SET_FIELDS => array(), self::WHERE => array(), self::HAVING => array(), self::WHERE_INVERT => 0, self::HAVING_INVERT => 0, self::LIMIT => 0, self::ORDER_BY => array(), self::GROUP_BY => array(), self::COUNT => 0, self::COLUMN => '', self::FIRST => 0, self::DISTINCT => 0, self::JOIN => array(), self::IGNORE => 0, self::MULTIPLE_ROWS => 0, self::QUERY => '', self::BIND_PARAMS => array(), self::REPLACEMENT => 0, self::QUERY_TYPE => 0, self::QUERY_STRING => '', self::QUERY_COMMENT => '', self::QUERY_IDENTIFIER => 'DEFAULT', self::WHERE_TRIGGER => 1, self::INSTANCE => $this->makeStatementInstance() ];
96 96
     }
97 97
 
98 98
 
99 99
     private function makeStatementInstance()
100 100
     {
101
-        $instance = QueryHelper::random(5);
102
-        while (in_array($instance, self::$usedInstanceIds)) {
103
-            $instance = QueryHelper::random(7);
101
+        $instance = QueryHelper::random( 5 );
102
+        while ( in_array( $instance, self::$usedInstanceIds ) ) {
103
+            $instance = QueryHelper::random( 7 );
104 104
         }
105
-        self::$usedInstanceIds[] = $instance;
105
+        self::$usedInstanceIds[ ] = $instance;
106 106
 
107 107
         return $instance;
108 108
     }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     /**
129 129
      * @param $elements
130 130
      */
131
-    public function setAllElements($elements)
131
+    public function setAllElements( $elements )
132 132
     {
133 133
         $this->syntaxEL = $elements;
134 134
     }
@@ -140,16 +140,16 @@  discard block
 block discarded – undo
140 140
      * @return bool
141 141
      * @throws QueryException
142 142
      */
143
-    public function setElement($name, $value)
143
+    public function setElement( $name, $value )
144 144
     {
145
-        if (!array_key_exists($name, $this->syntaxEL))
146
-            throw new QueryException('Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND);
145
+        if ( !array_key_exists( $name, $this->syntaxEL ) )
146
+            throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND );
147 147
 
148
-        if ($name == self::TABLE && is_a($value, QueryStatement::class))
148
+        if ( $name == self::TABLE && is_a( $value, QueryStatement::class ) )
149 149
             return true;
150 150
 
151
-        if ($this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY)
152
-            $this->syntaxEL[ $name ][] = $value; else
151
+        if ( $this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY )
152
+            $this->syntaxEL[ $name ][ ] = $value; else
153 153
             $this->syntaxEL[ $name ] = $value;
154 154
 
155 155
         return true;
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
      * @param $elementValue
162 162
      * @throws QueryException
163 163
      */
164
-    public function replaceElement($elementName, $elementValue)
164
+    public function replaceElement( $elementName, $elementValue )
165 165
     {
166
-        if (!array_key_exists($elementName, $this->syntaxEL))
167
-            throw new QueryException('Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND);
166
+        if ( !array_key_exists( $elementName, $this->syntaxEL ) )
167
+            throw new QueryException( 'Invalid Query property', QueryException::QUERY_ERROR_ELEMENT_NOT_FOUND );
168 168
 
169 169
         $this->syntaxEL[ $elementName ] = $elementValue;
170 170
     }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param string $name
175 175
      * @return mixed
176 176
      */
177
-    public function getElement($name)
177
+    public function getElement( $name )
178 178
     {
179 179
         return $this->syntaxEL[ $name ];
180 180
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      * @param $name
185 185
      * @param $value
186 186
      */
187
-    public function setParams($name, $value)
187
+    public function setParams( $name, $value )
188 188
     {
189 189
         $this->syntaxEL[ QueryStructure::BIND_PARAMS ][ $name ] = $value;
190 190
     }
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
      * @param $value
196 196
      * @return string
197 197
      */
198
-    public function bindParam($name, $value)
198
+    public function bindParam( $name, $value )
199 199
     {
200
-        $pdoName = $this->index($name);
200
+        $pdoName = $this->index( $name );
201 201
         $this->syntaxEL[ QueryStructure::BIND_PARAMS ][ $pdoName ] = $value;
202 202
 
203 203
         return ':' . $pdoName;
@@ -210,27 +210,27 @@  discard block
 block discarded – undo
210 210
      * @param string $search
211 211
      * @return string
212 212
      */
213
-    public function bindParamsExpression($expression, array $params = [], $search = '?')
213
+    public function bindParamsExpression( $expression, array $params = [ ], $search = '?' )
214 214
     {
215
-        if (!count($params))
215
+        if ( !count( $params ) )
216 216
             return $expression;
217 217
 
218
-        if (strpos($expression, $search) === false)
218
+        if ( strpos( $expression, $search ) === false )
219 219
             return $expression;
220 220
 
221
-        $params = array_slice($params, 0, substr_count($expression, $search));
221
+        $params = array_slice( $params, 0, substr_count( $expression, $search ) );
222 222
 
223 223
         $i = 0;
224
-        $arrayReturn = [];
225
-        $expressionToArray = explode($search, $expression);
224
+        $arrayReturn = [ ];
225
+        $expressionToArray = explode( $search, $expression );
226 226
 
227
-        foreach ($expressionToArray as $sub) {
228
-            $arrayReturn[] = $sub;
229
-            $arrayReturn[] = array_key_exists($i, $params) ? $this->bindParam('exp', $params[ $i ]) : '';
227
+        foreach ( $expressionToArray as $sub ) {
228
+            $arrayReturn[ ] = $sub;
229
+            $arrayReturn[ ] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : '';
230 230
             $i++;
231 231
         }
232 232
 
233
-        return implode('', $arrayReturn);
233
+        return implode( '', $arrayReturn );
234 234
     }
235 235
 
236 236
 
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
      * @param string $fieldName
239 239
      * @return string
240 240
      */
241
-    public function index($fieldName = '')
241
+    public function index( $fieldName = '' )
242 242
     {
243
-        return trim($fieldName) . '_' . $this->syntaxEL[ self::INSTANCE ] . '_' . ++$this->counter . 'i';
243
+        return trim( $fieldName ) . '_' . $this->syntaxEL[ self::INSTANCE ] . '_' . ++$this->counter . 'i';
244 244
     }
245 245
 
246 246
 }
247 247
\ No newline at end of file
Please login to merge, or discard this patch.
src/QueryBuild.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      * QueryBuild constructor.
27 27
      * @param $queryType
28 28
      */
29
-    protected function __construct($queryType)
29
+    protected function __construct( $queryType )
30 30
     {
31 31
         $this->queryType = $queryType;
32 32
     }
@@ -35,45 +35,45 @@  discard block
 block discarded – undo
35 35
      * @param $table
36 36
      * @return QuerySelect
37 37
      */
38
-    public static function select($table)
38
+    public static function select( $table )
39 39
     {
40
-        return new QuerySelect(new QueryBuild(0), $table);
40
+        return new QuerySelect( new QueryBuild( 0 ), $table );
41 41
     }
42 42
 
43 43
     /**
44 44
      * @param $table
45 45
      * @return QueryUpdate
46 46
      */
47
-    public static function update($table)
47
+    public static function update( $table )
48 48
     {
49
-        return new QueryUpdate(new QueryBuild(0), $table);
49
+        return new QueryUpdate( new QueryBuild( 0 ), $table );
50 50
     }
51 51
 
52 52
     /**
53 53
      * @param $table
54 54
      * @return QueryInsert
55 55
      */
56
-    public static function insert($table)
56
+    public static function insert( $table )
57 57
     {
58
-        return new QueryInsert(new QueryBuild(0), $table);
58
+        return new QueryInsert( new QueryBuild( 0 ), $table );
59 59
     }
60 60
 
61 61
     /**
62 62
      * @param $table
63 63
      * @return QueryDelete
64 64
      */
65
-    public static function delete($table)
65
+    public static function delete( $table )
66 66
     {
67
-        return new QueryDelete(new QueryBuild(0), $table);
67
+        return new QueryDelete( new QueryBuild( 0 ), $table );
68 68
     }
69 69
 
70 70
     /**
71 71
      * @param $query
72 72
      * @return QueryCustom
73 73
      */
74
-    public static function query($query)
74
+    public static function query( $query )
75 75
     {
76
-        return new QueryCustom(new QueryBuild(1), $query);
76
+        return new QueryCustom( new QueryBuild( 1 ), $query );
77 77
     }
78 78
 
79 79
     /**
Please login to merge, or discard this patch.
src/Statements/QuerySelect.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -42,21 +42,21 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,83 +98,83 @@  discard block
 block discarded – undo
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
 
115 115
         /**
116 116
          *  Explain
117 117
          */
118
-        $syntax[] = $this->getExplainSyntax();
118
+        $syntax[ ] = $this->getExplainSyntax();
119 119
 
120 120
         /**
121 121
          * SELECT statement
122 122
          */
123
-        $syntax[] = $this->statement;
123
+        $syntax[ ] = $this->statement;
124 124
 
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
132 132
          */
133
-        $syntax[] = $this->getDistinctSyntax();
133
+        $syntax[ ] = $this->getDistinctSyntax();
134 134
 
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
147 147
          */
148
-        $syntax[] = $this->getJoinSyntax();
148
+        $syntax[ ] = $this->getJoinSyntax();
149 149
 
150 150
         /**
151 151
          * WHERE clause
152 152
          */
153
-        $syntax[] = $this->getWhereSyntax();
153
+        $syntax[ ] = $this->getWhereSyntax();
154 154
 
155 155
         /**
156 156
          * GROUP BY clause
157 157
          */
158
-        $syntax[] = $this->getGroupBySyntax();
158
+        $syntax[ ] = $this->getGroupBySyntax();
159 159
 
160 160
         /**
161 161
          * HAVING clause
162 162
          */
163
-        $syntax[] = $this->getHavingSyntax();
163
+        $syntax[ ] = $this->getHavingSyntax();
164 164
 
165 165
         /**
166 166
          * ORDER BY clause
167 167
          */
168
-        $syntax[] = $this->getOrderBySyntax();
168
+        $syntax[ ] = $this->getOrderBySyntax();
169 169
 
170 170
         /**
171 171
          * LIMIT clause
172 172
          */
173
-        $syntax[] = $this->getLimitSyntax();
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Statements/QueryCustom.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     /**
36 36
      * @var array
37 37
      */
38
-    protected $usedInstanceIds = [];
38
+    protected $usedInstanceIds = [ ];
39 39
 
40 40
     /**
41 41
      * @var string
@@ -48,22 +48,22 @@  discard block
 block discarded – undo
48 48
      * @param QueryBuild $queryBuild
49 49
      * @param string $query
50 50
      */
51
-    public function __construct(QueryBuild $queryBuild, $query = '')
51
+    public function __construct( QueryBuild $queryBuild, $query = '' )
52 52
     {
53 53
         $this->queryBuild = $queryBuild;
54 54
         $this->queryStructure = new QueryStructure();
55
-        $this->queryStructure->setElement(QueryStructure::STATEMENT, $this->statement);
56
-        $this->queryStructure->setElement(QueryStructure::QUERY_TYPE, $this->queryBuild->getType());
57
-        $this->queryStructure->setElement(QueryStructure::QUERY_STRING, $query);
55
+        $this->queryStructure->setElement( QueryStructure::STATEMENT, $this->statement );
56
+        $this->queryStructure->setElement( QueryStructure::QUERY_TYPE, $this->queryBuild->getType() );
57
+        $this->queryStructure->setElement( QueryStructure::QUERY_STRING, $query );
58 58
     }
59 59
 
60 60
     /**
61 61
      * @param array $params
62 62
      * @return $this
63 63
      */
64
-    public function withBindParams(array $params = [])
64
+    public function withBindParams( array $params = [ ] )
65 65
     {
66
-        $this->queryStructure->replaceElement(QueryStructure::BIND_PARAMS, $params);
66
+        $this->queryStructure->replaceElement( QueryStructure::BIND_PARAMS, $params );
67 67
 
68 68
         return $this;
69 69
     }
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
      * @param bool|int $replacement
73 73
      * @return mixed
74 74
      */
75
-    public function getSyntax($replacement = self::REPLACEMENT_NONE)
75
+    public function getSyntax( $replacement = self::REPLACEMENT_NONE )
76 76
     {
77
-        return $this->queryStructure->getElement(QueryStructure::QUERY_STRING);
77
+        return $this->queryStructure->getElement( QueryStructure::QUERY_STRING );
78 78
     }
79 79
 
80 80
     /**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function getBindParams()
84 84
     {
85
-        return $this->queryStructure->getElement(QueryStructure::BIND_PARAMS);
85
+        return $this->queryStructure->getElement( QueryStructure::BIND_PARAMS );
86 86
     }
87 87
 
88 88
     /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function execute()
92 92
     {
93
-        return DbService::getInstance()->query($this->queryStructure->getElement(QueryStructure::QUERY_STRING), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
93
+        return DbService::getInstance()->query( $this->queryStructure->getElement( QueryStructure::QUERY_STRING ), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) );
94 94
     }
95 95
 
96 96
 
Please login to merge, or discard this patch.
src/Statements/QueryUpdate.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
      * @param QueryBuild $queryBuild
40 40
      * @param string $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();
@@ -52,51 +52,51 @@  discard block
 block discarded – undo
52 52
         /**
53 53
          *  Explain
54 54
          */
55
-        $syntax[] = $this->getExplainSyntax();
55
+        $syntax[ ] = $this->getExplainSyntax();
56 56
 
57 57
         /**
58 58
          * UPDATE statement
59 59
          */
60
-        $syntax[] = $this->statement;
60
+        $syntax[ ] = $this->statement;
61 61
 
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
79 79
          */
80
-        $syntax[] = $this->getSettingFieldsSyntax();
80
+        $syntax[ ] = $this->getSettingFieldsSyntax();
81 81
 
82 82
         /**
83 83
          * WHERE clause
84 84
          */
85
-        $syntax[] = $this->getWhereSyntax();
85
+        $syntax[ ] = $this->getWhereSyntax();
86 86
 
87 87
         /**
88 88
          * ORDER BY clause
89 89
          */
90
-        $syntax[] = $this->getOrderBySyntax();
90
+        $syntax[ ] = $this->getOrderBySyntax();
91 91
 
92 92
         /**
93 93
          * LIMIT clause
94 94
          */
95
-        $syntax[] = $this->getLimitSyntax();
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
 
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function execute()
108 108
     {
109
-        if ($this->queryStructure->getElement((QueryStructure::WHERE_TRIGGER)) && !count($this->queryStructure->getElement(QueryStructure::WHERE)))
110
-            throw new QueryException('Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER);
109
+        if ( $this->queryStructure->getElement( ( QueryStructure::WHERE_TRIGGER ) ) && !count( $this->queryStructure->getElement( QueryStructure::WHERE ) ) )
110
+            throw new QueryException( 'Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER );
111 111
 
112
-        return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
112
+        return DbService::getInstance()->query( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) );
113 113
     }
114 114
 }
115 115
\ No newline at end of file
Please login to merge, or discard this patch.
src/Statements/QueryInsert.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
      * @param QueryBuild $queryBuild
37 37
      * @param string $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,57 +46,57 @@  discard block
 block discarded – undo
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
 
60 60
         /**
61 61
          *  Explain
62 62
          */
63
-        $syntax[] = $this->getExplainSyntax();
63
+        $syntax[ ] = $this->getExplainSyntax();
64 64
 
65 65
         /**
66 66
          * UPDATE statement
67 67
          */
68
-        $syntax[] = $this->statement;
68
+        $syntax[ ] = $this->statement;
69 69
 
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
-        $syntax[] = $this->getSettingFieldsSyntax();
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
 
96 96
 
97 97
     public function execute()
98 98
     {
99
-        return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
99
+        return DbService::getInstance()->query( $this->getSyntax(), $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ) );
100 100
     }
101 101
 
102 102
 
Please login to merge, or discard this patch.