@@ -135,28 +135,24 @@ |
||
135 | 135 | { |
136 | 136 | $param->setData($data); |
137 | 137 | $this->_nextPageList = null; |
138 | - } |
|
139 | - else |
|
138 | + } else |
|
140 | 139 | { |
141 | 140 | $param->setData(array_slice($data, 0, $pageSize)); |
142 | 141 | $this->_nextPageList = array_slice($data, $pageSize - 1, $total); |
143 | 142 | } |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | { |
147 | 145 | if($total <= $pageSize) |
148 | 146 | { |
149 | 147 | $this->_prevPageList = array_slice($data, 0, $total); |
150 | 148 | $param->setData([]); |
151 | 149 | $this->_nextPageList = null; |
152 | - } |
|
153 | - elseif($total <= $pageSize * 2) |
|
150 | + } elseif($total <= $pageSize * 2) |
|
154 | 151 | { |
155 | 152 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
156 | 153 | $param->setData(array_slice($data, $pageSize, $total)); |
157 | 154 | $this->_nextPageList = null; |
158 | - } |
|
159 | - else |
|
155 | + } else |
|
160 | 156 | { |
161 | 157 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
162 | 158 | $param->setData(array_slice($data, $pageSize, $pageSize)); |
@@ -196,8 +196,7 @@ discard block |
||
196 | 196 | $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
197 | 197 | $this->_active = true; |
198 | 198 | $this->setConnectionCharset(); |
199 | - } |
|
200 | - catch(PDOException $e) |
|
199 | + } catch(PDOException $e) |
|
201 | 200 | { |
202 | 201 | throw new TDbException('dbconnection_open_failed', $e->getMessage()); |
203 | 202 | } |
@@ -350,8 +349,7 @@ discard block |
||
350 | 349 | { |
351 | 350 | $this->_pdo->beginTransaction(); |
352 | 351 | return $this->_transaction = Prado::createComponent($this->getTransactionClass(), $this); |
353 | - } |
|
354 | - else |
|
352 | + } else |
|
355 | 353 | throw new TDbException('dbconnection_connection_inactive'); |
356 | 354 | } |
357 | 355 |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function __sleep() |
142 | 142 | { |
143 | 143 | // $this->close(); - DO NOT CLOSE the current connection as serializing doesn't neccessarily mean we don't this connection anymore in the current session |
144 | - return array_diff(parent::__sleep(), ["\0Prado\Data\TDbConnection\0_pdo","\0Prado\Data\TDbConnection\0_active"]); |
|
144 | + return array_diff(parent::__sleep(), ["\0Prado\Data\TDbConnection\0_pdo", "\0Prado\Data\TDbConnection\0_active"]); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | { |
189 | 189 | try |
190 | 190 | { |
191 | - $this->_pdo = new PDO($this->getConnectionString(),$this->getUsername(), |
|
191 | + $this->_pdo = new PDO($this->getConnectionString(), $this->getUsername(), |
|
192 | 192 | $this->getPassword(), $this->_attributes); |
193 | 193 | // This attribute is only useful for PDO::MySql driver. |
194 | 194 | // Ignore the warning if a driver doesn't understand this. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $this->_active = true; |
198 | 198 | $this->setConnectionCharset(); |
199 | 199 | } |
200 | - catch(PDOException $e) |
|
200 | + catch (PDOException $e) |
|
201 | 201 | { |
202 | 202 | throw new TDbException('dbconnection_open_failed', $e->getMessage()); |
203 | 203 | } |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function setConnectionCharset() |
223 | 223 | { |
224 | - if ($this->_charset === '' || $this->_active === false) |
|
224 | + if($this->_charset === '' || $this->_active === false) |
|
225 | 225 | return; |
226 | - switch ($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) |
|
226 | + switch($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) |
|
227 | 227 | { |
228 | 228 | case 'mysql': |
229 | 229 | case 'sqlite': |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * @return string the charset used for database connection. Defaults to emtpy string. |
292 | 292 | */ |
293 | - public function getCharset () |
|
293 | + public function getCharset() |
|
294 | 294 | { |
295 | 295 | return $this->_charset; |
296 | 296 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | /** |
299 | 299 | * @param string $value the charset used for database connection |
300 | 300 | */ |
301 | - public function setCharset ($value) |
|
301 | + public function setCharset($value) |
|
302 | 302 | { |
303 | 303 | $this->_charset = $value; |
304 | 304 | $this->setConnectionCharset(); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function setTransactionClass($value) |
373 | 373 | { |
374 | - $this->_transactionClass = (string)$value; |
|
374 | + $this->_transactionClass = (string) $value; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function __destruct() |
115 | 115 | { |
116 | - if ($this->_cache instanceof \Redis) |
|
116 | + if($this->_cache instanceof \Redis) |
|
117 | 117 | $this->_cache->close(); |
118 | 118 | } |
119 | 119 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function init($config) |
128 | 128 | { |
129 | - if (!extension_loaded('redis') || !class_exists('\Redis', false)) |
|
129 | + if(!extension_loaded('redis') || !class_exists('\Redis', false)) |
|
130 | 130 | throw new TConfigurationException('rediscache_extension_required'); |
131 | 131 | $this->_cache = new \Redis(); |
132 | - if ($this->_socket !== null) |
|
132 | + if($this->_socket !== null) |
|
133 | 133 | $this->_cache->connect($this->_socket); |
134 | 134 | else |
135 | 135 | $this->_cache->connect($this->_host, $this->_port); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function setHost($value) |
159 | 159 | { |
160 | - if ($this->_initialized) |
|
160 | + if($this->_initialized) |
|
161 | 161 | throw new TInvalidOperationException('rediscache_host_unchangeable'); |
162 | 162 | else |
163 | 163 | $this->_host = $value; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function setPort($value) |
179 | 179 | { |
180 | - if ($this->_initialized) |
|
180 | + if($this->_initialized) |
|
181 | 181 | throw new TInvalidOperationException('rediscache_port_unchangeable'); |
182 | 182 | else |
183 | 183 | $this->_port = TPropertyValue::ensureInteger($value); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function setIndex($value) |
219 | 219 | { |
220 | - if ($this->_initialized) |
|
220 | + if($this->_initialized) |
|
221 | 221 | throw new TInvalidOperationException('rediscache_index_unchangeable'); |
222 | 222 | else |
223 | 223 | $this->_index = TPropertyValue::ensureInteger($value); |
@@ -51,9 +51,10 @@ |
||
51 | 51 | { |
52 | 52 | if($this->_dependencies !== null) |
53 | 53 | { |
54 | - foreach($this->_dependencies as $dependency) |
|
55 | - if($dependency->getHasChanged()) |
|
54 | + foreach($this->_dependencies as $dependency) { |
|
55 | + if($dependency->getHasChanged()) |
|
56 | 56 | return true; |
57 | + } |
|
57 | 58 | } |
58 | 59 | return false; |
59 | 60 | } |
@@ -56,8 +56,8 @@ |
||
56 | 56 | if(!function_exists('xcache_isset')) |
57 | 57 | throw new TConfigurationException('xcache_extension_required'); |
58 | 58 | |
59 | - $enabled = (int)ini_get('xcache.cacher') !== 0; |
|
60 | - $var_size = (int)ini_get('xcache.var_size'); |
|
59 | + $enabled = (int) ini_get('xcache.cacher') !== 0; |
|
60 | + $var_size = (int) ini_get('xcache.var_size'); |
|
61 | 61 | |
62 | 62 | if(!($enabled && $var_size > 0)) |
63 | 63 | throw new TConfigurationException('xcache_extension_not_enabled'); |
@@ -122,8 +122,9 @@ |
||
122 | 122 | eaccelerator_gc(); |
123 | 123 | // now, remove leftover cache-keys |
124 | 124 | $keys = eaccelerator_list_keys(); |
125 | - foreach($keys as $key) |
|
126 | - $this->deleteValue(substr($key['name'], 1)); |
|
125 | + foreach($keys as $key) { |
|
126 | + $this->deleteValue(substr($key['name'], 1)); |
|
127 | + } |
|
127 | 128 | return true; |
128 | 129 | } |
129 | 130 | } |
@@ -46,8 +46,9 @@ |
||
46 | 46 | array_shift($args); |
47 | 47 | $n = count($args); |
48 | 48 | $tokens = []; |
49 | - for($i = 0;$i < $n;++$i) |
|
50 | - $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
49 | + for($i = 0;$i < $n;++$i) { |
|
50 | + $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
51 | + } |
|
51 | 52 | parent::__construct(strtr($errorMessage, $tokens)); |
52 | 53 | } |
53 | 54 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | array_shift($args); |
47 | 47 | $n = count($args); |
48 | 48 | $tokens = []; |
49 | - for($i = 0;$i < $n;++$i) |
|
49 | + for($i = 0; $i < $n; ++$i) |
|
50 | 50 | $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
51 | 51 | parent::__construct(strtr($errorMessage, $tokens)); |
52 | 52 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | E_USER_NOTICE => "User Notice", |
47 | 47 | E_STRICT => "Runtime Notice" |
48 | 48 | ]; |
49 | - $errorType = isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error'; |
|
49 | + $errorType = isset($errorTypes[$errno]) ? $errorTypes[$errno] : 'Unknown Error'; |
|
50 | 50 | parent::__construct("[$errorType] $errstr (@line $errline in file $errfile)."); |
51 | 51 | } |
52 | 52 |
@@ -174,7 +174,7 @@ |
||
174 | 174 | */ |
175 | 175 | protected function getState($key, $defaultValue = null) |
176 | 176 | { |
177 | - return isset($this->_state[$key])?$this->_state[$key]:$defaultValue; |
|
177 | + return isset($this->_state[$key]) ? $this->_state[$key] : $defaultValue; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -132,9 +132,10 @@ |
||
132 | 132 | */ |
133 | 133 | public function isInRole($role) |
134 | 134 | { |
135 | - foreach($this->getRoles() as $r) |
|
136 | - if(strcasecmp($role, $r) === 0) |
|
135 | + foreach($this->getRoles() as $r) { |
|
136 | + if(strcasecmp($role, $r) === 0) |
|
137 | 137 | return true; |
138 | + } |
|
138 | 139 | return false; |
139 | 140 | } |
140 | 141 |