Completed
Push — php-cs-fixer ( b6f93e )
by Fabio
07:29
created
framework/Data/ActiveRecord/TActiveRecordManager.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -76,6 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	/**
78 78
 	 * @param TDbConnection default database connection
79
+	 * @param \Prado\Data\TDbConnection $conn
79 80
 	 */
80 81
 	public function setDbConnection($conn)
81 82
 	{
@@ -91,6 +92,7 @@  discard block
 block discarded – undo
91 92
 	}
92 93
 
93 94
 	/**
95
+	 * @param \Prado\TComponent $self
94 96
 	 * @return TActiveRecordManager static instance of record manager.
95 97
 	 */
96 98
 	public static function getInstance($self=null)
@@ -153,6 +155,7 @@  discard block
 block discarded – undo
153 155
 	/**
154 156
 	 * Define the way an active record finder react if an invalid magic-finder invoked
155 157
 	 * @param TActiveRecordInvalidFinderResult
158
+	 * @param TActiveRecordInvalidFinderResult $value
156 159
 	 * @since 3.1.5
157 160
 	 * @see getInvalidFinderResult
158 161
 	 */
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class TActiveRecordManager extends \Prado\TComponent
38 38
 {
39
-	const DEFAULT_GATEWAY_CLASS = 'System.Data.ActiveRecord.TActiveRecordGateway';
39
+	const DEFAULT_GATEWAY_CLASS='System.Data.ActiveRecord.TActiveRecordGateway';
40 40
 
41 41
 	/**
42 42
 	 * Defaults to {@link TActiveRecordManager::DEFAULT_GATEWAY_CLASS DEFAULT_GATEWAY_CLASS}
43 43
 	 * @var string
44 44
 	 */
45
-	private $_gatewayClass = self::DEFAULT_GATEWAY_CLASS;
45
+	private $_gatewayClass=self::DEFAULT_GATEWAY_CLASS;
46 46
 
47 47
 	private $_gateway;
48 48
 	private $_meta=[];
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @var TActiveRecordInvalidFinderResult
57 57
 	 * @since 3.1.5
58 58
 	 */
59
-	private $_invalidFinderResult = TActiveRecordInvalidFinderResult::Null;
59
+	private $_invalidFinderResult=TActiveRecordInvalidFinderResult::Null;
60 60
 
61 61
 	/**
62 62
 	 * @return ICache application cache.
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		if($self!==null)
100 100
 			$instance=$self;
101 101
 		elseif($instance===null)
102
-			$instance = new self;
102
+			$instance=new self;
103 103
 		return $instance;
104 104
 	}
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getRecordGateway()
110 110
 	{
111
-		if($this->_gateway === null) {
112
-			$this->_gateway = $this->createRecordGateway();
111
+		if($this->_gateway===null) {
112
+			$this->_gateway=$this->createRecordGateway();
113 113
 		}
114 114
 		return $this->_gateway;
115 115
 	}
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function setGatewayClass($value)
130 130
 	{
131
-		$this->_gateway = null;
132
-		$this->_gatewayClass = (string)$value;
131
+		$this->_gateway=null;
132
+		$this->_gatewayClass=(string) $value;
133 133
 	}
134 134
 
135 135
 	/**
@@ -158,6 +158,6 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function setInvalidFinderResult($value)
160 160
 	{
161
-		$this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
161
+		$this->_invalidFinderResult=TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
162 162
 	}
163 163
 }
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlTableInfo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 
55 55
 	/**
56 56
 	 * @param TDbConnection database connection.
57
-	 * @return TDbCommandBuilder new command builder
57
+	 * @return TMssqlCommandBuilder new command builder
58 58
 	 */
59 59
 	public function createCommandBuilder($connection)
60 60
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	public function getTableFullName()
50 50
 	{
51 51
 		//MSSQL alway returns the catalog, schem and table names.
52
-		return '[' . $this->getCatalogName() . '].[' . $this->getSchemaName() . '].[' . $this->getTableName() . ']';
52
+		return '['.$this->getCatalogName().'].['.$this->getSchemaName().'].['.$this->getTableName().']';
53 53
 	}
54 54
 
55 55
 	/**
Please login to merge, or discard this patch.
framework/Data/Common/Mysql/TMysqlTableInfo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
 	/**
50 50
 	 * @param TDbConnection database connection.
51
-	 * @return TDbCommandBuilder new command builder
51
+	 * @return TMysqlCommandBuilder new command builder
52 52
 	 */
53 53
 	public function createCommandBuilder($connection)
54 54
 	{
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
 	public function getTableFullName()
42 42
 	{
43 43
 		if(($schema=$this->getSchemaName())!==null)
44
-			return '`' . $schema . '`.`' . $this->getTableName() . '`';
44
+			return '`'.$schema.'`.`'.$this->getTableName().'`';
45 45
 		else
46
-			return '`' . $this->getTableName() . '`';
46
+			return '`'.$this->getTableName().'`';
47 47
 	}
48 48
 
49 49
 	/**
Please login to merge, or discard this patch.
framework/Data/Common/Pgsql/TPgsqlTableInfo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
 	/**
50 50
 	 * @param TDbConnection database connection.
51
-	 * @return TDbCommandBuilder new command builder
51
+	 * @return TPgsqlCommandBuilder new command builder
52 52
 	 */
53 53
 	public function createCommandBuilder($connection)
54 54
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 	public function getTableFullName()
42 42
 	{
43 43
 		if(($schema=$this->getSchemaName())!==null)
44
-			return $schema . '.' . $this->getTableName();
44
+			return $schema.'.'.$this->getTableName();
45 45
 		else
46 46
 			return $this->getTableName();
47 47
 	}
Please login to merge, or discard this patch.
framework/Data/Common/Sqlite/TSqliteTableInfo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 {
30 30
 	/**
31 31
 	 * @param TDbConnection database connection.
32
-	 * @return TDbCommandBuilder new command builder
32
+	 * @return TSqliteCommandBuilder new command builder
33 33
 	 */
34 34
 	public function createCommandBuilder($connection)
35 35
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 	 */
42 42
 	public function getTableFullName()
43 43
 	{
44
-		return "'" . $this->getTableName() . "'";
44
+		return "'".$this->getTableName()."'";
45 45
 	}
46 46
 }
47 47
 
Please login to merge, or discard this patch.
framework/Data/Common/TDbCommandBuilder.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -191,7 +191,6 @@  discard block
 block discarded – undo
191 191
 	 * array('col1' => 'NULL', '*')
192 192
 	 * // SELECT `col1`, `col2`, `col3`, NULL AS `col1` FROM...
193 193
 	 * </code>
194
-	 * @param mixed $value
195 194
 	 * @return array of generated fields - use implode(', ', $selectfieldlist) to collapse field list for usage
196 195
 	 * @since 3.1.7
197 196
 	 * @todo add support for table aliasing
@@ -399,7 +398,7 @@  discard block
 block discarded – undo
399 398
 	/**
400 399
 	 * Returns a list of insert field name and a list of binding names.
401 400
 	 * @param object array or object to be inserted.
402
-	 * @return array tuple ($fields, $bindings)
401
+	 * @return string[] tuple ($fields, $bindings)
403 402
 	 */
404 403
 	protected function getInsertFieldBindings($values)
405 404
 	{
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -467,8 +467,7 @@
 block discarded – undo
467 467
 			$values = array_values($values);
468 468
 			for($i = 0, $max=count($values); $i<$max; $i++)
469 469
 				$command->bindValue($i+1, $values[$i], $this->getPdoType($values[$i]));
470
-		}
471
-		else
470
+		} else
472 471
 		{
473 472
 			foreach($values as $name=>$value)
474 473
 			{
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function applyLimitOffset($sql, $limit=-1, $offset=-1)
95 95
 	{
96
-		$limit = $limit!==null ? (int)$limit : -1;
97
-		$offset = $offset!==null ? (int)$offset : -1;
98
-		$limitStr = $limit >= 0 ? ' LIMIT ' . $limit : '';
99
-		$offsetStr = $offset >= 0 ? ' OFFSET ' . $offset : '';
100
-		return $sql . $limitStr . $offsetStr;
96
+		$limit=$limit!==null ? (int) $limit : -1;
97
+		$offset=$offset!==null ? (int) $offset : -1;
98
+		$limitStr=$limit >= 0 ? ' LIMIT '.$limit : '';
99
+		$offsetStr=$offset >= 0 ? ' OFFSET '.$offset : '';
100
+		return $sql.$limitStr.$offsetStr;
101 101
 	}
102 102
 
103 103
 	/**
@@ -110,18 +110,18 @@  discard block
 block discarded – undo
110 110
 		$orders=[];
111 111
 		foreach($ordering as $name => $direction)
112 112
 		{
113
-			$direction = strtolower($direction) == 'desc' ? 'DESC' : 'ASC';
114
-			if(false !== strpos($name, '(') && false !== strpos($name, ')')) {
113
+			$direction=strtolower($direction)=='desc' ? 'DESC' : 'ASC';
114
+			if(false!==strpos($name, '(') && false!==strpos($name, ')')) {
115 115
 				// key is a function (bad practice, but we need to handle it)
116
-				$key = $name;
116
+				$key=$name;
117 117
 			} else {
118 118
 				// key is a column
119
-				$key = $this->getTableInfo()->getColumn($name)->getColumnName();
119
+				$key=$this->getTableInfo()->getColumn($name)->getColumnName();
120 120
 			}
121
-			$orders[] = $key . ' ' . $direction;
121
+			$orders[]=$key.' '.$direction;
122 122
 		}
123 123
 		if(count($orders) > 0)
124
-			$sql .= ' ORDER BY ' . implode(', ', $orders);
124
+			$sql.=' ORDER BY '.implode(', ', $orders);
125 125
 		return $sql;
126 126
 	}
127 127
 
@@ -135,15 +135,15 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function getSearchExpression($fields, $keywords)
137 137
 	{
138
-		if(strlen(trim($keywords)) == 0) return '';
139
-		$words = preg_split('/\s/u', $keywords);
140
-		$conditions = [];
138
+		if(strlen(trim($keywords))==0) return '';
139
+		$words=preg_split('/\s/u', $keywords);
140
+		$conditions=[];
141 141
 		foreach($fields as $field)
142 142
 		{
143
-			$column = $this->getTableInfo()->getColumn($field)->getColumnName();
144
-			$conditions[] = $this->getSearchCondition($column, $words);
143
+			$column=$this->getTableInfo()->getColumn($field)->getColumnName();
144
+			$conditions[]=$this->getSearchCondition($column, $words);
145 145
 		}
146
-		return '(' . implode(' OR ', $conditions) . ')';
146
+		return '('.implode(' OR ', $conditions).')';
147 147
 	}
148 148
 
149 149
 	/**
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	{
156 156
 		$conditions=[];
157 157
 		foreach($words as $word)
158
-			$conditions[] = $column . ' LIKE ' . $this->getDbConnection()->quoteString('%' . $word . '%');
159
-		return '(' . implode(' AND ', $conditions) . ')';
158
+			$conditions[]=$column.' LIKE '.$this->getDbConnection()->quoteString('%'.$word.'%');
159
+		return '('.implode(' AND ', $conditions).')';
160 160
 	}
161 161
 
162 162
 	/**
@@ -200,102 +200,102 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function getSelectFieldList($data='*') {
202 202
 		if(is_scalar($data)) {
203
-			$tmp = explode(',', $data);
204
-			$result = [];
203
+			$tmp=explode(',', $data);
204
+			$result=[];
205 205
 			foreach($tmp as $v)
206
-				$result[] = trim($v);
206
+				$result[]=trim($v);
207 207
 			return $result;
208 208
 		}
209 209
 
210
-		$bHasWildcard = false;
211
-		$result = [];
210
+		$bHasWildcard=false;
211
+		$result=[];
212 212
 		if(is_array($data) || $data instanceof Traversable) {
213
-			$columns = $this->getTableInfo()->getColumns();
213
+			$columns=$this->getTableInfo()->getColumns();
214 214
 			foreach($data as $key=>$value) {
215 215
 				if($key==='*' || $value==='*') {
216
-					$bHasWildcard = true;
216
+					$bHasWildcard=true;
217 217
 					continue;
218 218
 				}
219 219
 
220 220
 				if(strToUpper($key)==='NULL') {
221
-					$result[] = 'NULL';
221
+					$result[]='NULL';
222 222
 					continue;
223 223
 				}
224 224
 
225 225
 				if(strpos($key, '(')!==false && strpos($key, ')')!==false) {
226
-					$result[] = $key;
226
+					$result[]=$key;
227 227
 					continue;
228 228
 				}
229 229
 
230 230
 				if(stripos($key, 'AS')!==false) {
231
-					$result[] = $key;
231
+					$result[]=$key;
232 232
 					continue;
233 233
 				}
234 234
 
235 235
 				if(stripos($value, 'AS')!==false) {
236
-					$result[] = $value;
236
+					$result[]=$value;
237 237
 					continue;
238 238
 				}
239 239
 
240
-				$v = isset($columns[$value]);
241
-				$k = isset($columns[$key]);
240
+				$v=isset($columns[$value]);
241
+				$k=isset($columns[$key]);
242 242
 				if(is_int($key) && $v) {
243
-					$key = $value;
244
-					$k = $v;
243
+					$key=$value;
244
+					$k=$v;
245 245
 				}
246 246
 
247 247
 				if(strToUpper($value)==='NULL') {
248 248
 					if($k)
249
-						$result[] = 'NULL AS ' . $columns[$key]->getColumnName();
249
+						$result[]='NULL AS '.$columns[$key]->getColumnName();
250 250
 					else
251
-						$result[] = 'NULL' . (is_string($key) ? (' AS ' . (string)$key) : '');
251
+						$result[]='NULL'.(is_string($key) ? (' AS '.(string) $key) : '');
252 252
 					continue;
253 253
 				}
254 254
 
255 255
 				if(strpos($value, '(')!==false && strpos($value, ')')!==false) {
256 256
 					if($k)
257
-						$result[] = $value . ' AS ' . $columns[$key]->getColumnName();
257
+						$result[]=$value.' AS '.$columns[$key]->getColumnName();
258 258
 					else
259
-						$result[] = $value . (is_string($key) ? (' AS ' . (string)$key) : '');
259
+						$result[]=$value.(is_string($key) ? (' AS '.(string) $key) : '');
260 260
 					continue;
261 261
 				}
262 262
 
263 263
 				if($v && $key==$value) {
264
-					$result[] = $columns[$value]->getColumnName();
264
+					$result[]=$columns[$value]->getColumnName();
265 265
 					continue;
266 266
 				}
267 267
 
268 268
 				if($k && $value==null) {
269
-					$result[] = $columns[$key]->getColumnName();
269
+					$result[]=$columns[$key]->getColumnName();
270 270
 					continue;
271 271
 				}
272 272
 
273 273
 				if(is_string($key) && $v) {
274
-					$result[] = $columns[$value]->getColumnName() . ' AS ' . $key;
274
+					$result[]=$columns[$value]->getColumnName().' AS '.$key;
275 275
 					continue;
276 276
 				}
277 277
 
278 278
 				if(is_numeric($value) && $k) {
279
-					$result[] = $value . ' AS ' . $columns[$key]->getColumnName();
279
+					$result[]=$value.' AS '.$columns[$key]->getColumnName();
280 280
 					continue;
281 281
 				}
282 282
 
283 283
 				if(is_string($value) && $k) {
284
-					$result[] = $this->getDbConnection()->quoteString($value) . ' AS ' . $columns[$key]->getColumnName();
284
+					$result[]=$this->getDbConnection()->quoteString($value).' AS '.$columns[$key]->getColumnName();
285 285
 					continue;
286 286
 				}
287 287
 
288 288
 				if(!$v && !$k && is_int($key)) {
289
-					$result[] = is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value);
289
+					$result[]=is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string) $value);
290 290
 					continue;
291 291
 				}
292 292
 
293
-				$result[] = (is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value)) . ' AS ' . $key;
293
+				$result[]=(is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string) $value)).' AS '.$key;
294 294
 			}
295 295
 		}
296 296
 
297
-		if($data===null || count($result) == 0 || $bHasWildcard)
298
-			$result = $result = array_merge($this->getTableInfo()->getColumnNames(), $result);
297
+		if($data===null || count($result)==0 || $bHasWildcard)
298
+			$result=$result=array_merge($this->getTableInfo()->getColumnNames(), $result);
299 299
 
300 300
 		return $result;
301 301
 	}
@@ -309,21 +309,21 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	public function createFindCommand($where='1=1', $parameters=[], $ordering=[], $limit=-1, $offset=-1, $select='*')
311 311
 	{
312
-		$table = $this->getTableInfo()->getTableFullName();
313
-		$fields = implode(', ', $this -> getSelectFieldList($select));
314
-		$sql = "SELECT {$fields} FROM {$table}";
312
+		$table=$this->getTableInfo()->getTableFullName();
313
+		$fields=implode(', ', $this -> getSelectFieldList($select));
314
+		$sql="SELECT {$fields} FROM {$table}";
315 315
 		if(!empty($where))
316
-			$sql .= " WHERE {$where}";
316
+			$sql.=" WHERE {$where}";
317 317
 		return $this->applyCriterias($sql, $parameters, $ordering, $limit, $offset);
318 318
 	}
319 319
 
320 320
 	public function applyCriterias($sql, $parameters=[], $ordering=[], $limit=-1, $offset=-1)
321 321
 	{
322 322
 		if(count($ordering) > 0)
323
-			$sql = $this->applyOrdering($sql, $ordering);
324
-		if($limit>=0 || $offset>=0)
325
-			$sql = $this->applyLimitOffset($sql, $limit, $offset);
326
-		$command = $this->createCommand($sql);
323
+			$sql=$this->applyOrdering($sql, $ordering);
324
+		if($limit >= 0 || $offset >= 0)
325
+			$sql=$this->applyLimitOffset($sql, $limit, $offset);
326
+		$command=$this->createCommand($sql);
327 327
 		$this->bindArrayValues($command, $parameters);
328 328
 		return $command;
329 329
 	}
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	public function createDeleteCommand($where, $parameters=[])
351 351
 	{
352
-		$table = $this->getTableInfo()->getTableFullName();
353
-		if (!empty($where))
354
-			$where = ' WHERE ' . $where;
355
-		$command = $this->createCommand("DELETE FROM {$table}" . $where);
352
+		$table=$this->getTableInfo()->getTableFullName();
353
+		if(!empty($where))
354
+			$where=' WHERE '.$where;
355
+		$command=$this->createCommand("DELETE FROM {$table}".$where);
356 356
 		$this->bindArrayValues($command, $parameters);
357 357
 		return $command;
358 358
 	}
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
 	 */
368 368
 	public function createInsertCommand($data)
369 369
 	{
370
-		$table = $this->getTableInfo()->getTableFullName();
371
-		list($fields, $bindings) = $this->getInsertFieldBindings($data);
372
-		$command = $this->createCommand("INSERT INTO {$table}({$fields}) VALUES ($bindings)");
370
+		$table=$this->getTableInfo()->getTableFullName();
371
+		list($fields, $bindings)=$this->getInsertFieldBindings($data);
372
+		$command=$this->createCommand("INSERT INTO {$table}({$fields}) VALUES ($bindings)");
373 373
 		$this->bindColumnValues($command, $data);
374 374
 		return $command;
375 375
 	}
@@ -384,15 +384,15 @@  discard block
 block discarded – undo
384 384
 	 */
385 385
 	public function createUpdateCommand($data, $where, $parameters=[])
386 386
 	{
387
-		$table = $this->getTableInfo()->getTableFullName();
387
+		$table=$this->getTableInfo()->getTableFullName();
388 388
 		if($this->hasIntegerKey($parameters))
389
-			$fields = implode(', ', $this->getColumnBindings($data, true));
389
+			$fields=implode(', ', $this->getColumnBindings($data, true));
390 390
 		else
391
-			$fields = implode(', ', $this->getColumnBindings($data));
391
+			$fields=implode(', ', $this->getColumnBindings($data));
392 392
 
393
-		if (!empty($where))
394
-			$where = ' WHERE ' . $where;
395
-		$command = $this->createCommand("UPDATE {$table} SET {$fields}" . $where);
393
+		if(!empty($where))
394
+			$where=' WHERE '.$where;
395
+		$command=$this->createCommand("UPDATE {$table} SET {$fields}".$where);
396 396
 		$this->bindArrayValues($command, array_merge($data, $parameters));
397 397
 		return $command;
398 398
 	}
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 	 */
405 405
 	protected function getInsertFieldBindings($values)
406 406
 	{
407
-		$fields = []; $bindings=[];
407
+		$fields=[]; $bindings=[];
408 408
 		foreach(array_keys($values) as $name)
409 409
 		{
410
-			$fields[] = $this->getTableInfo()->getColumn($name)->getColumnName();
411
-			$bindings[] = ':' . $name;
410
+			$fields[]=$this->getTableInfo()->getColumn($name)->getColumnName();
411
+			$bindings[]=':'.$name;
412 412
 		}
413 413
 		return [implode(', ', $fields), implode(', ', $bindings)];
414 414
 	}
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 		$bindings=[];
425 425
 		foreach(array_keys($values) as $name)
426 426
 		{
427
-			$column = $this->getTableInfo()->getColumn($name)->getColumnName();
428
-			$bindings[] = $position ? $column . ' = ?' : $column . ' = :' . $name;
427
+			$column=$this->getTableInfo()->getColumn($name)->getColumnName();
428
+			$bindings[]=$position ? $column.' = ?' : $column.' = :'.$name;
429 429
 		}
430 430
 		return $bindings;
431 431
 	}
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
 	{
450 450
 		foreach($values as $name=>$value)
451 451
 		{
452
-			$column = $this->getTableInfo()->getColumn($name);
453
-			if($value === null && $column->getAllowNull())
454
-				$command->bindValue(':' . $name, null, PDO::PARAM_NULL);
452
+			$column=$this->getTableInfo()->getColumn($name);
453
+			if($value===null && $column->getAllowNull())
454
+				$command->bindValue(':'.$name, null, PDO::PARAM_NULL);
455 455
 			else
456
-				$command->bindValue(':' . $name, $value, $column->getPdoType());
456
+				$command->bindValue(':'.$name, $value, $column->getPdoType());
457 457
 		}
458 458
 	}
459 459
 
@@ -465,15 +465,15 @@  discard block
 block discarded – undo
465 465
 	{
466 466
 		if($this->hasIntegerKey($values))
467 467
 		{
468
-			$values = array_values($values);
469
-			for($i = 0, $max=count($values); $i<$max; $i++)
470
-				$command->bindValue($i+1, $values[$i], $this->getPdoType($values[$i]));
468
+			$values=array_values($values);
469
+			for($i=0, $max=count($values); $i < $max; $i++)
470
+				$command->bindValue($i + 1, $values[$i], $this->getPdoType($values[$i]));
471 471
 		}
472 472
 		else
473 473
 		{
474 474
 			foreach($values as $name=>$value)
475 475
 			{
476
-				$prop = $name[0]===':' ? $name : ':' . $name;
476
+				$prop=$name[0]===':' ? $name : ':'.$name;
477 477
 				$command->bindValue($prop, $value, $this->getPdoType($value));
478 478
 			}
479 479
 		}
Please login to merge, or discard this patch.
framework/Data/DataGateway/TDataGatewayCommand.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,6 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * Updates the table with new data.
85 85
 	 * @param array date for update.
86 86
 	 * @param TSqlCriteria update conditions and parameters.
87
+	 * @param TSqlCriteria $criteria
87 88
 	 * @return integer number of records affected.
88 89
 	 */
89 90
 	public function update($data, $criteria)
@@ -369,7 +370,8 @@  discard block
 block discarded – undo
369 370
 	 * @param string __call method name
370 371
 	 * @param string criteria conditions
371 372
 	 * @param array method arguments
372
-	 * @return TActiveRecordCriteria criteria created from the method name and its arguments.
373
+	 * @param string $condition
374
+	 * @return TSqlCriteria criteria created from the method name and its arguments.
373 375
 	 */
374 376
 	public function createCriteriaFromString($method, $condition, $args)
375 377
 	{
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct($builder)
46 46
 	{
47
-		$this->_builder = $builder;
47
+		$this->_builder=$builder;
48 48
 	}
49 49
 	/**
50 50
 	 * @return TDbTableInfo
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function delete($criteria)
76 76
 	{
77
-		$where = $criteria->getCondition();
78
-		$parameters = $criteria->getParameters()->toArray();
79
-		$command = $this->getBuilder()->createDeleteCommand($where, $parameters);
77
+		$where=$criteria->getCondition();
78
+		$parameters=$criteria->getParameters()->toArray();
79
+		$command=$this->getBuilder()->createDeleteCommand($where, $parameters);
80 80
 		$this->onCreateCommand($command, $criteria);
81 81
 		$command->prepare();
82 82
 		return $command->execute();
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function update($data, $criteria)
91 91
 	{
92
-		$where = $criteria->getCondition();
93
-		$parameters = $criteria->getParameters()->toArray();
94
-		$command = $this->getBuilder()->createUpdateCommand($data, $where, $parameters);
92
+		$where=$criteria->getCondition();
93
+		$parameters=$criteria->getParameters()->toArray();
94
+		$command=$this->getBuilder()->createUpdateCommand($data, $where, $parameters);
95 95
 		$this->onCreateCommand($command, $criteria);
96 96
 		$command->prepare();
97 97
 		return $this->onExecuteCommand($command, $command->execute());
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function updateByPk($data, $keys)
105 105
 	{
106
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
106
+		list($where, $parameters)=$this->getPrimaryKeyCondition((array) $keys);
107 107
 		return $this->update($data, new TSqlCriteria($where, $parameters));
108 108
 	}
109 109
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function find($criteria)
115 115
 	{
116
-		$command = $this->getFindCommand($criteria);
116
+		$command=$this->getFindCommand($criteria);
117 117
 		return $this->onExecuteCommand($command, $command->queryRow());
118 118
 	}
119 119
 	/**
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function findAll($criteria)
125 125
 	{
126
-		$command = $this->getFindCommand($criteria);
126
+		$command=$this->getFindCommand($criteria);
127 127
 		return $this->onExecuteCommand($command, $command->query());
128 128
 	}
129 129
 	/**
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	{
136 136
 		if($criteria===null)
137 137
 			return $this->getBuilder()->createFindCommand();
138
-		$where = $criteria->getCondition();
139
-		$parameters = $criteria->getParameters()->toArray();
140
-		$ordering = $criteria->getOrdersBy();
141
-		$limit = $criteria->getLimit();
142
-		$offset = $criteria->getOffset();
143
-		$select = $criteria->getSelect();
144
-		$command = $this->getBuilder()->createFindCommand($where, $parameters, $ordering, $limit, $offset, $select);
138
+		$where=$criteria->getCondition();
139
+		$parameters=$criteria->getParameters()->toArray();
140
+		$ordering=$criteria->getOrdersBy();
141
+		$limit=$criteria->getLimit();
142
+		$offset=$criteria->getOffset();
143
+		$select=$criteria->getSelect();
144
+		$command=$this->getBuilder()->createFindCommand($where, $parameters, $ordering, $limit, $offset, $select);
145 145
 		$this->onCreateCommand($command, $criteria);
146 146
 		return $command;
147 147
 	}
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	{
154 154
 		if($keys===null)
155 155
 			return null;
156
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
157
-		$command = $this->getBuilder()->createFindCommand($where, $parameters);
156
+		list($where, $parameters)=$this->getPrimaryKeyCondition((array) $keys);
157
+		$command=$this->getBuilder()->createFindCommand($where, $parameters);
158 158
 		$this->onCreateCommand($command, new TSqlCriteria($where, $parameters));
159 159
 		return $this->onExecuteCommand($command, $command->queryRow());
160 160
 	}
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	public function findAllByPk($keys)
166 166
 	{
167
-		$where = $this->getCompositeKeyCondition((array)$keys);
168
-		$command = $this->getBuilder()->createFindCommand($where);
167
+		$where=$this->getCompositeKeyCondition((array) $keys);
168
+		$command=$this->getBuilder()->createFindCommand($where);
169 169
 		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
170 170
 		return $this->onExecuteCommand($command, $command->query());
171 171
 	}
172 172
 	public function findAllByIndex($criteria, $fields, $values)
173 173
 	{
174
-		$index = $this->getIndexKeyCondition($this->getTableInfo(), $fields, $values);
175
-		if(strlen($where = $criteria->getCondition())>0)
174
+		$index=$this->getIndexKeyCondition($this->getTableInfo(), $fields, $values);
175
+		if(strlen($where=$criteria->getCondition()) > 0)
176 176
 			$criteria->setCondition("({$index}) AND ({$where})");
177 177
 		else
178 178
 			$criteria->setCondition($index);
179
-		$command = $this->getFindCommand($criteria);
179
+		$command=$this->getFindCommand($criteria);
180 180
 		$this->onCreateCommand($command, $criteria);
181 181
 		return $this->onExecuteCommand($command, $command->query());
182 182
 	}
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	{
190 190
 		if(count($keys)==0)
191 191
 			return 0;
192
-		$where = $this->getCompositeKeyCondition((array)$keys);
193
-		$command = $this->getBuilder()->createDeleteCommand($where);
192
+		$where=$this->getCompositeKeyCondition((array) $keys);
193
+		$command=$this->getBuilder()->createDeleteCommand($where);
194 194
 		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
195 195
 		$command->prepare();
196 196
 		return $this->onExecuteCommand($command, $command->execute());
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 
199 199
 	public function getIndexKeyCondition($table, $fields, $values)
200 200
 	{
201
-		if (!count($values))
201
+		if(!count($values))
202 202
 			return 'FALSE';
203
-		$columns = [];
204
-		$tableName = $table->getTableFullName();
203
+		$columns=[];
204
+		$tableName=$table->getTableFullName();
205 205
 		foreach($fields as $field)
206
-			$columns[] = $tableName . '.' . $table->getColumn($field)->getColumnName();
207
-		return '(' . implode(', ', $columns) . ') IN ' . $this->quoteTuple($values);
206
+			$columns[]=$tableName.'.'.$table->getColumn($field)->getColumnName();
207
+		return '('.implode(', ', $columns).') IN '.$this->quoteTuple($values);
208 208
 	}
209 209
 
210 210
 	/**
@@ -214,21 +214,21 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function getCompositeKeyCondition($values)
216 216
 	{
217
-		$primary = $this->getTableInfo()->getPrimaryKeys();
218
-		$count = count($primary);
217
+		$primary=$this->getTableInfo()->getPrimaryKeys();
218
+		$count=count($primary);
219 219
 		if($count===0)
220 220
 		{
221 221
 			throw new TDbException('dbtablegateway_no_primary_key_found',
222 222
 				$this->getTableInfo()->getTableFullName());
223 223
 		}
224
-		if(!is_array($values) || count($values) === 0)
224
+		if(!is_array($values) || count($values)===0)
225 225
 		{
226 226
 			throw new TDbException('dbtablegateway_missing_pk_values',
227 227
 				$this->getTableInfo()->getTableFullName());
228 228
 		}
229
-		if($count>1 && (!isset($values[0]) || !is_array($values[0])))
230
-			$values = [$values];
231
-		if($count > 1 && count($values[0]) !== $count)
229
+		if($count > 1 && (!isset($values[0]) || !is_array($values[0])))
230
+			$values=[$values];
231
+		if($count > 1 && count($values[0])!==$count)
232 232
 		{
233 233
 			throw new TDbException('dbtablegateway_pk_value_count_mismatch',
234 234
 				$this->getTableInfo()->getTableFullName());
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	protected function quoteTuple($array)
245 245
 	{
246
-		$conn = $this->getDbConnection();
247
-		$data = [];
246
+		$conn=$this->getDbConnection();
247
+		$data=[];
248 248
 		foreach($array as $k=>$v)
249
-			$data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
250
-		return '(' . implode(', ', $data) . ')';
249
+			$data[]=is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
250
+		return '('.implode(', ', $data).')';
251 251
 	}
252 252
 
253 253
 	/**
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	protected function getPrimaryKeyCondition($values)
259 259
 	{
260
-		$primary = $this->getTableInfo()->getPrimaryKeys();
260
+		$primary=$this->getTableInfo()->getPrimaryKeys();
261 261
 		if(count($primary)===0)
262 262
 		{
263 263
 			throw new TDbException('dbtablegateway_no_primary_key_found',
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
 		}
266 266
 		$criteria=[];
267 267
 		$bindings=[];
268
-		$i = 0;
268
+		$i=0;
269 269
 		foreach($primary as $key)
270 270
 		{
271
-			$column = $this->getTableInfo()->getColumn($key)->getColumnName();
272
-			$criteria[] = $column . ' = :' . $key;
273
-			$bindings[$key] = isset($values[$key])?$values[$key]:$values[$i++];
271
+			$column=$this->getTableInfo()->getColumn($key)->getColumnName();
272
+			$criteria[]=$column.' = :'.$key;
273
+			$bindings[$key]=isset($values[$key]) ? $values[$key] : $values[$i++];
274 274
 		}
275 275
 		return [implode(' AND ', $criteria), $bindings];
276 276
 	}
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public function findBySql($criteria)
284 284
 	{
285
-		$command = $this->getSqlCommand($criteria);
285
+		$command=$this->getSqlCommand($criteria);
286 286
 		return $this->onExecuteCommand($command, $command->queryRow());
287 287
 	}
288 288
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public function findAllBySql($criteria)
295 295
 	{
296
-		$command = $this->getSqlCommand($criteria);
296
+		$command=$this->getSqlCommand($criteria);
297 297
 		return $this->onExecuteCommand($command, $command->query());
298 298
 	}
299 299
 
@@ -304,15 +304,15 @@  discard block
 block discarded – undo
304 304
 	 */
305 305
 	protected function getSqlCommand($criteria)
306 306
 	{
307
-		$sql = $criteria->getCondition();
308
-		$ordering = $criteria->getOrdersBy();
309
-		$limit = $criteria->getLimit();
310
-		$offset = $criteria->getOffset();
307
+		$sql=$criteria->getCondition();
308
+		$ordering=$criteria->getOrdersBy();
309
+		$limit=$criteria->getLimit();
310
+		$offset=$criteria->getOffset();
311 311
 		if(count($ordering) > 0)
312
-			$sql = $this->getBuilder()->applyOrdering($sql, $ordering);
313
-		if($limit>=0 || $offset>=0)
314
-			$sql = $this->getBuilder()->applyLimitOffset($sql, $limit, $offset);
315
-		$command = $this->getBuilder()->createCommand($sql);
312
+			$sql=$this->getBuilder()->applyOrdering($sql, $ordering);
313
+		if($limit >= 0 || $offset >= 0)
314
+			$sql=$this->getBuilder()->applyLimitOffset($sql, $limit, $offset);
315
+		$command=$this->getBuilder()->createCommand($sql);
316 316
 		$this->getBuilder()->bindArrayValues($command, $criteria->getParameters()->toArray());
317 317
 		$this->onCreateCommand($command, $criteria);
318 318
 		return $command;
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
 	public function count($criteria)
326 326
 	{
327 327
 		if($criteria===null)
328
-			return (int)$this->getBuilder()->createCountCommand()->queryScalar();
329
-		$where = $criteria->getCondition();
330
-		$parameters = $criteria->getParameters()->toArray();
331
-		$ordering = $criteria->getOrdersBy();
332
-		$limit = $criteria->getLimit();
333
-		$offset = $criteria->getOffset();
334
-		$command = $this->getBuilder()->createCountCommand($where, $parameters, $ordering, $limit, $offset);
328
+			return (int) $this->getBuilder()->createCountCommand()->queryScalar();
329
+		$where=$criteria->getCondition();
330
+		$parameters=$criteria->getParameters()->toArray();
331
+		$ordering=$criteria->getOrdersBy();
332
+		$limit=$criteria->getLimit();
333
+		$offset=$criteria->getOffset();
334
+		$command=$this->getBuilder()->createCountCommand($where, $parameters, $ordering, $limit, $offset);
335 335
 		$this->onCreateCommand($command, $criteria);
336
-		return $this->onExecuteCommand($command, (int)$command->queryScalar());
336
+		return $this->onExecuteCommand($command, (int) $command->queryScalar());
337 337
 	}
338 338
 
339 339
 	/**
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 		$command->prepare();
351 351
 		if($this->onExecuteCommand($command, $command->execute()) > 0)
352 352
 		{
353
-			$value = $this->getLastInsertId();
354
-			return $value !== null ? $value : true;
353
+			$value=$this->getLastInsertId();
354
+			return $value!==null ? $value : true;
355 355
 		}
356 356
 		return false;
357 357
 	}
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 	 */
375 375
 	public function createCriteriaFromString($method, $condition, $args)
376 376
 	{
377
-		$fields = $this->extractMatchingConditions($method, $condition);
378
-		$args=count($args) === 1 && is_array($args[0]) ? $args[0] : $args;
379
-		if(count($fields)>count($args))
377
+		$fields=$this->extractMatchingConditions($method, $condition);
378
+		$args=count($args)===1 && is_array($args[0]) ? $args[0] : $args;
379
+		if(count($fields) > count($args))
380 380
 		{
381 381
 			throw new TDbException('dbtablegateway_mismatch_args_exception',
382 382
 				$method, count($fields), count($args));
@@ -393,25 +393,25 @@  discard block
 block discarded – undo
393 393
 	 */
394 394
 	protected function extractMatchingConditions($method, $condition)
395 395
 	{
396
-		$table = $this->getTableInfo();
397
-		$columns = $table->getLowerCaseColumnNames();
398
-		$regexp = '/(' . implode('|', array_keys($columns)) . ')(and|_and_|or|_or_)?/i';
399
-		$matches = [];
396
+		$table=$this->getTableInfo();
397
+		$columns=$table->getLowerCaseColumnNames();
398
+		$regexp='/('.implode('|', array_keys($columns)).')(and|_and_|or|_or_)?/i';
399
+		$matches=[];
400 400
 		if(!preg_match_all($regexp, strtolower($condition), $matches, PREG_SET_ORDER))
401 401
 		{
402 402
 			throw new TDbException('dbtablegateway_mismatch_column_name',
403 403
 				$method, implode(', ', $columns), $table->getTableFullName());
404 404
 		}
405 405
 
406
-		$fields = [];
406
+		$fields=[];
407 407
 		foreach($matches as $match)
408 408
 		{
409
-			$key = $columns[$match[1]];
410
-			$column = $table->getColumn($key)->getColumnName();
411
-			$sql = $column . ' = ? ';
409
+			$key=$columns[$match[1]];
410
+			$column=$table->getColumn($key)->getColumnName();
411
+			$sql=$column.' = ? ';
412 412
 			if(count($match) > 2)
413
-				$sql .= strtoupper(str_replace('_', '', $match[2]));
414
-			$fields[] = $sql;
413
+				$sql.=strtoupper(str_replace('_', '', $match[2]));
414
+			$fields[]=$sql;
415 415
 		}
416 416
 		return $fields;
417 417
 	}
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 */
441 441
 	public function onExecuteCommand($command, $result)
442 442
 	{
443
-		$parameter = new TDataGatewayResultEventParameter($command, $result);
443
+		$parameter=new TDataGatewayResultEventParameter($command, $result);
444 444
 		$this->raiseEvent('OnExecuteCommand', $this, $parameter);
445 445
 		return $parameter->getResult();
446 446
 	}
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapCacheKey.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	}
34 34
 
35 35
 	/**
36
-	 * @param string serialized object
36
+	 * @param string string object
37 37
 	 * @return string crc32 hash of the serialized object.
38 38
 	 */
39 39
 	protected function generateKey($string)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 	 */
30 30
 	public function __construct($object)
31 31
 	{
32
-		$this->_key = $this->generateKey(serialize($object));
32
+		$this->_key=$this->generateKey(serialize($object));
33 33
 	}
34 34
 
35 35
 	/**
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,6 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 	/**
151 151
 	 * @param TSqlMapCacheKey|string cache key
152
+	 * @param string $key
152 153
 	 * @return mixed cached value.
153 154
 	 */
154 155
 	public function get($key)
@@ -167,6 +168,7 @@  discard block
 block discarded – undo
167 168
 	/**
168 169
 	 * @param TSqlMapCacheKey|string cache key
169 170
 	 * @param mixed value to be cached.
171
+	 * @param string $key
170 172
 	 */
171 173
 	public function set($key, $value)
172 174
 	{
@@ -178,7 +180,7 @@  discard block
 block discarded – undo
178 180
 	}
179 181
 
180 182
 	/**
181
-	 * @return float cache hit ratio.
183
+	 * @return integer cache hit ratio.
182 184
 	 */
183 185
 	public function getHitRatio()
184 186
 	{
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 class TSqlMapCacheModel extends \Prado\TComponent
39 39
 {
40 40
 	private $_cache;
41
-	private $_hits = 0;
42
-	private $_requests = 0;
41
+	private $_hits=0;
42
+	private $_requests=0;
43 43
 	private $_id;
44 44
 	private $_implementation=TSqlMapCacheTypes::Basic;
45
-	private $_properties = [];
46
-	private $_flushInterval = 0;
45
+	private $_properties=[];
46
+	private $_flushInterval=0;
47 47
 
48
-	private static $_cacheTypes = [];
48
+	private static $_cacheTypes=[];
49 49
 
50 50
 	public static function registerCacheType($type, $className)
51 51
 	{
52
-		self::$_cacheTypes[$type] = $className;
52
+		self::$_cacheTypes[$type]=$className;
53 53
 	}
54 54
 
55 55
 	/**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function setID($value)
67 67
 	{
68
-		$this->_id = $value;
68
+		$this->_id=$value;
69 69
 	}
70 70
 
71 71
 	/**
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function setImplementation($value)
83 83
 	{
84
-		if (isset(self::$_cacheTypes[$value]))
85
-			$this->_implementation = $value;
84
+		if(isset(self::$_cacheTypes[$value]))
85
+			$this->_implementation=$value;
86 86
 		else
87
-			$this->_implementation = TPropertyValue::ensureEnum($value, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes');
87
+			$this->_implementation=TPropertyValue::ensureEnum($value, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes');
88 88
 	}
89 89
 
90 90
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	public function initialize($cache=null)
111 111
 	{
112 112
 		if($cache===null)
113
-			$this->_cache= Prado::createComponent($this->getImplementationClass(), $this);
113
+			$this->_cache=Prado::createComponent($this->getImplementationClass(), $this);
114 114
 		else
115 115
 			$this->_cache=$cache;
116 116
 	}
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function getImplementationClass()
122 122
 	{
123
-		$implementation = $this->_implementation;
124
-		if (isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation];
123
+		$implementation=$this->_implementation;
124
+		if(isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation];
125 125
 
126 126
 		switch(TPropertyValue::ensureEnum($implementation, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes'))
127 127
 		{
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 	public function get($key)
156 156
 	{
157 157
 		if($key instanceof TSqlMapCacheKey)
158
-			$key = $key->getHash();
158
+			$key=$key->getHash();
159 159
 
160 160
 		//if flush ?
161
-		$value = $this->_cache->get($key);
161
+		$value=$this->_cache->get($key);
162 162
 		$this->_requests++;
163 163
 		if($value!==null)
164 164
 			$this->_hits++;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	public function set($key, $value)
173 173
 	{
174 174
 		if($key instanceof TSqlMapCacheKey)
175
-			$key = $key->getHash();
175
+			$key=$key->getHash();
176 176
 
177 177
 		if($value!==null)
178 178
 			$this->_cache->set($key, $value, $this->_flushInterval);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function getHitRatio()
185 185
 	{
186
-		if($this->_requests != 0)
186
+		if($this->_requests!=0)
187 187
 			return $this->_hits / $this->_requests;
188 188
 		else
189 189
 			return 0;
Please login to merge, or discard this patch.