Completed
Pull Request — master (#54)
by Reginaldo
41:52
created
lib/Cake/Log/Engine/ConsoleLog.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
  *
76 76
  * @param string $type The type of log you are making.
77 77
  * @param string $message The message you want to log.
78
- * @return boolean success of write.
78
+ * @return integer success of write.
79 79
  */
80 80
 	public function write($type, $message) {
81 81
 		$output = date('Y-m-d H:i:s') . ' ' . ucfirst($type) . ': ' . $message . "\n";
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  */
49 49
 	public function __construct($config = array()) {
50 50
 		parent::__construct($config);
51
-		if (DS === '\\' && !(bool)env('ANSICON')) {
51
+		if (DS === '\\' && ! (bool) env('ANSICON')) {
52 52
 			$outputAs = ConsoleOutput::PLAIN;
53 53
 		} else {
54 54
 			$outputAs = ConsoleOutput::COLOR;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
  * @return boolean success of write.
79 79
  */
80 80
 	public function write($type, $message) {
81
-		$output = date('Y-m-d H:i:s') . ' ' . ucfirst($type) . ': ' . $message . "\n";
81
+		$output = date('Y-m-d H:i:s').' '.ucfirst($type).': '.$message."\n";
82 82
 		return $this->_output->write(sprintf('<%s>%s</%s>', $type, $output, $type), false);
83 83
 	}
84 84
 
Please login to merge, or discard this patch.
lib/Cake/Log/Engine/FileLog.php 2 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,6 @@  discard block
 block discarded – undo
83 83
  * - `mask` A mask is applied when log files are created. Left empty no chmod
84 84
  *   is made.
85 85
  *
86
- * @param array $options Options for the FileLog, see above.
87 86
  */
88 87
 	public function __construct($config = array()) {
89 88
 		$config = Hash::merge($this->_defaults, $config);
@@ -94,7 +93,7 @@  discard block
 block discarded – undo
94 93
  * Sets protected properties based on config provided
95 94
  *
96 95
  * @param array $config Engine configuration
97
- * @return array
96
+ * @return string
98 97
  */
99 98
 	public function config($config = array()) {
100 99
 		parent::config($config);
@@ -128,7 +127,7 @@  discard block
 block discarded – undo
128 127
  *
129 128
  * @param string $type The type of log you are making.
130 129
  * @param string $message The message you want to log.
131
- * @return boolean success of write.
130
+ * @return integer success of write.
132 131
  */
133 132
 	public function write($type, $message) {
134 133
 		$output = date('Y-m-d H:i:s') . ' ' . ucfirst($type) . ': ' . $message . "\n";
@@ -181,7 +180,7 @@  discard block
 block discarded – undo
181 180
  * Also if `rotate` count is reached oldest file is removed.
182 181
  *
183 182
  * @param string $filename Log file name
184
- * @return mixed True if rotated successfully or false in case of error.
183
+ * @return null|boolean True if rotated successfully or false in case of error.
185 184
  *   Void if file doesn't need to be rotated.
186 185
  */
187 186
 	protected function _rotateFile($filename) {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -99,22 +99,22 @@  discard block
 block discarded – undo
99 99
 	public function config($config = array()) {
100 100
 		parent::config($config);
101 101
 
102
-		if (!empty($config['path'])) {
102
+		if ( ! empty($config['path'])) {
103 103
 			$this->_path = $config['path'];
104 104
 		}
105
-		if (Configure::read('debug') && !is_dir($this->_path)) {
105
+		if (Configure::read('debug') && ! is_dir($this->_path)) {
106 106
 			mkdir($this->_path, 0775, true);
107 107
 		}
108 108
 
109
-		if (!empty($config['file'])) {
109
+		if ( ! empty($config['file'])) {
110 110
 			$this->_file = $config['file'];
111 111
 			if (substr($this->_file, -4) !== '.log') {
112 112
 				$this->_file .= '.log';
113 113
 			}
114 114
 		}
115
-		if (!empty($config['size'])) {
115
+		if ( ! empty($config['size'])) {
116 116
 			if (is_numeric($config['size'])) {
117
-				$this->_size = (int)$config['size'];
117
+				$this->_size = (int) $config['size'];
118 118
 			} else {
119 119
 				$this->_size = CakeNumber::fromReadableSize($config['size']);
120 120
 			}
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
  * @return boolean success of write.
132 132
  */
133 133
 	public function write($type, $message) {
134
-		$output = date('Y-m-d H:i:s') . ' ' . ucfirst($type) . ': ' . $message . "\n";
134
+		$output = date('Y-m-d H:i:s').' '.ucfirst($type).': '.$message."\n";
135 135
 		$filename = $this->_getFilename($type);
136
-		if (!empty($this->_size)) {
136
+		if ( ! empty($this->_size)) {
137 137
 			$this->_rotateFile($filename);
138 138
 		}
139 139
 
140
-		$pathname = $this->_path . $filename;
140
+		$pathname = $this->_path.$filename;
141 141
 		if (empty($this->_config['mask'])) {
142 142
 			return file_put_contents($pathname, $output, FILE_APPEND);
143 143
 		}
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		$exists = file_exists($pathname);
146 146
 		$result = file_put_contents($pathname, $output, FILE_APPEND);
147 147
 		static $selfError = false;
148
-		if (!$selfError && !$exists && !chmod($pathname, (int)$this->_config['mask'])) {
148
+		if ( ! $selfError && ! $exists && ! chmod($pathname, (int) $this->_config['mask'])) {
149 149
 			$selfError = true;
150 150
 			trigger_error(__d(
151 151
 				'cake_dev', 'Could not apply permission mask "%s" on log file "%s"',
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 	protected function _getFilename($type) {
164 164
 		$debugTypes = array('notice', 'info', 'debug');
165 165
 
166
-		if (!empty($this->_file)) {
166
+		if ( ! empty($this->_file)) {
167 167
 			$filename = $this->_file;
168 168
 		} elseif ($type === 'error' || $type === 'warning') {
169 169
 			$filename = 'error.log';
170 170
 		} elseif (in_array($type, $debugTypes)) {
171 171
 			$filename = 'debug.log';
172 172
 		} else {
173
-			$filename = $type . '.log';
173
+			$filename = $type.'.log';
174 174
 		}
175 175
 
176 176
 		return $filename;
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
  *   Void if file doesn't need to be rotated.
186 186
  */
187 187
 	protected function _rotateFile($filename) {
188
-		$filepath = $this->_path . $filename;
188
+		$filepath = $this->_path.$filename;
189 189
 		if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
190 190
 			clearstatcache(true, $filepath);
191 191
 		} else {
192 192
 			clearstatcache();
193 193
 		}
194 194
 
195
-		if (!file_exists($filepath) ||
195
+		if ( ! file_exists($filepath) ||
196 196
 			filesize($filepath) < $this->_size
197 197
 		) {
198 198
 			return;
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 		if ($this->_config['rotate'] === 0) {
202 202
 			$result = unlink($filepath);
203 203
 		} else {
204
-			$result = rename($filepath, $filepath . '.' . time());
204
+			$result = rename($filepath, $filepath.'.'.time());
205 205
 		}
206 206
 
207
-		$files = glob($filepath . '.*');
207
+		$files = glob($filepath.'.*');
208 208
 		if ($files) {
209 209
 			$filesToDelete = count($files) - $this->_config['rotate'];
210 210
 			while ($filesToDelete > 0) {
Please login to merge, or discard this patch.
lib/Cake/Model/Behavior/TranslateBehavior.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @param Model $Model Model the behavior is being attached to.
64 64
  * @param array $config Array of configuration information.
65
- * @return mixed
65
+ * @return boolean
66 66
  */
67 67
 	public function setup(Model $Model, $config = array()) {
68 68
 		$db = ConnectionManager::getDataSource($Model->useDbConfig);
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
  * is disabled.
369 369
  *
370 370
  * @param Model $Model
371
- * @return void
371
+ * @return boolean|null
372 372
  */
373 373
 	protected function _setRuntimeData(Model $Model) {
374 374
 		$locale = $this->_getLocale($Model);
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
  * Restores model data to the original data.
401 401
  * This solves issues with saveAssociated and validate = first.
402 402
  *
403
- * @param Model $model
404
- * @return void
403
+ * @param Model $Model
404
+ * @return boolean
405 405
  */
406 406
 	public function afterValidate(Model $Model) {
407 407
 		$Model->data[$Model->alias] = array_merge(
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
  * @param Model $Model Model the callback is called on
418 418
  * @param boolean $created Whether or not the save created a record.
419 419
  * @param array $options Options passed from Model::save().
420
- * @return void
420
+ * @return boolean|null
421 421
  */
422 422
 	public function afterSave(Model $Model, $created, $options = array()) {
423 423
 		if (!isset($this->runtime[$Model->alias]['beforeValidate']) && !isset($this->runtime[$Model->alias]['beforeSave'])) {
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
  */
67 67
 	public function setup(Model $Model, $config = array()) {
68 68
 		$db = ConnectionManager::getDataSource($Model->useDbConfig);
69
-		if (!$db->connected) {
69
+		if ( ! $db->connected) {
70 70
 			trigger_error(
71 71
 				__d('cake_dev', 'Datasource %s for TranslateBehavior of model %s is not connected', $Model->useDbConfig, $Model->alias),
72 72
 				E_USER_ERROR
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$db = $Model->getDataSource();
109 109
 		$RuntimeModel = $this->translateModel($Model);
110 110
 
111
-		if (!empty($RuntimeModel->tablePrefix)) {
111
+		if ( ! empty($RuntimeModel->tablePrefix)) {
112 112
 			$tablePrefix = $RuntimeModel->tablePrefix;
113 113
 		} else {
114 114
 			$tablePrefix = $db->config['prefix'];
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
 			$addFields = $fields;
153 153
 		} elseif (is_array($query['fields'])) {
154 154
 			$isAllFields = (
155
-				in_array($Model->alias . '.' . '*', $query['fields']) ||
155
+				in_array($Model->alias.'.'.'*', $query['fields']) ||
156 156
 				in_array($Model->escapeField('*'), $query['fields'])
157 157
 			);
158 158
 			foreach ($fields as $key => $value) {
159 159
 				$field = (is_numeric($key)) ? $value : $key;
160 160
 				if (
161 161
 					$isAllFields ||
162
-					in_array($Model->alias . '.' . $field, $query['fields']) ||
162
+					in_array($Model->alias.'.'.$field, $query['fields']) ||
163 163
 					in_array($field, $query['fields'])
164 164
 				) {
165 165
 					$addFields[] = $field;
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 			foreach ($addFields as $_f => $field) {
173 173
 				$aliasField = is_numeric($_f) ? $field : $_f;
174 174
 
175
-				foreach (array($aliasField, $Model->alias . '.' . $aliasField) as $_field) {
176
-					$key = array_search($_field, (array)$query['fields']);
175
+				foreach (array($aliasField, $Model->alias.'.'.$aliasField) as $_field) {
176
+					$key = array_search($_field, (array) $query['fields']);
177 177
 
178 178
 					if ($key !== false) {
179 179
 						unset($query['fields'][$key]);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
  */
198 198
 	protected function _checkConditions(Model $Model, $query) {
199 199
 		$conditionFields = array();
200
-		if (empty($query['conditions']) || (!empty($query['conditions']) && !is_array($query['conditions']))) {
200
+		if (empty($query['conditions']) || ( ! empty($query['conditions']) && ! is_array($query['conditions']))) {
201 201
 			return $conditionFields;
202 202
 		}
203 203
 		foreach ($query['conditions'] as $col => $val) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 				$aliasVirtualLocale = "{$aliasVirtual}_{$_locale}";
235 235
 				$aliasLocale = "{$alias}__{$_locale}";
236 236
 				$Model->virtualFields[$aliasVirtualLocale] = "{$aliasLocale}.content";
237
-				if (!empty($query['fields']) && is_array($query['fields'])) {
237
+				if ( ! empty($query['fields']) && is_array($query['fields'])) {
238 238
 					$query['fields'][] = $aliasVirtualLocale;
239 239
 				}
240 240
 				$query['joins'][] = array(
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			}
252 252
 		} else {
253 253
 			$Model->virtualFields[$aliasVirtual] = "{$alias}.content";
254
-			if (!empty($query['fields']) && is_array($query['fields'])) {
254
+			if ( ! empty($query['fields']) && is_array($query['fields'])) {
255 255
 				$query['fields'][] = $aliasVirtual;
256 256
 			}
257 257
 			$query['joins'][] = array(
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		$Model->virtualFields = $this->runtime[$Model->alias]['virtualFields'];
282 282
 
283 283
 		$this->runtime[$Model->alias]['virtualFields'] = $this->runtime[$Model->alias]['fields'] = array();
284
-		if (!empty($this->runtime[$Model->alias]['restoreFields'])) {
284
+		if ( ! empty($this->runtime[$Model->alias]['restoreFields'])) {
285 285
 			$this->runtime[$Model->alias]['fields'] = $this->runtime[$Model->alias]['restoreFields'];
286 286
 			unset($this->runtime[$Model->alias]['restoreFields']);
287 287
 		}
@@ -301,14 +301,14 @@  discard block
 block discarded – undo
301 301
 				if (is_array($locale)) {
302 302
 					foreach ($locale as $_locale) {
303 303
 						$aliasVirtualLocale = "{$aliasVirtual}_{$_locale}";
304
-						if (!isset($row[$Model->alias][$aliasField]) && !empty($row[$Model->alias][$aliasVirtualLocale])) {
304
+						if ( ! isset($row[$Model->alias][$aliasField]) && ! empty($row[$Model->alias][$aliasVirtualLocale])) {
305 305
 							$row[$Model->alias][$aliasField] = $row[$Model->alias][$aliasVirtualLocale];
306 306
 							$row[$Model->alias]['locale'] = $_locale;
307 307
 						}
308 308
 						unset($row[$Model->alias][$aliasVirtualLocale]);
309 309
 					}
310 310
 
311
-					if (!isset($row[$Model->alias][$aliasField])) {
311
+					if ( ! isset($row[$Model->alias][$aliasField])) {
312 312
 						$row[$Model->alias][$aliasField] = '';
313 313
 					}
314 314
 				} else {
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
  * @see Model::save()
351 351
  */
352 352
 	public function beforeSave(Model $Model, $options = array()) {
353
-		if (isset($options['validate']) && !$options['validate']) {
353
+		if (isset($options['validate']) && ! $options['validate']) {
354 354
 			unset($this->runtime[$Model->alias]['beforeSave']);
355 355
 		}
356 356
 		if (isset($this->runtime[$Model->alias]['beforeSave'])) {
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 			if (isset($Model->data[$Model->alias][$field])) {
385 385
 				$tempData[$field] = $Model->data[$Model->alias][$field];
386 386
 				if (is_array($Model->data[$Model->alias][$field])) {
387
-					if (is_string($locale) && !empty($Model->data[$Model->alias][$field][$locale])) {
387
+					if (is_string($locale) && ! empty($Model->data[$Model->alias][$field][$locale])) {
388 388
 						$Model->data[$Model->alias][$field] = $Model->data[$Model->alias][$field][$locale];
389 389
 					} else {
390 390
 						$values = array_values($Model->data[$Model->alias][$field]);
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
  * @return void
421 421
  */
422 422
 	public function afterSave(Model $Model, $created, $options = array()) {
423
-		if (!isset($this->runtime[$Model->alias]['beforeValidate']) && !isset($this->runtime[$Model->alias]['beforeSave'])) {
423
+		if ( ! isset($this->runtime[$Model->alias]['beforeValidate']) && ! isset($this->runtime[$Model->alias]['beforeSave'])) {
424 424
 			return true;
425 425
 		}
426 426
 		if (isset($this->runtime[$Model->alias]['beforeValidate'])) {
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 			$translations = $RuntimeModel->find('list', array(
455 455
 				'conditions' => $conditions,
456 456
 				'fields' => array(
457
-					$RuntimeModel->alias . '.locale',
458
-					$RuntimeModel->alias . '.id'
457
+					$RuntimeModel->alias.'.locale',
458
+					$RuntimeModel->alias.'.id'
459 459
 				)
460 460
 			));
461 461
 			foreach ($value as $_locale => $_value) {
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 		$hasLocales = count($locales) > 0;
496 496
 
497 497
 		foreach ($fields as $key => $field) {
498
-			if (!is_numeric($key)) {
498
+			if ( ! is_numeric($key)) {
499 499
 				$field = $key;
500 500
 			}
501
-			if ($hasLocales && !isset($data[$field])) {
501
+			if ($hasLocales && ! isset($data[$field])) {
502 502
 				$data[$field] = array_fill_keys($locales, '');
503
-			} elseif (!isset($data[$field])) {
503
+			} elseif ( ! isset($data[$field])) {
504 504
 				$data[$field] = '';
505 505
 			}
506 506
 		}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
  * @return mixed string or false
527 527
  */
528 528
 	protected function _getLocale(Model $Model) {
529
-		if (!isset($Model->locale) || $Model->locale === null) {
529
+		if ( ! isset($Model->locale) || $Model->locale === null) {
530 530
 			$I18n = I18n::getInstance();
531 531
 			$I18n->l10n->get(Configure::read('Config.language'));
532 532
 			$Model->locale = $I18n->l10n->locale;
@@ -545,8 +545,8 @@  discard block
 block discarded – undo
545 545
  * @return Model
546 546
  */
547 547
 	public function translateModel(Model $Model) {
548
-		if (!isset($this->runtime[$Model->alias]['model'])) {
549
-			if (!isset($Model->translateModel) || empty($Model->translateModel)) {
548
+		if ( ! isset($this->runtime[$Model->alias]['model'])) {
549
+			if ( ! isset($Model->translateModel) || empty($Model->translateModel)) {
550 550
 				$className = 'I18nModel';
551 551
 			} else {
552 552
 				$className = $Model->translateModel;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
 			$this->runtime[$Model->alias]['model'] = ClassRegistry::init($className);
556 556
 		}
557
-		if (!empty($Model->translateTable) && $Model->translateTable !== $this->runtime[$Model->alias]['model']->useTable) {
557
+		if ( ! empty($Model->translateTable) && $Model->translateTable !== $this->runtime[$Model->alias]['model']->useTable) {
558 558
 			$this->runtime[$Model->alias]['model']->setSource($Model->translateTable);
559 559
 		} elseif (empty($Model->translateTable) && empty($Model->translateModel)) {
560 560
 			$this->runtime[$Model->alias]['model']->setSource('i18n');
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 			}
634 634
 		}
635 635
 
636
-		if (!empty($associations)) {
636
+		if ( ! empty($associations)) {
637 637
 			$Model->bindModel(array('hasMany' => $associations), $reset);
638 638
 		}
639 639
 		return true;
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 			}
699 699
 		}
700 700
 
701
-		if (!empty($associations)) {
701
+		if ( ! empty($associations)) {
702 702
 			$Model->unbindModel(array('hasMany' => $associations), false);
703 703
 		}
704 704
 		return true;
Please login to merge, or discard this patch.
lib/Cake/Model/Behavior/TreeBehavior.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
  * @param Model $Model Model instance.
88 88
  * @param boolean $created indicates whether the node just saved was created or updated
89 89
  * @param array $options Options passed from Model::save().
90
- * @return boolean true on success, false on failure
90
+ * @return boolean|null true on success, false on failure
91 91
  */
92 92
 	public function afterSave(Model $Model, $created, $options = array()) {
93 93
 		extract($this->settings[$Model->alias]);
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
  *
481 481
  * @param Model $Model Model instance
482 482
  * @param integer|string $id The ID of the record to move
483
- * @param integer|boolean $number how many places to move the node or true to move to last position
483
+ * @param integer $number how many places to move the node or true to move to last position
484 484
  * @return boolean true on success, false on failure
485 485
  * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::moveDown
486 486
  */
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
  *
539 539
  * @param Model $Model Model instance
540 540
  * @param integer|string $id The ID of the record to move
541
- * @param integer|boolean $number how many places to move the node, or true to move to first position
541
+ * @param integer $number how many places to move the node, or true to move to first position
542 542
  * @return boolean true on success, false on failure
543 543
  * @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::moveUp
544 544
  */
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
  * @param Model $Model
1045 1045
  * @param integer $shift
1046 1046
  * @param string $dir
1047
- * @param array $conditions
1047
+ * @param string $conditions
1048 1048
  * @param boolean $created
1049 1049
  * @param string $field
1050 1050
  * @return void
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		if (in_array($settings['scope'], $Model->getAssociated('belongsTo'))) {
73 73
 			$data = $Model->getAssociated($settings['scope']);
74 74
 			$Parent = $Model->{$settings['scope']};
75
-			$settings['scope'] = $Model->escapeField($data['foreignKey']) . ' = ' . $Parent->escapeField();
75
+			$settings['scope'] = $Model->escapeField($data['foreignKey']).' = '.$Parent->escapeField();
76 76
 			$settings['recursive'] = 0;
77 77
 		}
78 78
 		$this->settings[$Model->alias] = $settings;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
  * @return array
110 110
  */
111 111
 	public function beforeFind(Model $Model, $query) {
112
-		if ($Model->findQueryType === 'threaded' && !isset($query['parent'])) {
112
+		if ($Model->findQueryType === 'threaded' && ! isset($query['parent'])) {
113 113
 			$query['parent'] = $this->settings[$Model->alias]['parent'];
114 114
 		}
115 115
 		return $query;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		$data = $this->_deletedRow[$Model->alias];
150 150
 		$this->_deletedRow[$Model->alias] = null;
151 151
 
152
-		if (!$data[$right] || !$data[$left]) {
152
+		if ( ! $data[$right] || ! $data[$left]) {
153 153
 			return true;
154 154
 		}
155 155
 		$diff = $data[$right] - $data[$left] + 1;
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
 			if (is_string($scope)) {
159 159
 				$scope = array($scope);
160 160
 			}
161
-			$scope[][$Model->escapeField($left) . " BETWEEN ? AND ?"] = array($data[$left] + 1, $data[$right] - 1);
161
+			$scope[][$Model->escapeField($left)." BETWEEN ? AND ?"] = array($data[$left] + 1, $data[$right] - 1);
162 162
 			$Model->deleteAll($scope);
163 163
 		}
164
-		$this->_sync($Model, $diff, '-', '> ' . $data[$right]);
164
+		$this->_sync($Model, $diff, '-', '> '.$data[$right]);
165 165
 		return true;
166 166
 	}
167 167
 
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
 		extract($this->settings[$Model->alias]);
183 183
 
184 184
 		$this->_addToWhitelist($Model, array($left, $right));
185
-		if (!$Model->id || !$Model->exists()) {
185
+		if ( ! $Model->id || ! $Model->exists()) {
186 186
 			if (array_key_exists($parent, $Model->data[$Model->alias]) && $Model->data[$Model->alias][$parent]) {
187 187
 				$parentNode = $Model->find('first', array(
188 188
 					'conditions' => array($scope, $Model->escapeField() => $Model->data[$Model->alias][$parent]),
189 189
 					'fields' => array($Model->primaryKey, $right), 'recursive' => $recursive
190 190
 				));
191
-				if (!$parentNode) {
191
+				if ( ! $parentNode) {
192 192
 					return false;
193 193
 				}
194 194
 				list($parentNode) = array_values($parentNode);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 			if ($Model->data[$Model->alias][$parent] != $Model->field($parent)) {
204 204
 				$this->settings[$Model->alias]['__parentChange'] = true;
205 205
 			}
206
-			if (!$Model->data[$Model->alias][$parent]) {
206
+			if ( ! $Model->data[$Model->alias][$parent]) {
207 207
 				$Model->data[$Model->alias][$parent] = null;
208 208
 				$this->_addToWhitelist($Model, $parent);
209 209
 			} else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 					'conditions' => array($scope, $Model->escapeField() => $Model->data[$Model->alias][$parent]),
222 222
 					'fields' => array($Model->primaryKey, $left, $right), 'recursive' => $recursive
223 223
 				));
224
-				if (!$parentNode) {
224
+				if ( ! $parentNode) {
225 225
 					return false;
226 226
 				}
227 227
 				list($parentNode) = array_values($parentNode);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		}
256 256
 		if ($id === null && $Model->id) {
257 257
 			$id = $Model->id;
258
-		} elseif (!$id) {
258
+		} elseif ( ! $id) {
259 259
 			$id = null;
260 260
 		}
261 261
 		extract($this->settings[$Model->alias]);
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			$data = $Model->data[$Model->alias];
271 271
 		} else {
272 272
 			$data = $Model->find('first', array('conditions' => array($scope, $Model->escapeField() => $id), 'recursive' => $recursive));
273
-			if (!$data) {
273
+			if ( ! $data) {
274 274
 				return 0;
275 275
 			}
276 276
 			$data = $data[$Model->alias];
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
 		if ($id === null && $Model->id) {
305 305
 			$id = $Model->id;
306
-		} elseif (!$id) {
306
+		} elseif ( ! $id) {
307 307
 			$id = null;
308 308
 		}
309 309
 
@@ -312,29 +312,29 @@  discard block
 block discarded – undo
312 312
 		if ($overrideRecursive !== null) {
313 313
 			$recursive = $overrideRecursive;
314 314
 		}
315
-		if (!$order) {
316
-			$order = $Model->escapeField($left) . " asc";
315
+		if ( ! $order) {
316
+			$order = $Model->escapeField($left)." asc";
317 317
 		}
318 318
 		if ($direct) {
319 319
 			$conditions = array($scope, $Model->escapeField($parent) => $id);
320 320
 			return $Model->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive'));
321 321
 		}
322 322
 
323
-		if (!$id) {
323
+		if ( ! $id) {
324 324
 			$conditions = $scope;
325 325
 		} else {
326
-			$result = array_values((array)$Model->find('first', array(
326
+			$result = array_values((array) $Model->find('first', array(
327 327
 				'conditions' => array($scope, $Model->escapeField() => $id),
328 328
 				'fields' => array($left, $right),
329 329
 				'recursive' => $recursive
330 330
 			)));
331 331
 
332
-			if (empty($result) || !isset($result[0])) {
332
+			if (empty($result) || ! isset($result[0])) {
333 333
 				return array();
334 334
 			}
335 335
 			$conditions = array($scope,
336
-				$Model->escapeField($right) . ' <' => $result[0][$right],
337
-				$Model->escapeField($left) . ' >' => $result[0][$left]
336
+				$Model->escapeField($right).' <' => $result[0][$right],
337
+				$Model->escapeField($left).' >' => $result[0][$left]
338 338
 			);
339 339
 		}
340 340
 		return $Model->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive'));
@@ -360,30 +360,30 @@  discard block
 block discarded – undo
360 360
 		}
361 361
 
362 362
 		$fields = null;
363
-		if (!$keyPath && !$valuePath && $Model->hasField($Model->displayField)) {
363
+		if ( ! $keyPath && ! $valuePath && $Model->hasField($Model->displayField)) {
364 364
 			$fields = array($Model->primaryKey, $Model->displayField, $left, $right);
365 365
 		}
366 366
 
367
-		if (!$keyPath) {
368
-			$keyPath = '{n}.' . $Model->alias . '.' . $Model->primaryKey;
367
+		if ( ! $keyPath) {
368
+			$keyPath = '{n}.'.$Model->alias.'.'.$Model->primaryKey;
369 369
 		}
370 370
 
371
-		if (!$valuePath) {
372
-			$valuePath = array('%s%s', '{n}.tree_prefix', '{n}.' . $Model->alias . '.' . $Model->displayField);
371
+		if ( ! $valuePath) {
372
+			$valuePath = array('%s%s', '{n}.tree_prefix', '{n}.'.$Model->alias.'.'.$Model->displayField);
373 373
 
374 374
 		} elseif (is_string($valuePath)) {
375 375
 			$valuePath = array('%s%s', '{n}.tree_prefix', $valuePath);
376 376
 
377 377
 		} else {
378
-			array_unshift($valuePath, '%s' . $valuePath[0], '{n}.tree_prefix');
378
+			array_unshift($valuePath, '%s'.$valuePath[0], '{n}.tree_prefix');
379 379
 		}
380 380
 
381
-		$conditions = (array)$conditions;
381
+		$conditions = (array) $conditions;
382 382
 		if ($scope) {
383 383
 			$conditions[] = $scope;
384 384
 		}
385 385
 
386
-		$order = $Model->escapeField($left) . " asc";
386
+		$order = $Model->escapeField($left)." asc";
387 387
 		$results = $Model->find('all', compact('conditions', 'fields', 'order', 'recursive'));
388 388
 		$stack = array();
389 389
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		}
468 468
 		$item = $result[0];
469 469
 		$results = $Model->find('all', array(
470
-			'conditions' => array($scope, $Model->escapeField($left) . ' <=' => $item[$left], $Model->escapeField($right) . ' >=' => $item[$right]),
470
+			'conditions' => array($scope, $Model->escapeField($left).' <=' => $item[$left], $Model->escapeField($right).' >=' => $item[$right]),
471 471
 			'fields' => $fields, 'order' => array($Model->escapeField($left) => 'asc'), 'recursive' => $recursive
472 472
 		));
473 473
 		return $results;
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		if (is_array($id)) {
489 489
 			extract(array_merge(array('id' => null), $id));
490 490
 		}
491
-		if (!$number) {
491
+		if ( ! $number) {
492 492
 			return false;
493 493
 		}
494 494
 		if (empty($id)) {
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
 			return false;
519 519
 		}
520 520
 		$edge = $this->_getMax($Model, $scope, $right, $recursive);
521
-		$this->_sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]);
522
-		$this->_sync($Model, $nextNode[$left] - $node[$left], '-', 'BETWEEN ' . $nextNode[$left] . ' AND ' . $nextNode[$right]);
523
-		$this->_sync($Model, $edge - $node[$left] - ($nextNode[$right] - $nextNode[$left]), '-', '> ' . $edge);
521
+		$this->_sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN '.$node[$left].' AND '.$node[$right]);
522
+		$this->_sync($Model, $nextNode[$left] - $node[$left], '-', 'BETWEEN '.$nextNode[$left].' AND '.$nextNode[$right]);
523
+		$this->_sync($Model, $edge - $node[$left] - ($nextNode[$right] - $nextNode[$left]), '-', '> '.$edge);
524 524
 
525 525
 		if (is_int($number)) {
526 526
 			$number--;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		if (is_array($id)) {
547 547
 			extract(array_merge(array('id' => null), $id));
548 548
 		}
549
-		if (!$number) {
549
+		if ( ! $number) {
550 550
 			return false;
551 551
 		}
552 552
 		if (empty($id)) {
@@ -578,9 +578,9 @@  discard block
 block discarded – undo
578 578
 			return false;
579 579
 		}
580 580
 		$edge = $this->_getMax($Model, $scope, $right, $recursive);
581
-		$this->_sync($Model, $edge - $previousNode[$left] + 1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]);
582
-		$this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]);
583
-		$this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge);
581
+		$this->_sync($Model, $edge - $previousNode[$left] + 1, '+', 'BETWEEN '.$previousNode[$left].' AND '.$previousNode[$right]);
582
+		$this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN '.$node[$left].' AND '.$node[$right]);
583
+		$this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> '.$edge);
584 584
 		if (is_int($number)) {
585 585
 			$number--;
586 586
 		}
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 			if ($missingParents) {
628 628
 				if ($missingParentAction === 'return') {
629 629
 					foreach ($missingParents as $id => $display) {
630
-						$this->errors[] = 'cannot find the parent for ' . $Model->alias . ' with id ' . $id . '(' . $display . ')';
630
+						$this->errors[] = 'cannot find the parent for '.$Model->alias.' with id '.$id.'('.$display.')';
631 631
 					}
632 632
 					return false;
633 633
 				} elseif ($missingParentAction === 'delete') {
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 		}
680 680
 
681 681
 		$children = $Model->find('all', $params);
682
-		$hasChildren = (bool)$children;
682
+		$hasChildren = (bool) $children;
683 683
 
684 684
 		if ($parentId !== null) {
685 685
 			if ($hasChildren) {
@@ -746,13 +746,13 @@  discard block
 block discarded – undo
746 746
 	public function reorder(Model $Model, $options = array()) {
747 747
 		$options = array_merge(array('id' => null, 'field' => $Model->displayField, 'order' => 'ASC', 'verify' => true), $options);
748 748
 		extract($options);
749
-		if ($verify && !$this->verify($Model)) {
749
+		if ($verify && ! $this->verify($Model)) {
750 750
 			return false;
751 751
 		}
752 752
 		$verify = false;
753 753
 		extract($this->settings[$Model->alias]);
754 754
 		$fields = array($Model->primaryKey, $field, $left, $right);
755
-		$sort = $field . ' ' . $order;
755
+		$sort = $field.' '.$order;
756 756
 		$nodes = $this->children($Model, $id, true, $fields, $sort, null, null, $recursive);
757 757
 
758 758
 		$cacheQueries = $Model->cacheQueries;
@@ -815,8 +815,8 @@  discard block
 block discarded – undo
815 815
 			array($parent => $db->value($node[$parent], $parent)),
816 816
 			array($Model->escapeField($parent) => $node[$Model->primaryKey])
817 817
 		);
818
-		$this->_sync($Model, 1, '-', 'BETWEEN ' . ($node[$left] + 1) . ' AND ' . ($node[$right] - 1));
819
-		$this->_sync($Model, 2, '-', '> ' . ($node[$right]));
818
+		$this->_sync($Model, 1, '-', 'BETWEEN '.($node[$left] + 1).' AND '.($node[$right] - 1));
819
+		$this->_sync($Model, 2, '-', '> '.($node[$right]));
820 820
 		$Model->id = $id;
821 821
 
822 822
 		if ($delete) {
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
  */
854 854
 	public function verify(Model $Model) {
855 855
 		extract($this->settings[$Model->alias]);
856
-		if (!$Model->find('count', array('conditions' => $scope))) {
856
+		if ( ! $Model->find('count', array('conditions' => $scope))) {
857 857
 			return true;
858 858
 		}
859 859
 		$min = $this->_getMin($Model, $scope, $left, $recursive);
@@ -865,14 +865,14 @@  discard block
 block discarded – undo
865 865
 				$scope, 'OR' => array($Model->escapeField($left) => $i, $Model->escapeField($right) => $i)
866 866
 			)));
867 867
 			if ($count != 1) {
868
-				if (!$count) {
868
+				if ( ! $count) {
869 869
 					$errors[] = array('index', $i, 'missing');
870 870
 				} else {
871 871
 					$errors[] = array('index', $i, 'duplicate');
872 872
 				}
873 873
 			}
874 874
 		}
875
-		$node = $Model->find('first', array('conditions' => array($scope, $Model->escapeField($right) . '< ' . $Model->escapeField($left)), 'recursive' => 0));
875
+		$node = $Model->find('first', array('conditions' => array($scope, $Model->escapeField($right).'< '.$Model->escapeField($left)), 'recursive' => 0));
876 876
 		if ($node) {
877 877
 			$errors[] = array('node', $node[$Model->alias][$Model->primaryKey], 'left greater than right.');
878 878
 		}
@@ -891,17 +891,17 @@  discard block
 block discarded – undo
891 891
 				$errors[] = array('node', $instance[$Model->alias][$Model->primaryKey],
892 892
 					'left and right values identical');
893 893
 			} elseif ($instance[$Model->alias][$parent]) {
894
-				if (!$instance['VerifyParent'][$Model->primaryKey]) {
894
+				if ( ! $instance['VerifyParent'][$Model->primaryKey]) {
895 895
 					$errors[] = array('node', $instance[$Model->alias][$Model->primaryKey],
896
-						'The parent node ' . $instance[$Model->alias][$parent] . ' doesn\'t exist');
896
+						'The parent node '.$instance[$Model->alias][$parent].' doesn\'t exist');
897 897
 				} elseif ($instance[$Model->alias][$left] < $instance['VerifyParent'][$left]) {
898 898
 					$errors[] = array('node', $instance[$Model->alias][$Model->primaryKey],
899
-						'left less than parent (node ' . $instance['VerifyParent'][$Model->primaryKey] . ').');
899
+						'left less than parent (node '.$instance['VerifyParent'][$Model->primaryKey].').');
900 900
 				} elseif ($instance[$Model->alias][$right] > $instance['VerifyParent'][$right]) {
901 901
 					$errors[] = array('node', $instance[$Model->alias][$Model->primaryKey],
902
-						'right greater than parent (node ' . $instance['VerifyParent'][$Model->primaryKey] . ').');
902
+						'right greater than parent (node '.$instance['VerifyParent'][$Model->primaryKey].').');
903 903
 				}
904
-			} elseif ($Model->find('count', array('conditions' => array($scope, $Model->escapeField($left) . ' <' => $instance[$Model->alias][$left], $Model->escapeField($right) . ' >' => $instance[$Model->alias][$right]), 'recursive' => 0))) {
904
+			} elseif ($Model->find('count', array('conditions' => array($scope, $Model->escapeField($left).' <' => $instance[$Model->alias][$left], $Model->escapeField($right).' >' => $instance[$Model->alias][$right]), 'recursive' => 0))) {
905 905
 				$errors[] = array('node', $instance[$Model->alias][$Model->primaryKey], 'The parent field is blank, but has a parent');
906 906
 			}
907 907
 		}
@@ -933,8 +933,8 @@  discard block
 block discarded – undo
933 933
 		$edge = $this->_getMax($Model, $scope, $right, $recursive, $created);
934 934
 
935 935
 		if (empty($parentId)) {
936
-			$this->_sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
937
-			$this->_sync($Model, $node[$right] - $node[$left] + 1, '-', '> ' . $node[$left], $created);
936
+			$this->_sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN '.$node[$left].' AND '.$node[$right], $created);
937
+			$this->_sync($Model, $node[$right] - $node[$left] + 1, '-', '> '.$node[$left], $created);
938 938
 		} else {
939 939
 			$values = $Model->find('first', array(
940 940
 				'conditions' => array($scope, $Model->escapeField() => $parentId),
@@ -958,27 +958,27 @@  discard block
 block discarded – undo
958 958
 				return false;
959 959
 			}
960 960
 			if (empty($node[$left]) && empty($node[$right])) {
961
-				$this->_sync($Model, 2, '+', '>= ' . $parentNode[$right], $created);
961
+				$this->_sync($Model, 2, '+', '>= '.$parentNode[$right], $created);
962 962
 				$result = $Model->save(
963 963
 					array($left => $parentNode[$right], $right => $parentNode[$right] + 1, $parent => $parentId),
964 964
 					array('validate' => false, 'callbacks' => false)
965 965
 				);
966 966
 				$Model->data = $result;
967 967
 			} else {
968
-				$this->_sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
968
+				$this->_sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN '.$node[$left].' AND '.$node[$right], $created);
969 969
 				$diff = $node[$right] - $node[$left] + 1;
970 970
 
971 971
 				if ($node[$left] > $parentNode[$left]) {
972 972
 					if ($node[$right] < $parentNode[$right]) {
973
-						$this->_sync($Model, $diff, '-', 'BETWEEN ' . $node[$right] . ' AND ' . ($parentNode[$right] - 1), $created);
974
-						$this->_sync($Model, $edge - $parentNode[$right] + $diff + 1, '-', '> ' . $edge, $created);
973
+						$this->_sync($Model, $diff, '-', 'BETWEEN '.$node[$right].' AND '.($parentNode[$right] - 1), $created);
974
+						$this->_sync($Model, $edge - $parentNode[$right] + $diff + 1, '-', '> '.$edge, $created);
975 975
 					} else {
976
-						$this->_sync($Model, $diff, '+', 'BETWEEN ' . $parentNode[$right] . ' AND ' . $node[$right], $created);
977
-						$this->_sync($Model, $edge - $parentNode[$right] + 1, '-', '> ' . $edge, $created);
976
+						$this->_sync($Model, $diff, '+', 'BETWEEN '.$parentNode[$right].' AND '.$node[$right], $created);
977
+						$this->_sync($Model, $edge - $parentNode[$right] + 1, '-', '> '.$edge, $created);
978 978
 					}
979 979
 				} else {
980
-					$this->_sync($Model, $diff, '-', 'BETWEEN ' . $node[$right] . ' AND ' . ($parentNode[$right] - 1), $created);
981
-					$this->_sync($Model, $edge - $parentNode[$right] + $diff + 1, '-', '> ' . $edge, $created);
980
+					$this->_sync($Model, $diff, '-', 'BETWEEN '.$node[$right].' AND '.($parentNode[$right] - 1), $created);
981
+					$this->_sync($Model, $edge - $parentNode[$right] + $diff + 1, '-', '> '.$edge, $created);
982 982
 				}
983 983
 			}
984 984
 		}
@@ -999,10 +999,10 @@  discard block
 block discarded – undo
999 999
 		$db = ConnectionManager::getDataSource($Model->useDbConfig);
1000 1000
 		if ($created) {
1001 1001
 			if (is_string($scope)) {
1002
-				$scope .= " AND " . $Model->escapeField() . " <> ";
1002
+				$scope .= " AND ".$Model->escapeField()." <> ";
1003 1003
 				$scope .= $db->value($Model->id, $Model->getColumnType($Model->primaryKey));
1004 1004
 			} else {
1005
-				$scope['NOT'][$Model->alias . '.' . $Model->primaryKey] = $Model->id;
1005
+				$scope['NOT'][$Model->alias.'.'.$Model->primaryKey] = $Model->id;
1006 1006
 			}
1007 1007
 		}
1008 1008
 		$name = $Model->escapeField($right);
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 			$field = $right;
1060 1060
 		}
1061 1061
 		if (is_string($conditions)) {
1062
-			$conditions = array($Model->escapeField($field) . " {$conditions}");
1062
+			$conditions = array($Model->escapeField($field)." {$conditions}");
1063 1063
 		}
1064 1064
 		if (($scope !== '1 = 1' && $scope !== true) && $scope) {
1065 1065
 			$conditions[] = $scope;
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 		if ($created) {
1068 1068
 			$conditions['NOT'][$Model->escapeField()] = $Model->id;
1069 1069
 		}
1070
-		$Model->updateAll(array($Model->escapeField($field) => $Model->escapeField($field) . ' ' . $dir . ' ' . $shift), $conditions);
1070
+		$Model->updateAll(array($Model->escapeField($field) => $Model->escapeField($field).' '.$dir.' '.$shift), $conditions);
1071 1071
 		$Model->recursive = $ModelRecursive;
1072 1072
 	}
1073 1073
 
Please login to merge, or discard this patch.
lib/Cake/Model/BehaviorCollection.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
  *
74 74
  * @param string $behavior
75 75
  * @param array $config
76
- * @return void
76
+ * @return boolean
77 77
  * @deprecated Will be removed in 3.0. Replaced with load().
78 78
  */
79 79
 	public function attach($behavior, $config = array()) {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	public function init($modelName, $behaviors = array()) {
62 62
 		$this->modelName = $modelName;
63 63
 
64
-		if (!empty($behaviors)) {
64
+		if ( ! empty($behaviors)) {
65 65
 			foreach (BehaviorCollection::normalizeObjectArray($behaviors) as $config) {
66 66
 				$this->load($config['class'], $config['settings']);
67 67
 			}
@@ -110,21 +110,21 @@  discard block
 block discarded – undo
110 110
 		unset($config['enabled'], $config['className'], $config['priority']);
111 111
 
112 112
 		list($plugin, $name) = pluginSplit($behavior, true);
113
-		if (!isset($alias)) {
113
+		if ( ! isset($alias)) {
114 114
 			$alias = $name;
115 115
 		}
116 116
 
117
-		$class = $name . 'Behavior';
117
+		$class = $name.'Behavior';
118 118
 
119
-		App::uses($class, $plugin . 'Model/Behavior');
120
-		if (!class_exists($class)) {
119
+		App::uses($class, $plugin.'Model/Behavior');
120
+		if ( ! class_exists($class)) {
121 121
 			throw new MissingBehaviorException(array(
122 122
 				'class' => $class,
123 123
 				'plugin' => substr($plugin, 0, -1)
124 124
 			));
125 125
 		}
126 126
 
127
-		if (!isset($this->{$alias})) {
127
+		if ( ! isset($this->{$alias})) {
128 128
 			if (ClassRegistry::isKeySet($class)) {
129 129
 				$this->_loaded[$alias] = ClassRegistry::getObject($class);
130 130
 			} else {
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 		);
156 156
 
157 157
 		foreach ($methods as $m) {
158
-			if (!isset($parentMethods[$m])) {
158
+			if ( ! isset($parentMethods[$m])) {
159 159
 				$methodAllowed = (
160
-					$m[0] !== '_' && !array_key_exists($m, $this->_methods) &&
161
-					!in_array($m, $callbacks)
160
+					$m[0] !== '_' && ! array_key_exists($m, $this->_methods) &&
161
+					! in_array($m, $callbacks)
162 162
 				);
163 163
 				if ($methodAllowed) {
164 164
 					$this->_methods[$m] = array($alias, $m);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 		if ($configDisabled) {
170 170
 			$this->disable($alias);
171
-		} elseif (!$this->enabled($alias)) {
171
+		} elseif ( ! $this->enabled($alias)) {
172 172
 			$this->enable($alias);
173 173
 		} else {
174 174
 			$this->setPriority($alias, $priority);
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			return $callback ? $this->_methods[$method] : true;
264 264
 		}
265 265
 		foreach ($this->_mappedMethods as $pattern => $target) {
266
-			if (preg_match($pattern . 'i', $method)) {
266
+			if (preg_match($pattern.'i', $method)) {
267 267
 				if ($callback) {
268 268
 					$target[] = $method;
269 269
 					return $target;
Please login to merge, or discard this patch.
lib/Cake/Model/Datasource/CakeSession.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 /**
306 306
  * Returns last occurred error as a string, if any.
307 307
  *
308
- * @return mixed Error description as a string, or false.
308
+ * @return string|false Error description as a string, or false.
309 309
  */
310 310
 	public static function error() {
311 311
 		if (self::$lastError) {
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
  * Find the handler class and make sure it implements the correct interface.
526 526
  *
527 527
  * @param string $handler
528
- * @return void
528
+ * @return CakeSessionHandlerInterface
529 529
  * @throws CakeSessionException
530 530
  */
531 531
 	protected static function _getHandler($handler) {
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 		self::$time = time();
138 138
 
139 139
 		if (env('HTTP_USER_AGENT')) {
140
-			self::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
140
+			self::$_userAgent = md5(env('HTTP_USER_AGENT').Configure::read('Security.salt'));
141 141
 		}
142 142
 
143 143
 		self::_setPath($base);
144 144
 		self::_setHost(env('HTTP_HOST'));
145 145
 
146
-		if (!self::$_initialized) {
146
+		if ( ! self::$_initialized) {
147 147
 			register_shutdown_function('session_write_close');
148 148
 		}
149 149
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		$id = self::id();
197 197
 		self::_startSession();
198 198
 
199
-		if (!$id && self::started()) {
199
+		if ( ! $id && self::started()) {
200 200
 			self::_checkValid();
201 201
 		}
202 202
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * @return boolean True if variable is there
222 222
  */
223 223
 	public static function check($name = null) {
224
-		if (!self::start()) {
224
+		if ( ! self::start()) {
225 225
 			return false;
226 226
 		}
227 227
 		if (empty($name)) {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	public static function delete($name) {
265 265
 		if (self::check($name)) {
266 266
 			self::_overwrite($_SESSION, Hash::remove($_SESSION, $name));
267
-			return !self::check($name);
267
+			return ! self::check($name);
268 268
 		}
269 269
 		return false;
270 270
 	}
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
  * @return void
278 278
  */
279 279
 	protected static function _overwrite(&$old, $new) {
280
-		if (!empty($old)) {
280
+		if ( ! empty($old)) {
281 281
 			foreach ($old as $key => $var) {
282
-				if (!isset($new[$key])) {
282
+				if ( ! isset($new[$key])) {
283 283
 					unset($old[$key]);
284 284
 				}
285 285
 			}
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
  * @return string Error as string
297 297
  */
298 298
 	protected static function _error($errorNumber) {
299
-		if (!is_array(self::$error) || !array_key_exists($errorNumber, self::$error)) {
299
+		if ( ! is_array(self::$error) || ! array_key_exists($errorNumber, self::$error)) {
300 300
 			return false;
301 301
 		}
302 302
 		return self::$error[$errorNumber];
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
  * @return mixed The value of the session variable
372 372
  */
373 373
 	public static function read($name = null) {
374
-		if (!self::start()) {
374
+		if ( ! self::start()) {
375 375
 			return false;
376 376
 		}
377 377
 		if ($name === null) {
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
  * @return mixed Full $_SESSION array, or false on error.
395 395
  */
396 396
 	protected static function _returnSessionVars() {
397
-		if (!empty($_SESSION)) {
397
+		if ( ! empty($_SESSION)) {
398 398
 			return $_SESSION;
399 399
 		}
400 400
 		self::_setError(2, 'No Session vars set');
@@ -409,14 +409,14 @@  discard block
 block discarded – undo
409 409
  * @return boolean True if the write was successful, false if the write failed
410 410
  */
411 411
 	public static function write($name, $value = null) {
412
-		if (!self::start()) {
412
+		if ( ! self::start()) {
413 413
 			return false;
414 414
 		}
415 415
 		if (empty($name)) {
416 416
 			return false;
417 417
 		}
418 418
 		$write = $name;
419
-		if (!is_array($name)) {
419
+		if ( ! is_array($name)) {
420 420
 			$write = array($name => $value);
421 421
 		}
422 422
 		foreach ($write as $key => $val) {
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
  * @return void
435 435
  */
436 436
 	public static function destroy() {
437
-		if (!self::started()) {
437
+		if ( ! self::started()) {
438 438
 			self::_startSession();
439 439
 		}
440 440
 
@@ -472,30 +472,30 @@  discard block
 block discarded – undo
472 472
 				$sessionConfig = Hash::merge($defaults, $sessionConfig);
473 473
 			}
474 474
 		}
475
-		if (!isset($sessionConfig['ini']['session.cookie_secure']) && env('HTTPS')) {
475
+		if ( ! isset($sessionConfig['ini']['session.cookie_secure']) && env('HTTPS')) {
476 476
 			$sessionConfig['ini']['session.cookie_secure'] = 1;
477 477
 		}
478
-		if (isset($sessionConfig['timeout']) && !isset($sessionConfig['cookieTimeout'])) {
478
+		if (isset($sessionConfig['timeout']) && ! isset($sessionConfig['cookieTimeout'])) {
479 479
 			$sessionConfig['cookieTimeout'] = $sessionConfig['timeout'];
480 480
 		}
481
-		if (!isset($sessionConfig['ini']['session.cookie_lifetime'])) {
481
+		if ( ! isset($sessionConfig['ini']['session.cookie_lifetime'])) {
482 482
 			$sessionConfig['ini']['session.cookie_lifetime'] = $sessionConfig['cookieTimeout'] * 60;
483 483
 		}
484
-		if (!isset($sessionConfig['ini']['session.name'])) {
484
+		if ( ! isset($sessionConfig['ini']['session.name'])) {
485 485
 			$sessionConfig['ini']['session.name'] = $sessionConfig['cookie'];
486 486
 		}
487
-		if (!empty($sessionConfig['handler'])) {
487
+		if ( ! empty($sessionConfig['handler'])) {
488 488
 			$sessionConfig['ini']['session.save_handler'] = 'user';
489 489
 		}
490
-		if (!isset($sessionConfig['ini']['session.gc_maxlifetime'])) {
490
+		if ( ! isset($sessionConfig['ini']['session.gc_maxlifetime'])) {
491 491
 			$sessionConfig['ini']['session.gc_maxlifetime'] = $sessionConfig['timeout'] * 60;
492 492
 		}
493
-		if (!isset($sessionConfig['ini']['session.cookie_httponly'])) {
493
+		if ( ! isset($sessionConfig['ini']['session.cookie_httponly'])) {
494 494
 			$sessionConfig['ini']['session.cookie_httponly'] = 1;
495 495
 		}
496 496
 
497 497
 		if (empty($_SESSION)) {
498
-			if (!empty($sessionConfig['ini']) && is_array($sessionConfig['ini'])) {
498
+			if ( ! empty($sessionConfig['ini']) && is_array($sessionConfig['ini'])) {
499 499
 				foreach ($sessionConfig['ini'] as $setting => $value) {
500 500
 					if (ini_set($setting, $value) === false) {
501 501
 						throw new CakeSessionException(__d('cake_dev', 'Unable to configure the session, setting %s failed.', $setting));
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 				}
504 504
 			}
505 505
 		}
506
-		if (!empty($sessionConfig['handler']) && !isset($sessionConfig['handler']['engine'])) {
506
+		if ( ! empty($sessionConfig['handler']) && ! isset($sessionConfig['handler']['engine'])) {
507 507
 			call_user_func_array('session_set_save_handler', $sessionConfig['handler']);
508 508
 		}
509
-		if (!empty($sessionConfig['handler']['engine'])) {
509
+		if ( ! empty($sessionConfig['handler']['engine'])) {
510 510
 			$handler = self::_getHandler($sessionConfig['handler']['engine']);
511 511
 			session_set_save_handler(
512 512
 				array($handler, 'open'),
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
  */
531 531
 	protected static function _getHandler($handler) {
532 532
 		list($plugin, $class) = pluginSplit($handler, true);
533
-		App::uses($class, $plugin . 'Model/Datasource/Session');
534
-		if (!class_exists($class)) {
533
+		App::uses($class, $plugin.'Model/Datasource/Session');
534
+		if ( ! class_exists($class)) {
535 535
 			throw new CakeSessionException(__d('cake_dev', 'Could not load %s to handle the session.', $class));
536 536
 		}
537 537
 		$handler = new $class();
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 					'session.serialize_handler' => 'php',
567 567
 					'session.use_cookies' => 1,
568 568
 					'session.cookie_path' => self::$path,
569
-					'session.save_path' => TMP . 'sessions',
569
+					'session.save_path' => TMP.'sessions',
570 570
 					'session.save_handler' => 'files'
571 571
 				)
572 572
 			),
Please login to merge, or discard this patch.
lib/Cake/Model/Datasource/Database/Mysql.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
  * @param array $fields
368 368
  * @param array $values
369 369
  * @param mixed $conditions
370
- * @return array
370
+ * @return boolean
371 371
  */
372 372
 	public function update(Model $model, $fields = array(), $values = null, $conditions = null) {
373 373
 		if (!$this->_useAlias) {
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
  *
507 507
  * @param array $compare Result of a CakeSchema::compare()
508 508
  * @param string $table
509
- * @return array Array of alter statements to make.
509
+ * @return false|string Array of alter statements to make.
510 510
  */
511 511
 	public function alterSchema($compare, $table = null) {
512 512
 		if (!is_array($compare)) {
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 			PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
151 151
 		);
152 152
 
153
-		if (!empty($config['encoding'])) {
154
-			$flags[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $config['encoding'];
153
+		if ( ! empty($config['encoding'])) {
154
+			$flags[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES '.$config['encoding'];
155 155
 		}
156
-		if (!empty($config['ssl_key']) && !empty($config['ssl_cert'])) {
156
+		if ( ! empty($config['ssl_key']) && ! empty($config['ssl_cert'])) {
157 157
 			$flags[PDO::MYSQL_ATTR_SSL_KEY] = $config['ssl_key'];
158 158
 			$flags[PDO::MYSQL_ATTR_SSL_CERT] = $config['ssl_cert'];
159 159
 		}
160
-		if (!empty($config['ssl_ca'])) {
160
+		if ( ! empty($config['ssl_ca'])) {
161 161
 			$flags[PDO::MYSQL_ATTR_SSL_CA] = $config['ssl_ca'];
162 162
 		}
163 163
 		if (empty($config['unix_socket'])) {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				$flags
175 175
 			);
176 176
 			$this->connected = true;
177
-			if (!empty($config['settings'])) {
177
+			if ( ! empty($config['settings'])) {
178 178
 				foreach ($config['settings'] as $key => $value) {
179 179
 					$this->_execute("SET $key=$value");
180 180
 				}
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		}
188 188
 
189 189
 		$this->_charsets = array();
190
-		$this->_useAlias = (bool)version_compare($this->getVersion(), "4.1", ">=");
190
+		$this->_useAlias = (bool) version_compare($this->getVersion(), "4.1", ">=");
191 191
 
192 192
 		return $this->connected;
193 193
 	}
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 		if ($cache) {
213 213
 			return $cache;
214 214
 		}
215
-		$result = $this->_execute('SHOW TABLES FROM ' . $this->name($this->config['database']));
215
+		$result = $this->_execute('SHOW TABLES FROM '.$this->name($this->config['database']));
216 216
 
217
-		if (!$result) {
217
+		if ( ! $result) {
218 218
 			$result->closeCursor();
219 219
 			return array();
220 220
 		}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			} else {
248 248
 				$type = empty($column['native_type']) ? 'string' : $column['native_type'];
249 249
 			}
250
-			if (!empty($column['table']) && strpos($column['name'], $this->virtualFieldSeparator) === false) {
250
+			if ( ! empty($column['table']) && strpos($column['name'], $this->virtualFieldSeparator) === false) {
251 251
 				$this->map[$index++] = array($column['table'], $column['name'], $type);
252 252
 			} else {
253 253
 				$this->map[$index++] = array(0, $column['name'], $type);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
  * @return string Character set name
293 293
  */
294 294
 	public function getCharsetName($name) {
295
-		if ((bool)version_compare($this->getVersion(), "5", "<")) {
295
+		if ((bool) version_compare($this->getVersion(), "5", "<")) {
296 296
 			return false;
297 297
 		}
298 298
 		if (isset($this->_charsets[$name])) {
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 		$table = $this->fullTableName($model);
329 329
 
330 330
 		$fields = false;
331
-		$cols = $this->_execute('SHOW FULL COLUMNS FROM ' . $table);
332
-		if (!$cols) {
331
+		$cols = $this->_execute('SHOW FULL COLUMNS FROM '.$table);
332
+		if ( ! $cols) {
333 333
 			throw new CakeException(__d('cake_dev', 'Could not describe table for %s', $table));
334 334
 		}
335 335
 
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 				'default' => $column->Default,
341 341
 				'length' => $this->length($column->Type),
342 342
 			);
343
-			if (!empty($column->Key) && isset($this->index[$column->Key])) {
343
+			if ( ! empty($column->Key) && isset($this->index[$column->Key])) {
344 344
 				$fields[$column->Field]['key'] = $this->index[$column->Key];
345 345
 			}
346 346
 			foreach ($this->fieldParameters as $name => $value) {
347
-				if (!empty($column->{$value['column']})) {
347
+				if ( ! empty($column->{$value['column']})) {
348 348
 					$fields[$column->Field][$name] = $column->{$value['column']};
349 349
 				}
350 350
 			}
@@ -370,22 +370,22 @@  discard block
 block discarded – undo
370 370
  * @return array
371 371
  */
372 372
 	public function update(Model $model, $fields = array(), $values = null, $conditions = null) {
373
-		if (!$this->_useAlias) {
373
+		if ( ! $this->_useAlias) {
374 374
 			return parent::update($model, $fields, $values, $conditions);
375 375
 		}
376 376
 
377
-		if (!$values) {
377
+		if ( ! $values) {
378 378
 			$combined = $fields;
379 379
 		} else {
380 380
 			$combined = array_combine($fields, $values);
381 381
 		}
382 382
 
383 383
 		$alias = $joins = false;
384
-		$fields = $this->_prepareUpdateFields($model, $combined, empty($conditions), !empty($conditions));
384
+		$fields = $this->_prepareUpdateFields($model, $combined, empty($conditions), ! empty($conditions));
385 385
 		$fields = implode(', ', $fields);
386 386
 		$table = $this->fullTableName($model);
387 387
 
388
-		if (!empty($conditions)) {
388
+		if ( ! empty($conditions)) {
389 389
 			$alias = $this->name($model->alias);
390 390
 			if ($model->name === $model->alias) {
391 391
 				$joins = implode(' ', $this->_getJoins($model));
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			return false;
398 398
 		}
399 399
 
400
-		if (!$this->execute($this->renderStatement('update', compact('table', 'alias', 'joins', 'fields', 'conditions')))) {
400
+		if ( ! $this->execute($this->renderStatement('update', compact('table', 'alias', 'joins', 'fields', 'conditions')))) {
401 401
 			$model->onError();
402 402
 			return false;
403 403
 		}
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
  * @return boolean Success
413 413
  */
414 414
 	public function delete(Model $model, $conditions = null) {
415
-		if (!$this->_useAlias) {
415
+		if ( ! $this->_useAlias) {
416 416
 			return parent::delete($model, $conditions);
417 417
 		}
418 418
 		$alias = $this->name($model->alias);
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 			$alias = $joins = false;
424 424
 		}
425 425
 		$complexConditions = false;
426
-		foreach ((array)$conditions as $key => $value) {
426
+		foreach ((array) $conditions as $key => $value) {
427 427
 			if (strpos($key, $model->alias) === false) {
428 428
 				$complexConditions = true;
429 429
 				break;
430 430
 			}
431 431
 		}
432
-		if (!$complexConditions) {
432
+		if ( ! $complexConditions) {
433 433
 			$joins = false;
434 434
 		}
435 435
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
  * @return boolean
452 452
  */
453 453
 	public function setEncoding($enc) {
454
-		return $this->_execute('SET NAMES ' . $enc) !== false;
454
+		return $this->_execute('SET NAMES '.$enc) !== false;
455 455
 	}
456 456
 
457 457
 /**
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
 		$table = $this->fullTableName($model);
466 466
 		$old = version_compare($this->getVersion(), '4.1', '<=');
467 467
 		if ($table) {
468
-			$indexes = $this->_execute('SHOW INDEX FROM ' . $table);
468
+			$indexes = $this->_execute('SHOW INDEX FROM '.$table);
469 469
 			// @codingStandardsIgnoreStart
470 470
 			// MySQL columns don't match the cakephp conventions.
471 471
 			while ($idx = $indexes->fetch(PDO::FETCH_OBJ)) {
472 472
 				if ($old) {
473
-					$idx = (object)current((array)$idx);
473
+					$idx = (object) current((array) $idx);
474 474
 				}
475
-				if (!isset($index[$idx->Key_name]['column'])) {
475
+				if ( ! isset($index[$idx->Key_name]['column'])) {
476 476
 					$col = array();
477 477
 					$index[$idx->Key_name]['column'] = $idx->Column_name;
478 478
 
@@ -482,14 +482,14 @@  discard block
 block discarded – undo
482 482
 						$index[$idx->Key_name]['unique'] = intval($idx->Non_unique == 0);
483 483
 					}
484 484
 				} else {
485
-					if (!empty($index[$idx->Key_name]['column']) && !is_array($index[$idx->Key_name]['column'])) {
485
+					if ( ! empty($index[$idx->Key_name]['column']) && ! is_array($index[$idx->Key_name]['column'])) {
486 486
 						$col[] = $index[$idx->Key_name]['column'];
487 487
 					}
488 488
 					$col[] = $idx->Column_name;
489 489
 					$index[$idx->Key_name]['column'] = $col;
490 490
 				}
491
-				if (!empty($idx->Sub_part)) {
492
-					if (!isset($index[$idx->Key_name]['length'])) {
491
+				if ( ! empty($idx->Sub_part)) {
492
+					if ( ! isset($index[$idx->Key_name]['length'])) {
493 493
 						$index[$idx->Key_name]['length'] = array();
494 494
 					}
495 495
 					$index[$idx->Key_name]['length'][$idx->Column_name] = $idx->Sub_part;
@@ -509,15 +509,15 @@  discard block
 block discarded – undo
509 509
  * @return array Array of alter statements to make.
510 510
  */
511 511
 	public function alterSchema($compare, $table = null) {
512
-		if (!is_array($compare)) {
512
+		if ( ! is_array($compare)) {
513 513
 			return false;
514 514
 		}
515 515
 		$out = '';
516 516
 		$colList = array();
517 517
 		foreach ($compare as $curTable => $types) {
518 518
 			$indexes = $tableParameters = $colList = array();
519
-			if (!$table || $table === $curTable) {
520
-				$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
519
+			if ( ! $table || $table === $curTable) {
520
+				$out .= 'ALTER TABLE '.$this->fullTableName($curTable)." \n";
521 521
 				foreach ($types as $type => $column) {
522 522
 					if (isset($column['indexes'])) {
523 523
 						$indexes[$type] = $column['indexes'];
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
 						case 'add':
532 532
 							foreach ($column as $field => $col) {
533 533
 								$col['name'] = $field;
534
-								$alter = 'ADD ' . $this->buildColumn($col);
534
+								$alter = 'ADD '.$this->buildColumn($col);
535 535
 								if (isset($col['after'])) {
536
-									$alter .= ' AFTER ' . $this->name($col['after']);
536
+									$alter .= ' AFTER '.$this->name($col['after']);
537 537
 								}
538 538
 								$colList[] = $alter;
539 539
 							}
@@ -541,22 +541,22 @@  discard block
 block discarded – undo
541 541
 						case 'drop':
542 542
 							foreach ($column as $field => $col) {
543 543
 								$col['name'] = $field;
544
-								$colList[] = 'DROP ' . $this->name($field);
544
+								$colList[] = 'DROP '.$this->name($field);
545 545
 							}
546 546
 							break;
547 547
 						case 'change':
548 548
 							foreach ($column as $field => $col) {
549
-								if (!isset($col['name'])) {
549
+								if ( ! isset($col['name'])) {
550 550
 									$col['name'] = $field;
551 551
 								}
552
-								$colList[] = 'CHANGE ' . $this->name($field) . ' ' . $this->buildColumn($col);
552
+								$colList[] = 'CHANGE '.$this->name($field).' '.$this->buildColumn($col);
553 553
 							}
554 554
 							break;
555 555
 					}
556 556
 				}
557 557
 				$colList = array_merge($colList, $this->_alterIndexes($curTable, $indexes));
558 558
 				$colList = array_merge($colList, $this->_alterTableParameters($curTable, $tableParameters));
559
-				$out .= "\t" . implode(",\n\t", $colList) . ";\n\n";
559
+				$out .= "\t".implode(",\n\t", $colList).";\n\n";
560 560
 			}
561 561
 		}
562 562
 		return $out;
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
  * @return string Drop table SQL statement
570 570
  */
571 571
 	protected function _dropTable($table) {
572
-		return 'DROP TABLE IF EXISTS ' . $this->fullTableName($table) . ";";
572
+		return 'DROP TABLE IF EXISTS '.$this->fullTableName($table).";";
573 573
 	}
574 574
 
575 575
 /**
@@ -602,15 +602,15 @@  discard block
 block discarded – undo
602 602
 				$out .= 'PRIMARY ';
603 603
 				$name = null;
604 604
 			} else {
605
-				if (!empty($value['unique'])) {
605
+				if ( ! empty($value['unique'])) {
606 606
 					$out .= 'UNIQUE ';
607 607
 				}
608
-				$name = $this->startQuote . $name . $this->endQuote;
608
+				$name = $this->startQuote.$name.$this->endQuote;
609 609
 			}
610 610
 			if (isset($value['type']) && strtolower($value['type']) === 'fulltext') {
611 611
 				$out .= 'FULLTEXT ';
612 612
 			}
613
-			$out .= 'KEY ' . $name . ' (';
613
+			$out .= 'KEY '.$name.' (';
614 614
 
615 615
 			if (is_array($value['column'])) {
616 616
 				if (isset($value['length'])) {
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 				if ($name === 'PRIMARY') {
654 654
 					$out .= 'PRIMARY KEY';
655 655
 				} else {
656
-					$out .= 'KEY ' . $this->startQuote . $name . $this->endQuote;
656
+					$out .= 'KEY '.$this->startQuote.$name.$this->endQuote;
657 657
 				}
658 658
 				$alter[] = $out;
659 659
 			}
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 		if (isset($indexes['add'])) {
662 662
 			$add = $this->buildIndex($indexes['add']);
663 663
 			foreach ($add as $index) {
664
-				$alter[] = 'ADD ' . $index;
664
+				$alter[] = 'ADD '.$index;
665 665
 			}
666 666
 		}
667 667
 		return $alter;
@@ -678,10 +678,10 @@  discard block
 block discarded – undo
678 678
 		if ($lengths === null) {
679 679
 			return '';
680 680
 		}
681
-		if (!isset($lengths[$column])) {
681
+		if ( ! isset($lengths[$column])) {
682 682
 			return '';
683 683
 		}
684
-		return '(' . $lengths[$column] . ')';
684
+		return '('.$lengths[$column].')';
685 685
 	}
686 686
 
687 687
 /**
@@ -693,19 +693,19 @@  discard block
 block discarded – undo
693 693
 	public function listDetailedSources($name = null) {
694 694
 		$condition = '';
695 695
 		if (is_string($name)) {
696
-			$condition = ' WHERE name = ' . $this->value($name);
696
+			$condition = ' WHERE name = '.$this->value($name);
697 697
 		}
698
-		$result = $this->_connection->query('SHOW TABLE STATUS ' . $condition, PDO::FETCH_ASSOC);
698
+		$result = $this->_connection->query('SHOW TABLE STATUS '.$condition, PDO::FETCH_ASSOC);
699 699
 
700
-		if (!$result) {
700
+		if ( ! $result) {
701 701
 			$result->closeCursor();
702 702
 			return array();
703 703
 		}
704 704
 		$tables = array();
705 705
 		foreach ($result as $row) {
706
-			$tables[$row['Name']] = (array)$row;
706
+			$tables[$row['Name']] = (array) $row;
707 707
 			unset($tables[$row['Name']]['queryString']);
708
-			if (!empty($row['Collation'])) {
708
+			if ( ! empty($row['Collation'])) {
709 709
 				$charset = $this->getCharsetName($row['Collation']);
710 710
 				if ($charset) {
711 711
 					$tables[$row['Name']]['charset'] = $charset;
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 		if (is_array($real)) {
730 730
 			$col = $real['name'];
731 731
 			if (isset($real['limit'])) {
732
-				$col .= '(' . $real['limit'] . ')';
732
+				$col .= '('.$real['limit'].')';
733 733
 			}
734 734
 			return $col;
735 735
 		}
Please login to merge, or discard this patch.
lib/Cake/Model/Datasource/Database/Postgres.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 /**
293 293
  * Gets the associated sequence for the given table/field
294 294
  *
295
- * @param string|Model $table Either a full table name (with prefix) as a string, or a model object
295
+ * @param string|null $table Either a full table name (with prefix) as a string, or a model object
296 296
  * @param string $field Name of the ID database field. Defaults to "id"
297 297
  * @return string The associated sequence name from the sequence map, defaults to "{$table}_{$field}_seq"
298 298
  */
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
  *
498 498
  * @param array $compare Results of CakeSchema::compare()
499 499
  * @param string $table name of the table
500
- * @return array
500
+ * @return false|string
501 501
  */
502 502
 	public function alterSchema($compare, $table = null) {
503 503
 		if (!is_array($compare)) {
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
  *
784 784
  * @param mixed $data Value to be translated
785 785
  * @param boolean $quote true to quote a boolean to be used in a query, false to return the boolean value
786
- * @return boolean Converted boolean value
786
+ * @return string|boolean Converted boolean value
787 787
  */
788 788
 	public function boolean($data, $quote = false) {
789 789
 		switch (true) {
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 			);
124 124
 
125 125
 			$this->connected = true;
126
-			if (!empty($config['encoding'])) {
126
+			if ( ! empty($config['encoding'])) {
127 127
 				$this->setEncoding($config['encoding']);
128 128
 			}
129
-			if (!empty($config['schema'])) {
130
-				$this->_execute('SET search_path TO "' . $config['schema'] . '"');
129
+			if ( ! empty($config['schema'])) {
130
+				$this->_execute('SET search_path TO "'.$config['schema'].'"');
131 131
 			}
132
-			if (!empty($config['settings'])) {
132
+			if ( ! empty($config['settings'])) {
133 133
 				foreach ($config['settings'] as $key => $value) {
134 134
 					$this->_execute("SET $key TO $value");
135 135
 				}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		$sql = "SELECT table_name as name FROM INFORMATION_SCHEMA.tables WHERE table_schema = ?";
171 171
 		$result = $this->_execute($sql, array($schema));
172 172
 
173
-		if (!$result) {
173
+		if ( ! $result) {
174 174
 			return array();
175 175
 		}
176 176
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			// Postgres columns don't match the coding standards.
211 211
 			foreach ($cols as $c) {
212 212
 				$type = $c->type;
213
-				if (!empty($c->oct_length) && $c->char_length === null) {
213
+				if ( ! empty($c->oct_length) && $c->char_length === null) {
214 214
 					if ($c->type === 'character varying') {
215 215
 						$length = null;
216 216
 						$type = 'text';
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 					} else {
220 220
 						$length = intval($c->oct_length);
221 221
 					}
222
-				} elseif (!empty($c->char_length)) {
222
+				} elseif ( ! empty($c->char_length)) {
223 223
 					$length = intval($c->char_length);
224 224
 				} else {
225 225
 					$length = $this->length($c->type);
@@ -250,16 +250,16 @@  discard block
 block discarded – undo
250 250
 					preg_match('/nextval\([\'"]?([\w.]+)/', $c->default, $seq)
251 251
 				) {
252 252
 					$fields[$c->name]['default'] = null;
253
-					if (!empty($seq) && isset($seq[1])) {
253
+					if ( ! empty($seq) && isset($seq[1])) {
254 254
 						if (strpos($seq[1], '.') === false) {
255
-							$sequenceName = $c->schema . '.' . $seq[1];
255
+							$sequenceName = $c->schema.'.'.$seq[1];
256 256
 						} else {
257 257
 							$sequenceName = $seq[1];
258 258
 						}
259 259
 						$this->_sequenceMap[$table][$c->name] = $sequenceName;
260 260
 					}
261 261
 				}
262
-				if ($fields[$c->name]['type'] === 'boolean' && !empty($fields[$c->name]['default'])) {
262
+				if ($fields[$c->name]['type'] === 'boolean' && ! empty($fields[$c->name]['default'])) {
263 263
 					$fields[$c->name]['default'] = constant($fields[$c->name]['default']);
264 264
 				}
265 265
 			}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 		if (is_object($table)) {
301 301
 			$table = $this->fullTableName($table, false, false);
302 302
 		}
303
-		if (!isset($this->_sequenceMap[$table])) {
303
+		if ( ! isset($this->_sequenceMap[$table])) {
304 304
 			$this->describe($table);
305 305
 		}
306 306
 		if (isset($this->_sequenceMap[$table][$field])) {
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
  */
339 339
 	public function truncate($table, $reset = false) {
340 340
 		$table = $this->fullTableName($table, false, false);
341
-		if (!isset($this->_sequenceMap[$table])) {
341
+		if ( ! isset($this->_sequenceMap[$table])) {
342 342
 			$cache = $this->cacheSources;
343 343
 			$this->cacheSources = false;
344 344
 			$this->describe($table);
345 345
 			$this->cacheSources = $cache;
346 346
 		}
347
-		if ($this->execute('DELETE FROM ' . $this->fullTableName($table))) {
347
+		if ($this->execute('DELETE FROM '.$this->fullTableName($table))) {
348 348
 			if (isset($this->_sequenceMap[$table]) && $reset != true) {
349 349
 				foreach ($this->_sequenceMap[$table] as $sequence) {
350 350
 					list($schema, $sequence) = explode('.', $sequence);
@@ -384,17 +384,17 @@  discard block
 block discarded – undo
384 384
 		}
385 385
 		$fields = parent::fields($model, $alias, $fields, false);
386 386
 
387
-		if (!$quote) {
387
+		if ( ! $quote) {
388 388
 			return $fields;
389 389
 		}
390 390
 		$count = count($fields);
391 391
 
392
-		if ($count >= 1 && !preg_match('/^\s*COUNT\(\*/', $fields[0])) {
392
+		if ($count >= 1 && ! preg_match('/^\s*COUNT\(\*/', $fields[0])) {
393 393
 			$result = array();
394 394
 			for ($i = 0; $i < $count; $i++) {
395
-				if (!preg_match('/^.+\\(.*\\)/', $fields[$i]) && !preg_match('/\s+AS\s+/', $fields[$i])) {
395
+				if ( ! preg_match('/^.+\\(.*\\)/', $fields[$i]) && ! preg_match('/\s+AS\s+/', $fields[$i])) {
396 396
 					if (substr($fields[$i], -1) === '*') {
397
-						if (strpos($fields[$i], '.') !== false && $fields[$i] != $alias . '.*') {
397
+						if (strpos($fields[$i], '.') !== false && $fields[$i] != $alias.'.*') {
398 398
 							$build = explode('.', $fields[$i]);
399 399
 							$AssociatedModel = $model->{$build[0]};
400 400
 						} else {
@@ -413,10 +413,10 @@  discard block
 block discarded – undo
413 413
 					}
414 414
 
415 415
 					if (strrpos($fields[$i], '.') === false) {
416
-						$fields[$i] = $prepend . $this->name($alias) . '.' . $this->name($fields[$i]) . ' AS ' . $this->name($alias . '__' . $fields[$i]);
416
+						$fields[$i] = $prepend.$this->name($alias).'.'.$this->name($fields[$i]).' AS '.$this->name($alias.'__'.$fields[$i]);
417 417
 					} else {
418 418
 						$build = explode('.', $fields[$i]);
419
-						$fields[$i] = $prepend . $this->name($build[0]) . '.' . $this->name($build[1]) . ' AS ' . $this->name($build[0] . '__' . $build[1]);
419
+						$fields[$i] = $prepend.$this->name($build[0]).'.'.$this->name($build[1]).' AS '.$this->name($build[0].'__'.$build[1]);
420 420
 					}
421 421
 				} else {
422 422
 					$fields[$i] = preg_replace_callback('/\(([\s\.\w]+)\)/', array(&$this, '_quoteFunctionField'), $fields[$i]);
@@ -443,15 +443,15 @@  discard block
 block discarded – undo
443 443
 		}
444 444
 		$constant = preg_match('/^\d+|NULL|FALSE|TRUE$/i', $match[1]);
445 445
 
446
-		if (!$constant && strpos($match[1], '.') === false) {
446
+		if ( ! $constant && strpos($match[1], '.') === false) {
447 447
 			$match[1] = $this->name($match[1]);
448
-		} elseif (!$constant) {
448
+		} elseif ( ! $constant) {
449 449
 			$parts = explode('.', $match[1]);
450
-			if (!Hash::numeric($parts)) {
450
+			if ( ! Hash::numeric($parts)) {
451 451
 				$match[1] = $this->name($match[1]);
452 452
 			}
453 453
 		}
454
-		return '(' . $prepend . $match[1] . ')';
454
+		return '('.$prepend.$match[1].')';
455 455
 	}
456 456
 
457 457
 /**
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
 			WHERE c.oid  = (
470 470
 				SELECT c.oid
471 471
 				FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
472
-				WHERE c.relname ~ '^(" . $table . ")$'
472
+				WHERE c.relname ~ '^(" . $table.")$'
473 473
 					AND pg_catalog.pg_table_is_visible(c.oid)
474
-					AND n.nspname ~ '^(" . $this->config['schema'] . ")$'
474
+					AND n.nspname ~ '^(" . $this->config['schema'].")$'
475 475
 			)
476 476
 			AND c.oid = i.indrelid AND i.indexrelid = c2.oid
477 477
 			ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname", false);
@@ -500,15 +500,15 @@  discard block
 block discarded – undo
500 500
  * @return array
501 501
  */
502 502
 	public function alterSchema($compare, $table = null) {
503
-		if (!is_array($compare)) {
503
+		if ( ! is_array($compare)) {
504 504
 			return false;
505 505
 		}
506 506
 		$out = '';
507 507
 		$colList = array();
508 508
 		foreach ($compare as $curTable => $types) {
509 509
 			$indexes = $colList = array();
510
-			if (!$table || $table === $curTable) {
511
-				$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
510
+			if ( ! $table || $table === $curTable) {
511
+				$out .= 'ALTER TABLE '.$this->fullTableName($curTable)." \n";
512 512
 				foreach ($types as $type => $column) {
513 513
 					if (isset($column['indexes'])) {
514 514
 						$indexes[$type] = $column['indexes'];
@@ -518,19 +518,19 @@  discard block
 block discarded – undo
518 518
 						case 'add':
519 519
 							foreach ($column as $field => $col) {
520 520
 								$col['name'] = $field;
521
-								$colList[] = 'ADD COLUMN ' . $this->buildColumn($col);
521
+								$colList[] = 'ADD COLUMN '.$this->buildColumn($col);
522 522
 							}
523 523
 							break;
524 524
 						case 'drop':
525 525
 							foreach ($column as $field => $col) {
526 526
 								$col['name'] = $field;
527
-								$colList[] = 'DROP COLUMN ' . $this->name($field);
527
+								$colList[] = 'DROP COLUMN '.$this->name($field);
528 528
 							}
529 529
 							break;
530 530
 						case 'change':
531 531
 							$schema = $this->describe($curTable);
532 532
 							foreach ($column as $field => $col) {
533
-								if (!isset($col['name'])) {
533
+								if ( ! isset($col['name'])) {
534 534
 									$col['name'] = $field;
535 535
 								}
536 536
 								$original = $schema[$field];
@@ -543,28 +543,28 @@  discard block
 block discarded – undo
543 543
 								if ($field !== $col['name']) {
544 544
 									$newName = $this->name($col['name']);
545 545
 									$out .= "\tRENAME {$fieldName} TO {$newName};\n";
546
-									$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
546
+									$out .= 'ALTER TABLE '.$this->fullTableName($curTable)." \n";
547 547
 									$fieldName = $newName;
548 548
 								}
549 549
 
550 550
 								if ($boolToInt) {
551
-									$colList[] = 'ALTER COLUMN ' . $fieldName . '  SET DEFAULT NULL';
552
-									$colList[] = 'ALTER COLUMN ' . $fieldName . ' TYPE ' . str_replace(array($fieldName, 'NOT NULL'), '', $this->buildColumn($col)) . ' USING CASE WHEN TRUE THEN 1 ELSE 0 END';
551
+									$colList[] = 'ALTER COLUMN '.$fieldName.'  SET DEFAULT NULL';
552
+									$colList[] = 'ALTER COLUMN '.$fieldName.' TYPE '.str_replace(array($fieldName, 'NOT NULL'), '', $this->buildColumn($col)).' USING CASE WHEN TRUE THEN 1 ELSE 0 END';
553 553
 								} else {
554
-									$colList[] = 'ALTER COLUMN ' . $fieldName . ' TYPE ' . str_replace(array($fieldName, 'NOT NULL'), '', $this->buildColumn($col));
554
+									$colList[] = 'ALTER COLUMN '.$fieldName.' TYPE '.str_replace(array($fieldName, 'NOT NULL'), '', $this->buildColumn($col));
555 555
 								}
556 556
 
557 557
 								if (isset($nullable)) {
558 558
 									$nullable = ($nullable) ? 'DROP NOT NULL' : 'SET NOT NULL';
559
-									$colList[] = 'ALTER COLUMN ' . $fieldName . '  ' . $nullable;
559
+									$colList[] = 'ALTER COLUMN '.$fieldName.'  '.$nullable;
560 560
 								}
561 561
 
562 562
 								if (isset($default)) {
563
-									if (!$boolToInt) {
564
-										$colList[] = 'ALTER COLUMN ' . $fieldName . '  SET DEFAULT ' . $this->value($default, $col['type']);
563
+									if ( ! $boolToInt) {
564
+										$colList[] = 'ALTER COLUMN '.$fieldName.'  SET DEFAULT '.$this->value($default, $col['type']);
565 565
 									}
566 566
 								} else {
567
-									$colList[] = 'ALTER COLUMN ' . $fieldName . '  DROP DEFAULT';
567
+									$colList[] = 'ALTER COLUMN '.$fieldName.'  DROP DEFAULT';
568 568
 								}
569 569
 
570 570
 							}
@@ -572,18 +572,18 @@  discard block
 block discarded – undo
572 572
 					}
573 573
 				}
574 574
 				if (isset($indexes['drop']['PRIMARY'])) {
575
-					$colList[] = 'DROP CONSTRAINT ' . $curTable . '_pkey';
575
+					$colList[] = 'DROP CONSTRAINT '.$curTable.'_pkey';
576 576
 				}
577 577
 				if (isset($indexes['add']['PRIMARY'])) {
578 578
 					$cols = $indexes['add']['PRIMARY']['column'];
579 579
 					if (is_array($cols)) {
580 580
 						$cols = implode(', ', $cols);
581 581
 					}
582
-					$colList[] = 'ADD PRIMARY KEY (' . $cols . ')';
582
+					$colList[] = 'ADD PRIMARY KEY ('.$cols.')';
583 583
 				}
584 584
 
585
-				if (!empty($colList)) {
586
-					$out .= "\t" . implode(",\n\t", $colList) . ";\n\n";
585
+				if ( ! empty($colList)) {
586
+					$out .= "\t".implode(",\n\t", $colList).";\n\n";
587 587
 				} else {
588 588
 					$out = '';
589 589
 				}
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 				if ($name === 'PRIMARY') {
609 609
 					continue;
610 610
 				} else {
611
-					$out .= 'INDEX ' . $name;
611
+					$out .= 'INDEX '.$name;
612 612
 				}
613 613
 				$alter[] = $out;
614 614
 			}
@@ -619,15 +619,15 @@  discard block
 block discarded – undo
619 619
 				if ($name === 'PRIMARY') {
620 620
 					continue;
621 621
 				} else {
622
-					if (!empty($value['unique'])) {
622
+					if ( ! empty($value['unique'])) {
623 623
 						$out .= 'UNIQUE ';
624 624
 					}
625 625
 					$out .= 'INDEX ';
626 626
 				}
627 627
 				if (is_array($value['column'])) {
628
-					$out .= $name . ' ON ' . $table . ' (' . implode(', ', array_map(array(&$this, 'name'), $value['column'])) . ')';
628
+					$out .= $name.' ON '.$table.' ('.implode(', ', array_map(array(&$this, 'name'), $value['column'])).')';
629 629
 				} else {
630
-					$out .= $name . ' ON ' . $table . ' (' . $this->name($value['column']) . ')';
630
+					$out .= $name.' ON '.$table.' ('.$this->name($value['column']).')';
631 631
 				}
632 632
 				$alter[] = $out;
633 633
 			}
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 		if (is_array($real)) {
664 664
 			$col = $real['name'];
665 665
 			if (isset($real['limit'])) {
666
-				$col .= '(' . $real['limit'] . ')';
666
+				$col .= '('.$real['limit'].')';
667 667
 			}
668 668
 			return $col;
669 669
 		}
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
 				$result = ($data === 'TRUE');
801 801
 				break;
802 802
 			default:
803
-				$result = (bool)$data;
803
+				$result = (bool) $data;
804 804
 		}
805 805
 
806 806
 		if ($quote) {
807 807
 			return ($result) ? 'TRUE' : 'FALSE';
808 808
 		}
809
-		return (bool)$result;
809
+		return (bool) $result;
810 810
 	}
811 811
 
812 812
 /**
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
  * @return boolean True on success, false on failure
817 817
  */
818 818
 	public function setEncoding($enc) {
819
-		return $this->_execute('SET NAMES ' . $this->value($enc)) !== false;
819
+		return $this->_execute('SET NAMES '.$this->value($enc)) !== false;
820 820
 	}
821 821
 
822 822
 /**
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
  */
843 843
 	public function buildColumn($column) {
844 844
 		$col = $this->columns[$column['type']];
845
-		if (!isset($col['length']) && !isset($col['limit'])) {
845
+		if ( ! isset($col['length']) && ! isset($col['limit'])) {
846 846
 			unset($column['length']);
847 847
 		}
848 848
 		$out = parent::buildColumn($column);
@@ -888,15 +888,15 @@  discard block
 block discarded – undo
888 888
  */
889 889
 	public function buildIndex($indexes, $table = null) {
890 890
 		$join = array();
891
-		if (!is_array($indexes)) {
891
+		if ( ! is_array($indexes)) {
892 892
 			return array();
893 893
 		}
894 894
 		foreach ($indexes as $name => $value) {
895 895
 			if ($name === 'PRIMARY') {
896
-				$out = 'PRIMARY KEY  (' . $this->name($value['column']) . ')';
896
+				$out = 'PRIMARY KEY  ('.$this->name($value['column']).')';
897 897
 			} else {
898 898
 				$out = 'CREATE ';
899
-				if (!empty($value['unique'])) {
899
+				if ( ! empty($value['unique'])) {
900 900
 					$out .= 'UNIQUE ';
901 901
 				}
902 902
 				if (is_array($value['column'])) {
Please login to merge, or discard this patch.
lib/Cake/Model/Datasource/Database/Sqlite.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@
 block discarded – undo
204 204
  * @param array $fields
205 205
  * @param array $values
206 206
  * @param mixed $conditions
207
- * @return array
207
+ * @return boolean
208 208
  */
209 209
 	public function update(Model $model, $fields = array(), $values = null, $conditions = null) {
210 210
 		if (empty($values) && !empty($fields)) {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 			PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
111 111
 		);
112 112
 		try {
113
-			$this->_connection = new PDO('sqlite:' . $config['database'], null, null, $flags);
113
+			$this->_connection = new PDO('sqlite:'.$config['database'], null, null, $flags);
114 114
 			$this->connected = true;
115
-		} catch(PDOException $e) {
115
+		} catch (PDOException $e) {
116 116
 			throw new MissingConnectionException(array(
117 117
 				'class' => get_class($this),
118 118
 				'message' => $e->getMessage()
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 		$result = $this->fetchAll("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;", false);
146 146
 
147
-		if (!$result || empty($result)) {
147
+		if ( ! $result || empty($result)) {
148 148
 			return array();
149 149
 		}
150 150
 
@@ -170,16 +170,16 @@  discard block
 block discarded – undo
170 170
 		}
171 171
 		$fields = array();
172 172
 		$result = $this->_execute(
173
-			'PRAGMA table_info(' . $this->value($table, 'string') . ')'
173
+			'PRAGMA table_info('.$this->value($table, 'string').')'
174 174
 		);
175 175
 
176 176
 		foreach ($result as $column) {
177
-			$column = (array)$column;
177
+			$column = (array) $column;
178 178
 			$default = ($column['dflt_value'] === 'NULL') ? null : trim($column['dflt_value'], "'");
179 179
 
180 180
 			$fields[$column['name']] = array(
181 181
 				'type' => $this->column($column['type']),
182
-				'null' => !$column['notnull'],
182
+				'null' => ! $column['notnull'],
183 183
 				'default' => $default,
184 184
 				'length' => $this->length($column['type'])
185 185
 			);
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
  * @return array
208 208
  */
209 209
 	public function update(Model $model, $fields = array(), $values = null, $conditions = null) {
210
-		if (empty($values) && !empty($fields)) {
210
+		if (empty($values) && ! empty($fields)) {
211 211
 			foreach ($fields as $field => $value) {
212
-				if (strpos($field, $model->alias . '.') !== false) {
212
+				if (strpos($field, $model->alias.'.') !== false) {
213 213
 					unset($fields[$field]);
214
-					$field = str_replace($model->alias . '.', "", $field);
215
-					$field = str_replace($model->alias . '.', "", $field);
214
+					$field = str_replace($model->alias.'.', "", $field);
215
+					$field = str_replace($model->alias.'.', "", $field);
216 216
 					$fields[$field] = $value;
217 217
 				}
218 218
 			}
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
  */
230 230
 	public function truncate($table) {
231 231
 		if (in_array('sqlite_sequence', $this->listSources())) {
232
-			$this->_execute('DELETE FROM sqlite_sequence where name=' . $this->startQuote . $this->fullTableName($table, false, false) . $this->endQuote);
232
+			$this->_execute('DELETE FROM sqlite_sequence where name='.$this->startQuote.$this->fullTableName($table, false, false).$this->endQuote);
233 233
 		}
234
-		return $this->execute('DELETE FROM ' . $this->fullTableName($table));
234
+		return $this->execute('DELETE FROM '.$this->fullTableName($table));
235 235
 	}
236 236
 
237 237
 /**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 		if (is_array($real)) {
245 245
 			$col = $real['name'];
246 246
 			if (isset($real['limit'])) {
247
-				$col .= '(' . $real['limit'] . ')';
247
+				$col .= '('.$real['limit'].')';
248 248
 			}
249 249
 			return $col;
250 250
 		}
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 			$selects = array('seqno', 'cid', 'name');
313 313
 		}
314 314
 		while ($j < $numFields) {
315
-			if (!isset($selects[$j])) {
315
+			if ( ! isset($selects[$j])) {
316 316
 				$j++;
317 317
 				continue;
318 318
 			}
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 
329 329
 			$metaType = false;
330 330
 			try {
331
-				$metaData = (array)$results->getColumnMeta($j);
332
-				if (!empty($metaData['sqlite:decl_type'])) {
331
+				$metaData = (array) $results->getColumnMeta($j);
332
+				if ( ! empty($metaData['sqlite:decl_type'])) {
333 333
 					$metaType = trim($metaData['sqlite:decl_type']);
334 334
 				}
335 335
 			} catch (Exception $e) {
@@ -401,20 +401,20 @@  discard block
 block discarded – undo
401 401
 			return null;
402 402
 		}
403 403
 
404
-		if (!isset($this->columns[$type])) {
404
+		if ( ! isset($this->columns[$type])) {
405 405
 			trigger_error(__d('cake_dev', 'Column type %s does not exist', $type), E_USER_WARNING);
406 406
 			return null;
407 407
 		}
408 408
 
409 409
 		$isPrimary = (isset($column['key']) && $column['key'] === 'primary');
410 410
 		if ($isPrimary && $type === 'integer') {
411
-			return $this->name($name) . ' ' . $this->columns['primary_key']['name'];
411
+			return $this->name($name).' '.$this->columns['primary_key']['name'];
412 412
 		}
413 413
 		$out = parent::buildColumn($column);
414 414
 		if ($isPrimary && $type === 'biginteger') {
415 415
 			$replacement = 'PRIMARY KEY';
416 416
 			if ($column['null'] === false) {
417
-				$replacement = 'NOT NULL ' . $replacement;
417
+				$replacement = 'NOT NULL '.$replacement;
418 418
 			}
419 419
 			return str_replace($this->columns['primary_key']['name'], $replacement, $out);
420 420
 		}
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
  * @return boolean
429 429
  */
430 430
 	public function setEncoding($enc) {
431
-		if (!in_array($enc, array("UTF-8", "UTF-16", "UTF-16le", "UTF-16be"))) {
431
+		if ( ! in_array($enc, array("UTF-8", "UTF-16", "UTF-16le", "UTF-16be"))) {
432 432
 			return false;
433 433
 		}
434 434
 		return $this->_execute("PRAGMA encoding = \"{$enc}\"") !== false;
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 			}
465 465
 			$out = 'CREATE ';
466 466
 
467
-			if (!empty($value['unique'])) {
467
+			if ( ! empty($value['unique'])) {
468 468
 				$out .= 'UNIQUE ';
469 469
 			}
470 470
 			if (is_array($value['column'])) {
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 				$value['column'] = $this->name($value['column']);
474 474
 			}
475 475
 			$t = trim($table, '"');
476
-			$indexname = $this->name($t . '_' . $name);
476
+			$indexname = $this->name($t.'_'.$name);
477 477
 			$table = $this->name($table);
478 478
 			$out .= "INDEX {$dbname}.{$indexname} ON {$table}({$value['column']});";
479 479
 			$join[] = $out;
@@ -492,16 +492,16 @@  discard block
 block discarded – undo
492 492
 		$index = array();
493 493
 		$table = $this->fullTableName($model, false, false);
494 494
 		if ($table) {
495
-			$indexes = $this->query('PRAGMA index_list(' . $table . ')');
495
+			$indexes = $this->query('PRAGMA index_list('.$table.')');
496 496
 
497 497
 			if (is_bool($indexes)) {
498 498
 				return array();
499 499
 			}
500 500
 			foreach ($indexes as $info) {
501 501
 				$key = array_pop($info);
502
-				$keyInfo = $this->query('PRAGMA index_info("' . $key['name'] . '")');
502
+				$keyInfo = $this->query('PRAGMA index_info("'.$key['name'].'")');
503 503
 				foreach ($keyInfo as $keyCol) {
504
-					if (!isset($index[$key['name']])) {
504
+					if ( ! isset($index[$key['name']])) {
505 505
 						$col = array();
506 506
 						if (preg_match('/autoindex/', $key['name'])) {
507 507
 							$key['name'] = 'PRIMARY';
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 						$index[$key['name']]['column'] = $keyCol[0]['name'];
510 510
 						$index[$key['name']]['unique'] = intval($key['unique'] == 1);
511 511
 					} else {
512
-						if (!is_array($index[$key['name']]['column'])) {
512
+						if ( ! is_array($index[$key['name']]['column'])) {
513 513
 							$col[] = $index[$key['name']]['column'];
514 514
 						}
515 515
 						$col[] = $keyCol[0]['name'];
@@ -533,10 +533,10 @@  discard block
 block discarded – undo
533 533
 			case 'schema':
534 534
 				extract($data);
535 535
 				if (is_array($columns)) {
536
-					$columns = "\t" . implode(",\n\t", array_filter($columns));
536
+					$columns = "\t".implode(",\n\t", array_filter($columns));
537 537
 				}
538 538
 				if (is_array($indexes)) {
539
-					$indexes = "\t" . implode("\n\t", array_filter($indexes));
539
+					$indexes = "\t".implode("\n\t", array_filter($indexes));
540 540
 				}
541 541
 				return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}";
542 542
 			default:
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
  * @return string Drop table SQL statement
561 561
  */
562 562
 	protected function _dropTable($table) {
563
-		return 'DROP TABLE IF EXISTS ' . $this->fullTableName($table) . ";";
563
+		return 'DROP TABLE IF EXISTS '.$this->fullTableName($table).";";
564 564
 	}
565 565
 
566 566
 /**
Please login to merge, or discard this patch.