Completed
Push — intl ( 51e284 )
by Fabio
06:51
created
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   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	 */
53 53
 	public function createCommandBuilder($connection)
54 54
 	{
55
-		return new TMysqlCommandBuilder($connection,$this);
55
+		return new TMysqlCommandBuilder($connection, $this);
56 56
 	}
57 57
 }
58 58
 
Please login to merge, or discard this patch.
framework/Data/Common/Oracle/TOracleTableInfo.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 	/**
49 49
 	 * @param TDbConnection database connection.
50
-	 * @return TDbCommandBuilder new command builder
50
+	 * @return TOracleCommandBuilder new command builder
51 51
 	 */
52 52
 	public function createCommandBuilder($connection)
53 53
 	{
@@ -57,6 +57,8 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * @param string information array key name
59 59
 	 * @param mixed default value if information array value is null
60
+	 * @param string $name
61
+	 * @param boolean $default
60 62
 	 * @return mixed information array value.
61 63
 	 */
62 64
 	public function getInfo($name,$default=null)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * Sets the database table meta data information.
38 38
 	 * @param array table column information.
39 39
 	 */
40
-	public function __construct($tableInfo=array(),$primary=array(),$foreign=array())
40
+	public function __construct($tableInfo=array(), $primary=array(), $foreign=array())
41 41
 	{
42 42
 		$this->_info=$tableInfo;
43 43
 		$this->_primaryKeys=$primary;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function createCommandBuilder($connection)
53 53
 	{
54
-		return new TOracleCommandBuilder($connection,$this);
54
+		return new TOracleCommandBuilder($connection, $this);
55 55
 	}
56 56
 
57 57
 	/**
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * @param mixed default value if information array value is null
60 60
 	 * @return mixed information array value.
61 61
 	 */
62
-	public function getInfo($name,$default=null)
62
+	public function getInfo($name, $default=null)
63 63
 	{
64 64
 		return isset($this->_info[$name]) ? $this->_info[$name] : $default;
65 65
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param string information array key name
69 69
 	 * @param mixed new information array value.
70 70
 	 */
71
-	protected function setInfo($name,$value)
71
+	protected function setInfo($name, $value)
72 72
 	{
73 73
 		$this->_info[$name]=$value;
74 74
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getIsView()
96 96
 	{
97
-		return $this->getInfo('IsView',false);
97
+		return $this->getInfo('IsView', false);
98 98
 	}
99 99
 
100 100
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function getColumn($name)
113 113
 	{
114
-		if(($column = $this->_columns->itemAt($name))!==null)
114
+		if(($column=$this->_columns->itemAt($name))!==null)
115 115
 			return $column;
116 116
 		throw new TDbException('dbtableinfo_invalid_column_name', $name, $this->getTableFullName());
117 117
 	}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	public function getColumnNames()
124 124
 	{
125 125
 		foreach($this->getColumns() as $column)
126
-			$names[] = $column->getColumnName();
126
+			$names[]=$column->getColumnName();
127 127
 		return $names;
128 128
 	}
129 129
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		{
153 153
 			$this->_lowercase=array();
154 154
 			foreach($this->getColumns()->getKeys() as $key)
155
-				$this->_lowercase[strtolower($key)] = $key;
155
+				$this->_lowercase[strtolower($key)]=$key;
156 156
 		}
157 157
 		return $this->_lowercase;
158 158
 	}
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
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	 */
53 53
 	public function createCommandBuilder($connection)
54 54
 	{
55
-		return new TPgsqlCommandBuilder($connection,$this);
55
+		return new TPgsqlCommandBuilder($connection, $this);
56 56
 	}
57 57
 }
58 58
 
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
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 */
34 34
 	public function createCommandBuilder($connection)
35 35
 	{
36
-		return new TSqliteCommandBuilder($connection,$this);
36
+		return new TSqliteCommandBuilder($connection, $this);
37 37
 	}
38 38
 
39 39
 	/**
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   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function __construct($builder)
45 45
 	{
46
-		$this->_builder = $builder;
46
+		$this->_builder=$builder;
47 47
 	}
48 48
 	/**
49 49
 	 * @return TDbTableInfo
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function delete($criteria)
75 75
 	{
76
-		$where = $criteria->getCondition();
77
-		$parameters = $criteria->getParameters()->toArray();
78
-		$command = $this->getBuilder()->createDeleteCommand($where, $parameters);
79
-		$this->onCreateCommand($command,$criteria);
76
+		$where=$criteria->getCondition();
77
+		$parameters=$criteria->getParameters()->toArray();
78
+		$command=$this->getBuilder()->createDeleteCommand($where, $parameters);
79
+		$this->onCreateCommand($command, $criteria);
80 80
 		$command->prepare();
81 81
 		return $command->execute();
82 82
 	}
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function update($data, $criteria)
90 90
 	{
91
-		$where = $criteria->getCondition();
92
-		$parameters = $criteria->getParameters()->toArray();
93
-		$command = $this->getBuilder()->createUpdateCommand($data,$where, $parameters);
94
-		$this->onCreateCommand($command,$criteria);
91
+		$where=$criteria->getCondition();
92
+		$parameters=$criteria->getParameters()->toArray();
93
+		$command=$this->getBuilder()->createUpdateCommand($data, $where, $parameters);
94
+		$this->onCreateCommand($command, $criteria);
95 95
 		$command->prepare();
96 96
 		return $this->onExecuteCommand($command, $command->execute());
97 97
 	}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function updateByPk($data, $keys)
104 104
 	{
105
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
105
+		list($where, $parameters)=$this->getPrimaryKeyCondition((array) $keys);
106 106
 		return $this->update($data, new TSqlCriteria($where, $parameters));
107 107
 	}
108 108
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function find($criteria)
114 114
 	{
115
-		$command = $this->getFindCommand($criteria);
115
+		$command=$this->getFindCommand($criteria);
116 116
 		return $this->onExecuteCommand($command, $command->queryRow());
117 117
 	}
118 118
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function findAll($criteria)
124 124
 	{
125
-		$command = $this->getFindCommand($criteria);
125
+		$command=$this->getFindCommand($criteria);
126 126
 		return $this->onExecuteCommand($command, $command->query());
127 127
 	}
128 128
 	/**
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	{
135 135
 		if($criteria===null)
136 136
 			return $this->getBuilder()->createFindCommand();
137
-		$where = $criteria->getCondition();
138
-		$parameters = $criteria->getParameters()->toArray();
139
-		$ordering = $criteria->getOrdersBy();
140
-		$limit = $criteria->getLimit();
141
-		$offset = $criteria->getOffset();
142
-		$select = $criteria->getSelect();
143
-		$command = $this->getBuilder()->createFindCommand($where,$parameters,$ordering,$limit,$offset,$select);
137
+		$where=$criteria->getCondition();
138
+		$parameters=$criteria->getParameters()->toArray();
139
+		$ordering=$criteria->getOrdersBy();
140
+		$limit=$criteria->getLimit();
141
+		$offset=$criteria->getOffset();
142
+		$select=$criteria->getSelect();
143
+		$command=$this->getBuilder()->createFindCommand($where, $parameters, $ordering, $limit, $offset, $select);
144 144
 		$this->onCreateCommand($command, $criteria);
145 145
 		return $command;
146 146
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	{
153 153
 		if($keys===null)
154 154
 			return null;
155
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
156
-		$command = $this->getBuilder()->createFindCommand($where, $parameters);
157
-		$this->onCreateCommand($command, new TSqlCriteria($where,$parameters));
155
+		list($where, $parameters)=$this->getPrimaryKeyCondition((array) $keys);
156
+		$command=$this->getBuilder()->createFindCommand($where, $parameters);
157
+		$this->onCreateCommand($command, new TSqlCriteria($where, $parameters));
158 158
 		return $this->onExecuteCommand($command, $command->queryRow());
159 159
 	}
160 160
 	/**
@@ -163,21 +163,21 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public function findAllByPk($keys)
165 165
 	{
166
-		$where = $this->getCompositeKeyCondition((array)$keys);
167
-		$command = $this->getBuilder()->createFindCommand($where);
168
-		$this->onCreateCommand($command, new TSqlCriteria($where,$keys));
169
-		return $this->onExecuteCommand($command,$command->query());
166
+		$where=$this->getCompositeKeyCondition((array) $keys);
167
+		$command=$this->getBuilder()->createFindCommand($where);
168
+		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
169
+		return $this->onExecuteCommand($command, $command->query());
170 170
 	}
171
-	public function findAllByIndex($criteria,$fields,$values)
171
+	public function findAllByIndex($criteria, $fields, $values)
172 172
 	{
173
-		$index = $this->getIndexKeyCondition($this->getTableInfo(),$fields,$values);
174
-		if(strlen($where = $criteria->getCondition())>0)
173
+		$index=$this->getIndexKeyCondition($this->getTableInfo(), $fields, $values);
174
+		if(strlen($where=$criteria->getCondition()) > 0)
175 175
 			$criteria->setCondition("({$index}) AND ({$where})");
176 176
 		else
177 177
 			$criteria->setCondition($index);
178
-		$command = $this->getFindCommand($criteria);
178
+		$command=$this->getFindCommand($criteria);
179 179
 		$this->onCreateCommand($command, $criteria);
180
-		return $this->onExecuteCommand($command,$command->query());
180
+		return $this->onExecuteCommand($command, $command->query());
181 181
 	}
182 182
 
183 183
 	/**
@@ -188,22 +188,22 @@  discard block
 block discarded – undo
188 188
 	{
189 189
 		if(count($keys)==0)
190 190
 			return 0;
191
-		$where = $this->getCompositeKeyCondition((array)$keys);
192
-		$command = $this->getBuilder()->createDeleteCommand($where);
193
-		$this->onCreateCommand($command, new TSqlCriteria($where,$keys));
191
+		$where=$this->getCompositeKeyCondition((array) $keys);
192
+		$command=$this->getBuilder()->createDeleteCommand($where);
193
+		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
194 194
 		$command->prepare();
195
-		return $this->onExecuteCommand($command,$command->execute());
195
+		return $this->onExecuteCommand($command, $command->execute());
196 196
 	}
197 197
 
198
-	public function getIndexKeyCondition($table,$fields,$values)
198
+	public function getIndexKeyCondition($table, $fields, $values)
199 199
 	{
200
-		if (!count($values))
200
+		if(!count($values))
201 201
 			return 'FALSE';
202
-		$columns = array();
203
-		$tableName = $table->getTableFullName();
202
+		$columns=array();
203
+		$tableName=$table->getTableFullName();
204 204
 		foreach($fields as $field)
205
-			$columns[] = $tableName.'.'.$table->getColumn($field)->getColumnName();
206
-		return '('.implode(', ',$columns).') IN '.$this->quoteTuple($values);
205
+			$columns[]=$tableName.'.'.$table->getColumn($field)->getColumnName();
206
+		return '('.implode(', ', $columns).') IN '.$this->quoteTuple($values);
207 207
 	}
208 208
 
209 209
 	/**
@@ -213,26 +213,26 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	protected function getCompositeKeyCondition($values)
215 215
 	{
216
-		$primary = $this->getTableInfo()->getPrimaryKeys();
217
-		$count = count($primary);
216
+		$primary=$this->getTableInfo()->getPrimaryKeys();
217
+		$count=count($primary);
218 218
 		if($count===0)
219 219
 		{
220 220
 			throw new TDbException('dbtablegateway_no_primary_key_found',
221 221
 				$this->getTableInfo()->getTableFullName());
222 222
 		}
223
-		if(!is_array($values) || count($values) === 0)
223
+		if(!is_array($values) || count($values)===0)
224 224
 		{
225 225
 			throw new TDbException('dbtablegateway_missing_pk_values',
226 226
 				$this->getTableInfo()->getTableFullName());
227 227
 		}
228
-		if($count>1 && (!isset($values[0]) || !is_array($values[0])))
229
-			$values = array($values);
230
-		if($count > 1 && count($values[0]) !== $count)
228
+		if($count > 1 && (!isset($values[0]) || !is_array($values[0])))
229
+			$values=array($values);
230
+		if($count > 1 && count($values[0])!==$count)
231 231
 		{
232 232
 			throw new TDbException('dbtablegateway_pk_value_count_mismatch',
233 233
 				$this->getTableInfo()->getTableFullName());
234 234
 		}
235
-		return $this->getIndexKeyCondition($this->getTableInfo(),$primary, $values);
235
+		return $this->getIndexKeyCondition($this->getTableInfo(), $primary, $values);
236 236
 	}
237 237
 
238 238
 	/**
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	protected function quoteTuple($array)
244 244
 	{
245
-		$conn = $this->getDbConnection();
246
-		$data = array();
245
+		$conn=$this->getDbConnection();
246
+		$data=array();
247 247
 		foreach($array as $k=>$v)
248
-			$data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
248
+			$data[]=is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
249 249
 		return '('.implode(', ', $data).')';
250 250
 	}
251 251
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	protected function getPrimaryKeyCondition($values)
258 258
 	{
259
-		$primary = $this->getTableInfo()->getPrimaryKeys();
259
+		$primary=$this->getTableInfo()->getPrimaryKeys();
260 260
 		if(count($primary)===0)
261 261
 		{
262 262
 			throw new TDbException('dbtablegateway_no_primary_key_found',
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 		}
265 265
 		$criteria=array();
266 266
 		$bindings=array();
267
-		$i = 0;
267
+		$i=0;
268 268
 		foreach($primary as $key)
269 269
 		{
270
-			$column = $this->getTableInfo()->getColumn($key)->getColumnName();
271
-			$criteria[] = $column.' = :'.$key;
272
-			$bindings[$key] = isset($values[$key])?$values[$key]:$values[$i++];
270
+			$column=$this->getTableInfo()->getColumn($key)->getColumnName();
271
+			$criteria[]=$column.' = :'.$key;
272
+			$bindings[$key]=isset($values[$key]) ? $values[$key] : $values[$i++];
273 273
 		}
274 274
 		return array(implode(' AND ', $criteria), $bindings);
275 275
 	}
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function findBySql($criteria)
283 283
 	{
284
-		$command = $this->getSqlCommand($criteria);
284
+		$command=$this->getSqlCommand($criteria);
285 285
 		return $this->onExecuteCommand($command, $command->queryRow());
286 286
 	}
287 287
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	public function findAllBySql($criteria)
294 294
 	{
295
-		$command = $this->getSqlCommand($criteria);
295
+		$command=$this->getSqlCommand($criteria);
296 296
 		return $this->onExecuteCommand($command, $command->query());
297 297
 	}
298 298
 
@@ -303,15 +303,15 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	protected function getSqlCommand($criteria)
305 305
 	{
306
-		$sql = $criteria->getCondition();
307
-		$ordering = $criteria->getOrdersBy();
308
-		$limit = $criteria->getLimit();
309
-		$offset = $criteria->getOffset();
306
+		$sql=$criteria->getCondition();
307
+		$ordering=$criteria->getOrdersBy();
308
+		$limit=$criteria->getLimit();
309
+		$offset=$criteria->getOffset();
310 310
 		if(count($ordering) > 0)
311
-			$sql = $this->getBuilder()->applyOrdering($sql, $ordering);
312
-		if($limit>=0 || $offset>=0)
313
-			$sql = $this->getBuilder()->applyLimitOffset($sql, $limit, $offset);
314
-		$command = $this->getBuilder()->createCommand($sql);
311
+			$sql=$this->getBuilder()->applyOrdering($sql, $ordering);
312
+		if($limit >= 0 || $offset >= 0)
313
+			$sql=$this->getBuilder()->applyLimitOffset($sql, $limit, $offset);
314
+		$command=$this->getBuilder()->createCommand($sql);
315 315
 		$this->getBuilder()->bindArrayValues($command, $criteria->getParameters()->toArray());
316 316
 		$this->onCreateCommand($command, $criteria);
317 317
 		return $command;
@@ -324,15 +324,15 @@  discard block
 block discarded – undo
324 324
 	public function count($criteria)
325 325
 	{
326 326
 		if($criteria===null)
327
-			return (int)$this->getBuilder()->createCountCommand()->queryScalar();
328
-		$where = $criteria->getCondition();
329
-		$parameters = $criteria->getParameters()->toArray();
330
-		$ordering = $criteria->getOrdersBy();
331
-		$limit = $criteria->getLimit();
332
-		$offset = $criteria->getOffset();
333
-		$command = $this->getBuilder()->createCountCommand($where,$parameters,$ordering,$limit,$offset);
327
+			return (int) $this->getBuilder()->createCountCommand()->queryScalar();
328
+		$where=$criteria->getCondition();
329
+		$parameters=$criteria->getParameters()->toArray();
330
+		$ordering=$criteria->getOrdersBy();
331
+		$limit=$criteria->getLimit();
332
+		$offset=$criteria->getOffset();
333
+		$command=$this->getBuilder()->createCountCommand($where, $parameters, $ordering, $limit, $offset);
334 334
 		$this->onCreateCommand($command, $criteria);
335
-		return $this->onExecuteCommand($command, (int)$command->queryScalar());
335
+		return $this->onExecuteCommand($command, (int) $command->queryScalar());
336 336
 	}
337 337
 
338 338
 	/**
@@ -345,12 +345,12 @@  discard block
 block discarded – undo
345 345
 	public function insert($data)
346 346
 	{
347 347
 		$command=$this->getBuilder()->createInsertCommand($data);
348
-		$this->onCreateCommand($command, new TSqlCriteria(null,$data));
348
+		$this->onCreateCommand($command, new TSqlCriteria(null, $data));
349 349
 		$command->prepare();
350 350
 		if($this->onExecuteCommand($command, $command->execute()) > 0)
351 351
 		{
352
-			$value = $this->getLastInsertId();
353
-			return $value !== null ? $value : true;
352
+			$value=$this->getLastInsertId();
353
+			return $value!==null ? $value : true;
354 354
 		}
355 355
 		return false;
356 356
 	}
@@ -373,14 +373,14 @@  discard block
 block discarded – undo
373 373
 	 */
374 374
 	public function createCriteriaFromString($method, $condition, $args)
375 375
 	{
376
-		$fields = $this->extractMatchingConditions($method, $condition);
377
-		$args=count($args) === 1 && is_array($args[0]) ? $args[0] : $args;
378
-		if(count($fields)>count($args))
376
+		$fields=$this->extractMatchingConditions($method, $condition);
377
+		$args=count($args)===1 && is_array($args[0]) ? $args[0] : $args;
378
+		if(count($fields) > count($args))
379 379
 		{
380 380
 			throw new TDbException('dbtablegateway_mismatch_args_exception',
381
-				$method,count($fields),count($args));
381
+				$method, count($fields), count($args));
382 382
 		}
383
-		return new TSqlCriteria(implode(' ',$fields), $args);
383
+		return new TSqlCriteria(implode(' ', $fields), $args);
384 384
 	}
385 385
 
386 386
 	/**
@@ -392,25 +392,25 @@  discard block
 block discarded – undo
392 392
 	 */
393 393
 	protected function extractMatchingConditions($method, $condition)
394 394
 	{
395
-		$table = $this->getTableInfo();
396
-		$columns = $table->getLowerCaseColumnNames();
397
-		$regexp = '/('.implode('|', array_keys($columns)).')(and|_and_|or|_or_)?/i';
398
-		$matches = array();
399
-		if(!preg_match_all($regexp, strtolower($condition), $matches,PREG_SET_ORDER))
395
+		$table=$this->getTableInfo();
396
+		$columns=$table->getLowerCaseColumnNames();
397
+		$regexp='/('.implode('|', array_keys($columns)).')(and|_and_|or|_or_)?/i';
398
+		$matches=array();
399
+		if(!preg_match_all($regexp, strtolower($condition), $matches, PREG_SET_ORDER))
400 400
 		{
401 401
 			throw new TDbException('dbtablegateway_mismatch_column_name',
402 402
 				$method, implode(', ', $columns), $table->getTableFullName());
403 403
 		}
404 404
 
405
-		$fields = array();
405
+		$fields=array();
406 406
 		foreach($matches as $match)
407 407
 		{
408
-			$key = $columns[$match[1]];
409
-			$column = $table->getColumn($key)->getColumnName();
410
-			$sql = $column . ' = ? ';
408
+			$key=$columns[$match[1]];
409
+			$column=$table->getColumn($key)->getColumnName();
410
+			$sql=$column.' = ? ';
411 411
 			if(count($match) > 2)
412
-				$sql .= strtoupper(str_replace('_', '', $match[2]));
413
-			$fields[] = $sql;
412
+				$sql.=strtoupper(str_replace('_', '', $match[2]));
413
+			$fields[]=$sql;
414 414
 		}
415 415
 		return $fields;
416 416
 	}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	public function onCreateCommand($command, $criteria)
427 427
 	{
428
-		$this->raiseEvent('OnCreateCommand', $this, new TDataGatewayEventParameter($command,$criteria));
428
+		$this->raiseEvent('OnCreateCommand', $this, new TDataGatewayEventParameter($command, $criteria));
429 429
 	}
430 430
 
431 431
 	/**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	 */
440 440
 	public function onExecuteCommand($command, $result)
441 441
 	{
442
-		$parameter = new TDataGatewayResultEventParameter($command, $result);
442
+		$parameter=new TDataGatewayResultEventParameter($command, $result);
443 443
 		$this->raiseEvent('OnExecuteCommand', $this, $parameter);
444 444
 		return $parameter->getResult();
445 445
 	}
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   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 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
 	/**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	protected function generateKey($string)
40 40
 	{
41
-		return sprintf('%x',crc32($string));
41
+		return sprintf('%x', crc32($string));
42 42
 	}
43 43
 
44 44
 	/**
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   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -37,18 +37,18 @@  discard block
 block discarded – undo
37 37
 class TSqlMapCacheModel extends \Prado\TComponent
38 38
 {
39 39
 	private $_cache;
40
-	private $_hits = 0;
41
-	private $_requests = 0;
40
+	private $_hits=0;
41
+	private $_requests=0;
42 42
 	private $_id;
43 43
 	private $_implementation=TSqlMapCacheTypes::Basic;
44
-	private $_properties = array();
45
-	private $_flushInterval = 0;
44
+	private $_properties=array();
45
+	private $_flushInterval=0;
46 46
 
47
-	private static $_cacheTypes = array();
47
+	private static $_cacheTypes=array();
48 48
 
49 49
 	public static function registerCacheType($type, $className)
50 50
 	{
51
-		self::$_cacheTypes[$type] = $className;
51
+		self::$_cacheTypes[$type]=$className;
52 52
 	}
53 53
 
54 54
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function setID($value)
66 66
 	{
67
-		$this->_id = $value;
67
+		$this->_id=$value;
68 68
 	}
69 69
 
70 70
 	/**
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function setImplementation($value)
82 82
 	{
83
-		if (isset(self::$_cacheTypes[$value]))
84
-			$this->_implementation = $value;
83
+		if(isset(self::$_cacheTypes[$value]))
84
+			$this->_implementation=$value;
85 85
 		else
86
-			$this->_implementation = TPropertyValue::ensureEnum($value,'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes');
86
+			$this->_implementation=TPropertyValue::ensureEnum($value, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes');
87 87
 	}
88 88
 
89 89
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	public function initialize($cache=null)
110 110
 	{
111 111
 		if($cache===null)
112
-			$this->_cache= Prado::createComponent($this->getImplementationClass(), $this);
112
+			$this->_cache=Prado::createComponent($this->getImplementationClass(), $this);
113 113
 		else
114 114
 			$this->_cache=$cache;
115 115
 	}
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function getImplementationClass()
121 121
 	{
122
-		$implementation = $this->_implementation;
123
-		if (isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation];
122
+		$implementation=$this->_implementation;
123
+		if(isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation];
124 124
 
125
-		switch(TPropertyValue::ensureEnum($implementation,'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes'))
125
+		switch(TPropertyValue::ensureEnum($implementation, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes'))
126 126
 		{
127 127
 			case TSqlMapCacheTypes::FIFO: return '\\Prado\\Data\\SqlMap\\DataMapper\\TSqlMapFifoCache';
128 128
 			case TSqlMapCacheTypes::LRU : return '\\Prado\\Data\\SqlMap\\DataMapper\\TSqlMapLruCache';
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function registerTriggerStatement($mappedStatement)
138 138
 	{
139
-		$mappedStatement->attachEventHandler('OnExecuteQuery',array($this, 'flush'));
139
+		$mappedStatement->attachEventHandler('OnExecuteQuery', array($this, 'flush'));
140 140
 	}
141 141
 
142 142
 	/**
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 	public function get($key)
155 155
 	{
156 156
 		if($key instanceof TSqlMapCacheKey)
157
-			$key = $key->getHash();
157
+			$key=$key->getHash();
158 158
 
159 159
 		//if flush ?
160
-		$value = $this->_cache->get($key);
160
+		$value=$this->_cache->get($key);
161 161
 		$this->_requests++;
162 162
 		if($value!==null)
163 163
 			$this->_hits++;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	public function set($key, $value)
172 172
 	{
173 173
 		if($key instanceof TSqlMapCacheKey)
174
-			$key = $key->getHash();
174
+			$key=$key->getHash();
175 175
 
176 176
 		if($value!==null)
177 177
 			$this->_cache->set($key, $value, $this->_flushInterval);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public function getHitRatio()
184 184
 	{
185
-		if($this->_requests != 0)
185
+		if($this->_requests!=0)
186 186
 			return $this->_hits / $this->_requests;
187 187
 		else
188 188
 			return 0;
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php 2 patches
Doc Comments   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * Create an instance of an object give by the attribute named 'class' in the
28 28
 	 * node and set the properties on the object given by attribute names and values.
29 29
 	 * @param SimpleXmlNode property node
30
-	 * @return Object new instance of class with class name given by 'class' attribute value.
30
+	 * @return \Prado\TComponent new instance of class with class name given by 'class' attribute value.
31 31
 	 */
32 32
 	protected function createObjectFromNode($node)
33 33
 	{
@@ -47,6 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param Object object instance
48 48
 	 * @param SimpleXmlNode property node
49 49
 	 * @param array exception property name
50
+	 * @param \Prado\TComponent $obj
50 51
 	 */
51 52
 	protected function setObjectPropFromNode($obj,$node,$except=array())
52 53
 	{
@@ -67,6 +68,8 @@  discard block
 block discarded – undo
67 68
 	 * Gets the filename relative to the basefile.
68 69
 	 * @param string base filename
69 70
 	 * @param string relative filename
71
+	 * @param string $basefile
72
+	 * @param string $resource
70 73
 	 * @return string absolute filename.
71 74
 	 */
72 75
 	protected function getAbsoluteFilePath($basefile,$resource)
@@ -84,7 +87,7 @@  discard block
 block discarded – undo
84 87
 	/**
85 88
 	 * Load document using simple xml.
86 89
 	 * @param string filename.
87
-	 * @return SimpleXmlElement xml document.
90
+	 * @return \SimpleXMLElement xml document.
88 91
 	 */
89 92
 	protected function loadXmlDocument($filename,TSqlMapXmlConfiguration $config)
90 93
 	{
@@ -97,9 +100,10 @@  discard block
 block discarded – undo
97 100
 	}
98 101
 	/**
99 102
 	 * Get element node by ID value (try for attribute name ID as case insensitive).
100
-	 * @param SimpleXmlDocument $document
103
+	 * @param \SimpleXMLElement $document
101 104
 	 * @param string tag name.
102 105
 	 * @param string id value.
106
+	 * @param string $tag
103 107
 	 * @return SimpleXmlElement node if found, null otherwise.
104 108
 	 */
105 109
 	protected function getElementByIdValue($document, $tag, $value)
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	{
34 34
 		if(isset($node['class']))
35 35
 		{
36
-			$obj = Prado::createComponent((string)$node['class']);
37
-			$this->setObjectPropFromNode($obj,$node,array('class'));
36
+			$obj=Prado::createComponent((string) $node['class']);
37
+			$this->setObjectPropFromNode($obj, $node, array('class'));
38 38
 			return $obj;
39 39
 		}
40 40
 		throw new TSqlMapConfigurationException(
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 	 * @param SimpleXmlNode property node
49 49
 	 * @param array exception property name
50 50
 	 */
51
-	protected function setObjectPropFromNode($obj,$node,$except=array())
51
+	protected function setObjectPropFromNode($obj, $node, $except=array())
52 52
 	{
53 53
 		foreach($node->attributes() as $name=>$value)
54 54
 		{
55
-			if(!in_array($name,$except))
55
+			if(!in_array($name, $except))
56 56
 			{
57 57
 				if($obj->canSetProperty($name))
58
-					$obj->{$name} = (string)$value;
58
+					$obj->{$name}=(string) $value;
59 59
 				else
60 60
 					throw new TSqlMapConfigurationException(
61 61
 						'sqlmap_invalid_property', $name, get_class($obj),
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 	 * @param string relative filename
70 70
 	 * @return string absolute filename.
71 71
 	 */
72
-	protected function getAbsoluteFilePath($basefile,$resource)
72
+	protected function getAbsoluteFilePath($basefile, $resource)
73 73
 	{
74
-		$basedir = dirname($basefile);
75
-		$file = realpath($basedir.DIRECTORY_SEPARATOR.$resource);
74
+		$basedir=dirname($basefile);
75
+		$file=realpath($basedir.DIRECTORY_SEPARATOR.$resource);
76 76
 		if(!is_string($file) || !is_file($file))
77
-			$file = realpath($resource);
77
+			$file=realpath($resource);
78 78
 		if(is_string($file) && is_file($file))
79 79
 			return $file;
80 80
 		else
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 * @param string filename.
87 87
 	 * @return SimpleXmlElement xml document.
88 88
 	 */
89
-	protected function loadXmlDocument($filename,TSqlMapXmlConfiguration $config)
89
+	protected function loadXmlDocument($filename, TSqlMapXmlConfiguration $config)
90 90
 	{
91
-		if( strpos($filename, '${') !== false)
92
-			$filename = $config->replaceProperties($filename);
91
+		if(strpos($filename, '${')!==false)
92
+			$filename=$config->replaceProperties($filename);
93 93
 		if(!is_file($filename))
94 94
 			throw new TSqlMapConfigurationException(
95 95
 				'sqlmap_unable_to_find_config', $filename);
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	protected function getElementByIdValue($document, $tag, $value)
106 106
 	{
107 107
 		//hack to allow upper case and lower case attribute names.
108
-		foreach(array('id','ID','Id', 'iD') as $id)
108
+		foreach(array('id', 'ID', 'Id', 'iD') as $id)
109 109
 		{
110
-			$xpath = "//{$tag}[@{$id}='{$value}']";
110
+			$xpath="//{$tag}[@{$id}='{$value}']";
111 111
 			foreach($document->xpath($xpath) as $node)
112 112
 				return $node;
113 113
 		}
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -38,6 +38,7 @@
 block discarded – undo
38 38
 
39 39
 	/**
40 40
 	 * @param TSqlMapManager manager instance.
41
+	 * @param \Prado\Data\SqlMap\TSqlMapManager $manager
41 42
 	 */
42 43
 	public function __construct($manager)
43 44
 	{
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	public function configure($filename=null)
62 62
 	{
63 63
 		$this->_configFile=$filename;
64
-		$document = $this->loadXmlDocument($filename,$this);
64
+		$document=$this->loadXmlDocument($filename, $this);
65 65
 
66 66
 		foreach($document->xpath('//property') as $property)
67 67
 			$this->loadGlobalProperty($property);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 			$this->loadDatabaseConnection($conn);
74 74
 
75 75
 		//try to load configuration in the current config file.
76
-		$mapping = new TSqlMapXmlMappingConfiguration($this);
76
+		$mapping=new TSqlMapXmlMappingConfiguration($this);
77 77
 		$mapping->configure($filename);
78 78
 
79 79
 		foreach($document->xpath('//sqlMap') as $sqlmap)
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	protected function loadGlobalProperty($node)
91 91
 	{
92
-		$this->_properties[(string)$node['name']] = (string)$node['value'];
92
+		$this->_properties[(string) $node['name']]=(string) $node['value'];
93 93
 	}
94 94
 
95 95
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	protected function loadTypeHandler($node)
100 100
 	{
101
-		$handler = $this->createObjectFromNode($node);
101
+		$handler=$this->createObjectFromNode($node);
102 102
 		$this->_manager->getTypeHandlers()->registerTypeHandler($handler);
103 103
 	}
104 104
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	protected function loadDatabaseConnection($node)
110 110
 	{
111
-		$conn = $this->createObjectFromNode($node);
111
+		$conn=$this->createObjectFromNode($node);
112 112
 		$this->_manager->setDbConnection($conn);
113 113
 	}
114 114
 
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function loadSqlMappingFiles($node)
120 120
 	{
121
-		if(strlen($resource = (string)$node['resource']) > 0)
121
+		if(strlen($resource=(string) $node['resource']) > 0)
122 122
 		{
123
-			if( strpos($resource, '${') !== false)
124
-				$resource = $this->replaceProperties($resource);
123
+			if(strpos($resource, '${')!==false)
124
+				$resource=$this->replaceProperties($resource);
125 125
 
126
-			$mapping = new TSqlMapXmlMappingConfiguration($this);
127
-			$filename = $this->getAbsoluteFilePath($this->_configFile, $resource);
126
+			$mapping=new TSqlMapXmlMappingConfiguration($this);
127
+			$filename=$this->getAbsoluteFilePath($this->_configFile, $resource);
128 128
 			$mapping->configure($filename);
129 129
 		}
130 130
 	}
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function resolveResultMapping()
136 136
 	{
137
-		$maps = $this->_manager->getResultMaps();
137
+		$maps=$this->_manager->getResultMaps();
138 138
 		foreach($maps as $entry)
139 139
 		{
140 140
 			foreach($entry->getColumns() as $item)
141 141
 			{
142
-				$resultMap = $item->getResultMapping();
142
+				$resultMap=$item->getResultMapping();
143 143
 				if(strlen($resultMap) > 0)
144 144
 				{
145 145
 					if($maps->contains($resultMap))
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 	{
163 163
 		foreach($this->_manager->getMappedStatements() as $mappedStatement)
164 164
 		{
165
-			if(strlen($model = $mappedStatement->getStatement()->getCacheModel()) > 0)
165
+			if(strlen($model=$mappedStatement->getStatement()->getCacheModel()) > 0)
166 166
 			{
167
-				$cache = $this->_manager->getCacheModel($model);
167
+				$cache=$this->_manager->getCacheModel($model);
168 168
 				$mappedStatement->getStatement()->setCache($cache);
169 169
 			}
170 170
 		}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	public function replaceProperties($string)
180 180
 	{
181 181
 		foreach($this->_properties as $find => $replace)
182
-			$string = str_replace('${'.$find.'}', $replace, $string);
182
+			$string=str_replace('${'.$find.'}', $replace, $string);
183 183
 		return $string;
184 184
 	}
185 185
 }
186 186
\ No newline at end of file
Please login to merge, or discard this patch.