@@ -197,7 +197,7 @@ |
||
197 | 197 | /** |
198 | 198 | * Get the result object returned by PHP's MySQLi |
199 | 199 | * |
200 | - * @return \Pdostatement |
|
200 | + * @return \mysqli_result |
|
201 | 201 | * |
202 | 202 | * @codeCoverageIgnore |
203 | 203 | */ |
@@ -142,7 +142,7 @@ |
||
142 | 142 | } elseif (is_float($value)) { |
143 | 143 | // Convert to non-locale aware float to prevent possible commas |
144 | 144 | return sprintf('%F', $value); |
145 | - } elseif (is_array($value)) { |
|
145 | + } elseif (is_array($value)) { |
|
146 | 146 | // Supports MVA attributes |
147 | 147 | return '('.implode(',', $this->quoteArr($value)).')'; |
148 | 148 | } |
@@ -110,7 +110,7 @@ |
||
110 | 110 | */ |
111 | 111 | public function key() |
112 | 112 | { |
113 | - return (int)$this->cursor; |
|
113 | + return (int) $this->cursor; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | |
48 | 48 | $stm = $this->connection->prepare($query); |
49 | 49 | |
50 | - try{ |
|
50 | + try { |
|
51 | 51 | $stm->execute(); |
52 | 52 | } |
53 | - catch(\PDOException $exception){ |
|
54 | - throw new DatabaseException($exception->getMessage() . ' [' . $query . ']'); |
|
53 | + catch (\PDOException $exception) { |
|
54 | + throw new DatabaseException($exception->getMessage().' ['.$query.']'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return new ResultSet($stm); |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | |
68 | 68 | $dsn = 'mysql:'; |
69 | 69 | if (isset($params['host']) && $params['host'] != '') { |
70 | - $dsn .= 'host=' . $params['host'] . ';'; |
|
70 | + $dsn .= 'host='.$params['host'].';'; |
|
71 | 71 | } |
72 | 72 | if (isset($params['port'])) { |
73 | - $dsn .= 'port=' . $params['port'] . ';'; |
|
73 | + $dsn .= 'port='.$params['port'].';'; |
|
74 | 74 | } |
75 | 75 | if (isset($params['charset'])) { |
76 | - $dsn .= 'charset=' . $params['charset'] . ';'; |
|
76 | + $dsn .= 'charset='.$params['charset'].';'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if (isset($params['socket']) && $params['socket'] != '') { |
80 | - $dsn .= 'unix_socket=' . $params['socket'] . ';'; |
|
80 | + $dsn .= 'unix_socket='.$params['socket'].';'; |
|
81 | 81 | } |
82 | 82 | |
83 | - if (!$suppress_error && ! $this->silence_connection_warning) { |
|
83 | + if (!$suppress_error && !$this->silence_connection_warning) { |
|
84 | 84 | try { |
85 | 85 | $con = new \Pdo($dsn); |
86 | 86 | } catch (\PDOException $exception) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | throw new ConnectionException($exception->getMessage()); |
94 | 94 | } |
95 | 95 | } |
96 | - if(!isset($con)) |
|
96 | + if (!isset($con)) |
|
97 | 97 | { |
98 | 98 | throw new ConnectionException('connection error'); |
99 | 99 | } |
@@ -131,24 +131,24 @@ discard block |
||
131 | 131 | $result = array(); |
132 | 132 | $count = 0; |
133 | 133 | |
134 | - if(version_compare(PHP_VERSION, '5.4.0', '>=')) |
|
134 | + if (version_compare(PHP_VERSION, '5.4.0', '>=')) |
|
135 | 135 | { |
136 | 136 | try { |
137 | 137 | $statement = $this->connection->query(implode(';', $queue)); |
138 | 138 | } catch (\PDOException $exception) { |
139 | - throw new DatabaseException($exception->getMessage() .' [ '.implode(';', $queue).']'); |
|
139 | + throw new DatabaseException($exception->getMessage().' [ '.implode(';', $queue).']'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return new MultiResultSet($statement); |
143 | 143 | } |
144 | 144 | else |
145 | 145 | { |
146 | - foreach($queue as $sql) |
|
146 | + foreach ($queue as $sql) |
|
147 | 147 | { |
148 | 148 | try { |
149 | 149 | $statement = $this->connection->query($sql); |
150 | 150 | } catch (\PDOException $exception) { |
151 | - throw new DatabaseException($exception->getMessage() .' [ '.implode(';', $queue).']'); |
|
151 | + throw new DatabaseException($exception->getMessage().' [ '.implode(';', $queue).']'); |
|
152 | 152 | } |
153 | 153 | if ($statement->columnCount()) { |
154 | 154 | $set = new ResultSet($statement); |
@@ -49,8 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | try{ |
51 | 51 | $stm->execute(); |
52 | - } |
|
53 | - catch(\PDOException $exception){ |
|
52 | + } catch(\PDOException $exception){ |
|
54 | 53 | throw new DatabaseException($exception->getMessage() . ' [' . $query . ']'); |
55 | 54 | } |
56 | 55 | |
@@ -140,8 +139,7 @@ discard block |
||
140 | 139 | } |
141 | 140 | |
142 | 141 | return new MultiResultSet($statement); |
143 | - } |
|
144 | - else |
|
142 | + } else |
|
145 | 143 | { |
146 | 144 | foreach($queue as $sql) |
147 | 145 | { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param string $query The query string |
40 | 40 | * |
41 | 41 | * @throws DatabaseException |
42 | - * @return array|int The result array or number of rows affected |
|
42 | + * @return ResultSet The result array or number of rows affected |
|
43 | 43 | */ |
44 | 44 | public function query($query) |
45 | 45 | { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | /** |
118 | 118 | * @param array $queue |
119 | - * @return array |
|
119 | + * @return MultiResultSet |
|
120 | 120 | * @throws DatabaseException |
121 | 121 | * @throws SphinxQLException |
122 | 122 | */ |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | - if (!$suppress_error && ! $this->silence_connection_warning) { |
|
66 | + if (!$suppress_error && !$this->silence_connection_warning) { |
|
67 | 67 | $conn->real_connect($data['host'], null, null, null, (int) $data['port'], $data['socket']); |
68 | 68 | } else { |
69 | 69 | @ $conn->real_connect($data['host'], null, null, null, (int) $data['port'], $data['socket']); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function hasNextRow() |
38 | 38 | { |
39 | 39 | return $this->current_row === null |
40 | - ? (boolean)$this->num_rows |
|
40 | + ? (boolean) $this->num_rows |
|
41 | 41 | : $this->current_row + 1 < $this->num_rows; |
42 | 42 | } |
43 | 43 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function key() |
165 | 165 | { |
166 | - return (int)$this->current_row; |
|
166 | + return (int) $this->current_row; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -623,7 +623,7 @@ |
||
623 | 623 | } elseif (is_array($option['value'])) { |
624 | 624 | array_walk( |
625 | 625 | $option['value'], |
626 | - function (&$val, $key) { |
|
626 | + function(&$val, $key) { |
|
627 | 627 | $val = $key.'='.$val; |
628 | 628 | } |
629 | 629 | ); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | // user variables must always be processed as arrays |
160 | - if ($user_var && ! is_array($value)) { |
|
160 | + if ($user_var && !is_array($value)) { |
|
161 | 161 | $query .= '= ('.$this->getConnection()->quote($value).')'; |
162 | 162 | } elseif (is_array($value)) { |
163 | 163 | $query .= '= ('.implode(', ', $this->getConnection()->quoteArr($value)).')'; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function attachIndex($disk_index, $rt_index) |
262 | 262 | { |
263 | 263 | return $this->query('ATTACH INDEX '.$this->getConnection()->quoteIdentifier($disk_index). |
264 | - ' TO RTINDEX '. $this->getConnection()->quoteIdentifier($rt_index)); |
|
264 | + ' TO RTINDEX '.$this->getConnection()->quoteIdentifier($rt_index)); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | - if (!$suppress_error && ! $this->silence_connection_warning) { |
|
66 | + if (!$suppress_error && !$this->silence_connection_warning) { |
|
67 | 67 | $conn->real_connect($data['host'], null, null, null, (int) $data['port'], $data['socket']); |
68 | 68 | } else { |
69 | 69 | @ $conn->real_connect($data['host'], null, null, null, (int) $data['port'], $data['socket']); |