Completed
Push — prado-3.3 ( e90646...0b76d5 )
by Fabio
23:37 queued 03:01
created
framework/Data/Common/Sqlite/TSqliteMetaData.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -159,6 +159,7 @@
 block discarded – undo
159 159
 	 *
160 160
 	 *
161 161
 	 * @param string quoted table name.
162
+	 * @param string $table
162 163
 	 * @return array foreign key details.
163 164
 	 */
164 165
 	protected function getForeignKeys($table)
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -189,11 +189,11 @@
 block discarded – undo
189 189
 		return false;
190 190
 	}
191 191
 
192
-        /**
193
-	 * Returns all table names in the database.
194
-	 * @param string $schema the schema of the tables. This is not used for sqlite database.
195
-	 * @return array all table names in the database.
196
-	 */
192
+		/**
193
+		 * Returns all table names in the database.
194
+		 * @param string $schema the schema of the tables. This is not used for sqlite database.
195
+		 * @return array all table names in the database.
196
+		 */
197 197
 	public function findTableNames($schema='')
198 198
 	{
199 199
 		$sql="SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'";
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -69,30 +69,30 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	protected function createTableInfo($tableName)
71 71
 	{
72
-		$tableName = str_replace("'",'',$tableName);
72
+		$tableName = str_replace("'", '', $tableName);
73 73
 		$this->getDbConnection()->setActive(true);
74 74
 		$table = $this->getDbConnection()->quoteString($tableName);
75 75
 		$sql = "PRAGMA table_info({$table})";
76 76
 		$command = $this->getDbConnection()->createCommand($sql);
77 77
 		$foreign = $this->getForeignKeys($table);
78
-		$index=0;
79
-		$columns=array();
80
-		$primary=array();
81
-		foreach($command->query() as $col)
78
+		$index = 0;
79
+		$columns = array();
80
+		$primary = array();
81
+		foreach ($command->query() as $col)
82 82
 		{
83 83
 			$col['index'] = $index++;
84 84
 			$column = $this->processColumn($col, $foreign);
85 85
 			$columns[$col['name']] = $column;
86
-			if($column->getIsPrimaryKey())
86
+			if ($column->getIsPrimaryKey())
87 87
 				$primary[] = $col['name'];
88 88
 		}
89 89
 		$info['TableName'] = $tableName;
90
-		if($this->getIsView($tableName))
90
+		if ($this->getIsView($tableName))
91 91
 			$info['IsView'] = true;
92
-		if(count($columns)===0)
92
+		if (count($columns) === 0)
93 93
 			throw new TDbException('dbmetadata_invalid_table_view', $tableName);
94 94
 		$class = $this->getTableInfoClass();
95
-		$tableInfo = new $class($info,$primary,$foreign);
95
+		$tableInfo = new $class($info, $primary, $foreign);
96 96
 		$tableInfo->getColumns()->copyFrom($columns);
97 97
 		return $tableInfo;
98 98
 	}
@@ -119,37 +119,37 @@  discard block
 block discarded – undo
119 119
 	{
120 120
 		$columnId = $col['name']; //use column name as column Id
121 121
 
122
-		$info['ColumnName'] = '"'.$columnId.'"'; //quote the column names!
122
+		$info['ColumnName'] = '"' . $columnId . '"'; //quote the column names!
123 123
 		$info['ColumnId'] = $columnId;
124 124
 		$info['ColumnIndex'] = $col['index'];
125 125
 
126
-		if($col['notnull']!=='99')
126
+		if ($col['notnull'] !== '99')
127 127
 			$info['AllowNull'] = true;
128 128
 
129
-		if($col['pk']==='1')
129
+		if ($col['pk'] === '1')
130 130
 			$info['IsPrimaryKey'] = true;
131
-		if($this->isForeignKeyColumn($columnId, $foreign))
131
+		if ($this->isForeignKeyColumn($columnId, $foreign))
132 132
 			$info['IsForeignKey'] = true;
133 133
 
134
-		if($col['dflt_value']!==null)
134
+		if ($col['dflt_value'] !== null)
135 135
 			$info['DefaultValue'] = $col['dflt_value'];
136 136
 
137 137
 		$type = strtolower($col['type']);
138
-		$info['AutoIncrement'] = $type==='integer' && $col['pk']==='1';
138
+		$info['AutoIncrement'] = $type === 'integer' && $col['pk'] === '1';
139 139
 
140 140
 		$info['DbType'] = $type;
141
-		$match=array();
142
-		if(is_int($pos=strpos($type, '(')) && preg_match('/\((.*)\)/', $type, $match))
141
+		$match = array();
142
+		if (is_int($pos = strpos($type, '(')) && preg_match('/\((.*)\)/', $type, $match))
143 143
 		{
144 144
 			$ps = explode(',', $match[1]);
145
-			if(count($ps)===2)
145
+			if (count($ps) === 2)
146 146
 			{
147 147
 				$info['NumericPrecision'] = intval($ps[0]);
148 148
 				$info['NumericScale'] = intval($ps[1]);
149 149
 			}
150 150
 			else
151
-				$info['ColumnSize']=intval($match[1]);
152
-			$info['DbType'] = substr($type,0,$pos);
151
+				$info['ColumnSize'] = intval($match[1]);
152
+			$info['DbType'] = substr($type, 0, $pos);
153 153
 		}
154 154
 
155 155
 		return new TSqliteTableColumn($info);
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		$sql = "PRAGMA foreign_key_list({$table})";
167 167
 		$command = $this->getDbConnection()->createCommand($sql);
168 168
 		$fkeys = array();
169
-		foreach($command->query() as $col)
169
+		foreach ($command->query() as $col)
170 170
 		{
171 171
 			$fkeys[$col['table']]['keys'][$col['from']] = $col['to'];
172 172
 			$fkeys[$col['table']]['table'] = $col['table'];
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	protected function isForeignKeyColumn($columnId, $foreign)
183 183
 	{
184
-		foreach($foreign as $fk)
184
+		foreach ($foreign as $fk)
185 185
 		{
186
-			if(in_array($columnId, array_keys($fk['keys'])))
186
+			if (in_array($columnId, array_keys($fk['keys'])))
187 187
 				return true;
188 188
 		}
189 189
 		return false;
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	 * @param string $schema the schema of the tables. This is not used for sqlite database.
195 195
 	 * @return array all table names in the database.
196 196
 	 */
197
-	public function findTableNames($schema='')
197
+	public function findTableNames($schema = '')
198 198
 	{
199
-		$sql="SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'";
199
+		$sql = "SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'";
200 200
 		return $this->getDbConnection()->createCommand($sql)->queryColumn();
201 201
 	}
202 202
 }
203 203
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,8 +146,7 @@
 block discarded – undo
146 146
 			{
147 147
 				$info['NumericPrecision'] = intval($ps[0]);
148 148
 				$info['NumericScale'] = intval($ps[1]);
149
-			}
150
-			else
149
+			} else
151 150
 				$info['ColumnSize']=intval($match[1]);
152 151
 			$info['DbType'] = substr($type,0,$pos);
153 152
 		}
Please login to merge, or discard this patch.
framework/Data/Common/TDbCommandBuilder.php 4 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	/**
68 68
 	 * Iterate through all the columns and returns the last insert id of the
69 69
 	 * first column that has a sequence or serial.
70
-	 * @return mixed last insert id, null if none is found.
70
+	 * @return string|null last insert id, null if none is found.
71 71
 	 */
72 72
 	public function getLastInsertID()
73 73
 	{
@@ -187,7 +187,6 @@  discard block
 block discarded – undo
187 187
 	 * array('col1' => 'NULL', '*')
188 188
 	 * // SELECT `col1`, `col2`, `col3`, NULL AS `col1` FROM...
189 189
 	 * </code>
190
-	 * @param mixed $value
191 190
 	 * @return array of generated fields - use implode(', ', $selectfieldlist) to collapse field list for usage
192 191
 	 * @since 3.1.7
193 192
 	 * @todo add support for table aliasing
@@ -395,7 +394,7 @@  discard block
 block discarded – undo
395 394
 	/**
396 395
 	 * Returns a list of insert field name and a list of binding names.
397 396
 	 * @param object array or object to be inserted.
398
-	 * @return array tuple ($fields, $bindings)
397
+	 * @return string[] tuple ($fields, $bindings)
399 398
 	 */
400 399
 	protected function getInsertFieldBindings($values)
401 400
 	{
@@ -439,6 +438,7 @@  discard block
 block discarded – undo
439 438
 	 * Bind the name-value pairs of $values where the array keys correspond to column names.
440 439
 	 * @param TDbCommand database command.
441 440
 	 * @param array name-value pairs.
441
+	 * @param TDbCommand $command
442 442
 	 */
443 443
 	public function bindColumnValues($command, $values)
444 444
 	{
@@ -455,6 +455,7 @@  discard block
 block discarded – undo
455 455
 	/**
456 456
 	 * @param TDbCommand database command
457 457
 	 * @param array values for binding.
458
+	 * @param TDbCommand $command
458 459
 	 */
459 460
 	public function bindArrayValues($command, $values)
460 461
 	{
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param TDbConnection database connection.
27 27
 	 * @param TDbTableInfo table information.
28 28
 	 */
29
-	public function __construct($connection=null, $tableInfo=null)
29
+	public function __construct($connection = null, $tableInfo = null)
30 30
 	{
31 31
 		$this->setDbConnection($connection);
32 32
 		$this->setTableInfo($tableInfo);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function setDbConnection($value)
47 47
 	{
48
-		$this->_connection=$value;
48
+		$this->_connection = $value;
49 49
 	}
50 50
 
51 51
 	/**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function setTableInfo($value)
55 55
 	{
56
-		$this->_tableInfo=$value;
56
+		$this->_tableInfo = $value;
57 57
 	}
58 58
 
59 59
 	/**
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function getLastInsertID()
73 73
 	{
74
-		foreach($this->getTableInfo()->getColumns() as $column)
74
+		foreach ($this->getTableInfo()->getColumns() as $column)
75 75
 		{
76
-			if($column->hasSequence())
76
+			if ($column->hasSequence())
77 77
 				return $this->getDbConnection()->getLastInsertID($column->getSequenceName());
78 78
 		}
79 79
 	}
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 	 * @param integer row offset, -1 to ignore offset.
87 87
 	 * @return string SQL with limit and offset.
88 88
 	 */
89
-	public function applyLimitOffset($sql, $limit=-1, $offset=-1)
89
+	public function applyLimitOffset($sql, $limit = -1, $offset = -1)
90 90
 	{
91
-		$limit = $limit!==null ? (int)$limit : -1;
92
-		$offset = $offset!==null ? (int)$offset : -1;
93
-		$limitStr = $limit >= 0 ? ' LIMIT '.$limit : '';
94
-		$offsetStr = $offset >= 0 ? ' OFFSET '.$offset : '';
95
-		return $sql.$limitStr.$offsetStr;
91
+		$limit = $limit !== null ? (int) $limit : -1;
92
+		$offset = $offset !== null ? (int) $offset : -1;
93
+		$limitStr = $limit >= 0 ? ' LIMIT ' . $limit : '';
94
+		$offsetStr = $offset >= 0 ? ' OFFSET ' . $offset : '';
95
+		return $sql . $limitStr . $offsetStr;
96 96
 	}
97 97
 
98 98
 	/**
@@ -102,21 +102,21 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function applyOrdering($sql, $ordering)
104 104
 	{
105
-		$orders=array();
106
-		foreach($ordering as $name => $direction)
105
+		$orders = array();
106
+		foreach ($ordering as $name => $direction)
107 107
 		{
108 108
 			$direction = strtolower($direction) == 'desc' ? 'DESC' : 'ASC';
109
-			if(false !== strpos($name, '(') && false !== strpos($name, ')')) {
109
+			if (false !== strpos($name, '(') && false !== strpos($name, ')')) {
110 110
 				// key is a function (bad practice, but we need to handle it)
111 111
 				$key = $name;
112 112
 			} else {
113 113
 				// key is a column
114 114
 				$key = $this->getTableInfo()->getColumn($name)->getColumnName();
115 115
 			}
116
-			$orders[] = $key.' '.$direction;
116
+			$orders[] = $key . ' ' . $direction;
117 117
 		}
118
-		if(count($orders) > 0)
119
-			$sql .= ' ORDER BY '.implode(', ', $orders);
118
+		if (count($orders) > 0)
119
+			$sql .= ' ORDER BY ' . implode(', ', $orders);
120 120
 		return $sql;
121 121
 	}
122 122
 
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function getSearchExpression($fields, $keywords)
132 132
 	{
133
-		if(strlen(trim($keywords)) == 0) return '';
133
+		if (strlen(trim($keywords)) == 0) return '';
134 134
 		$words = preg_split('/\s/u', $keywords);
135 135
 		$conditions = array();
136
-		foreach($fields as $field)
136
+		foreach ($fields as $field)
137 137
 		{
138 138
 			$column = $this->getTableInfo()->getColumn($field)->getColumnName();
139 139
 			$conditions[] = $this->getSearchCondition($column, $words);
140 140
 		}
141
-		return '('.implode(' OR ', $conditions).')';
141
+		return '(' . implode(' OR ', $conditions) . ')';
142 142
 	}
143 143
 
144 144
 	/**
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	protected function getSearchCondition($column, $words)
150 150
 	{
151
-		$conditions=array();
152
-		foreach($words as $word)
153
-			$conditions[] = $column.' LIKE '.$this->getDbConnection()->quoteString('%'.$word.'%');
154
-		return '('.implode(' AND ', $conditions).')';
151
+		$conditions = array();
152
+		foreach ($words as $word)
153
+			$conditions[] = $column . ' LIKE ' . $this->getDbConnection()->quoteString('%' . $word . '%');
154
+		return '(' . implode(' AND ', $conditions) . ')';
155 155
 	}
156 156
 
157 157
 	/**
@@ -193,103 +193,103 @@  discard block
 block discarded – undo
193 193
 	 * @todo add support for table aliasing
194 194
 	 * @todo add support for quoting of column aliasing
195 195
 	 */
196
-	public function getSelectFieldList($data='*') {
197
-		if(is_scalar($data)) {
196
+	public function getSelectFieldList($data = '*') {
197
+		if (is_scalar($data)) {
198 198
 			$tmp = explode(',', $data);
199 199
 			$result = array();
200
-			foreach($tmp as $v)
200
+			foreach ($tmp as $v)
201 201
 				$result[] = trim($v);
202 202
 			return $result;
203 203
 		}
204 204
 
205 205
 		$bHasWildcard = false;
206 206
 		$result = array();
207
-		if(is_array($data) || $data instanceof Traversable) {
207
+		if (is_array($data) || $data instanceof Traversable) {
208 208
 			$columns = $this->getTableInfo()->getColumns();
209
-			foreach($data as $key=>$value) {
210
-				if($key==='*' || $value==='*') {
209
+			foreach ($data as $key=>$value) {
210
+				if ($key === '*' || $value === '*') {
211 211
 					$bHasWildcard = true;
212 212
 					continue;
213 213
 				}
214 214
 
215
-				if(strToUpper($key)==='NULL') {
215
+				if (strToUpper($key) === 'NULL') {
216 216
 					$result[] = 'NULL';
217 217
 					continue;
218 218
 				}
219 219
 
220
-				if(strpos($key, '(')!==false && strpos($key, ')')!==false) {
220
+				if (strpos($key, '(') !== false && strpos($key, ')') !== false) {
221 221
 					$result[] = $key;
222 222
 					continue;
223 223
 				}
224 224
 
225
-				if(stripos($key, 'AS')!==false) {
225
+				if (stripos($key, 'AS') !== false) {
226 226
 					$result[] = $key;
227 227
 					continue;
228 228
 				}
229 229
 
230
-				if(stripos($value, 'AS')!==false) {
230
+				if (stripos($value, 'AS') !== false) {
231 231
 					$result[] = $value;
232 232
 					continue;
233 233
 				}
234 234
 
235 235
 				$v = isset($columns[$value]);
236 236
 				$k = isset($columns[$key]);
237
-				if(is_integer($key) && $v) {
237
+				if (is_integer($key) && $v) {
238 238
 					$key = $value;
239 239
 					$k = $v;
240 240
 				}
241 241
 
242
-				if(strToUpper($value)==='NULL') {
243
-					if($k)
242
+				if (strToUpper($value) === 'NULL') {
243
+					if ($k)
244 244
 						$result[] = 'NULL AS ' . $columns[$key]->getColumnName();
245 245
 					else
246
-						$result[] = 'NULL' . (is_string($key) ? (' AS ' . (string)$key) : '');
246
+						$result[] = 'NULL' . (is_string($key) ? (' AS ' . (string) $key) : '');
247 247
 					continue;
248 248
 				}
249 249
 
250
-				if(strpos($value, '(')!==false && strpos($value, ')')!==false) {
251
-					if($k)
250
+				if (strpos($value, '(') !== false && strpos($value, ')') !== false) {
251
+					if ($k)
252 252
 						$result[] = $value . ' AS ' . $columns[$key]->getColumnName();
253 253
 					else
254
-						$result[] = $value . (is_string($key) ? (' AS ' . (string)$key) : '');
254
+						$result[] = $value . (is_string($key) ? (' AS ' . (string) $key) : '');
255 255
 					continue;
256 256
 				}
257 257
 
258
-				if($v && $key==$value) {
258
+				if ($v && $key == $value) {
259 259
 					$result[] = $columns[$value]->getColumnName();
260 260
 					continue;
261 261
 				}
262 262
 
263
-				if($k && $value==null) {
263
+				if ($k && $value == null) {
264 264
 					$result[] = $columns[$key]->getColumnName();
265 265
 					continue;
266 266
 				}
267 267
 
268
-				if(is_string($key) && $v) {
268
+				if (is_string($key) && $v) {
269 269
 					$result[] = $columns[$value]->getColumnName() . ' AS ' . $key;
270 270
 					continue;
271 271
 				}
272 272
 
273
-				if(is_numeric($value) && $k) {
273
+				if (is_numeric($value) && $k) {
274 274
 					$result[] = $value . ' AS ' . $columns[$key]->getColumnName();
275 275
 					continue;
276 276
 				}
277 277
 
278
-				if(is_string($value) && $k) {
278
+				if (is_string($value) && $k) {
279 279
 					$result[] = $this->getDbConnection()->quoteString($value) . ' AS ' . $columns[$key]->getColumnName();
280 280
 					continue;
281 281
 				}
282 282
 
283
-				if(!$v && !$k && is_integer($key)) {
284
-					$result[] = is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value);
283
+				if (!$v && !$k && is_integer($key)) {
284
+					$result[] = is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string) $value);
285 285
 					continue;
286 286
 				}
287 287
 
288
-				$result[] = (is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value)) . ' AS ' . $key;
288
+				$result[] = (is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string) $value)) . ' AS ' . $key;
289 289
 			}
290 290
 		}
291 291
 
292
-		if($data===null || count($result) == 0 || $bHasWildcard)
292
+		if ($data === null || count($result) == 0 || $bHasWildcard)
293 293
 			$result = $result = array_merge($this->getTableInfo()->getColumnNames(), $result);
294 294
 
295 295
 		return $result;
@@ -302,21 +302,21 @@  discard block
 block discarded – undo
302 302
 	 * @param array condition parameters.
303 303
 	 * @return TDbCommand query command.
304 304
 	 */
305
-	public function createFindCommand($where='1=1', $parameters=array(), $ordering=array(), $limit=-1, $offset=-1, $select='*')
305
+	public function createFindCommand($where = '1=1', $parameters = array(), $ordering = array(), $limit = -1, $offset = -1, $select = '*')
306 306
 	{
307 307
 		$table = $this->getTableInfo()->getTableFullName();
308 308
 		$fields = implode(', ', $this -> getSelectFieldList($select));
309 309
 		$sql = "SELECT {$fields} FROM {$table}";
310
-		if(!empty($where))
310
+		if (!empty($where))
311 311
 			$sql .= " WHERE {$where}";
312 312
 		return $this->applyCriterias($sql, $parameters, $ordering, $limit, $offset);
313 313
 	}
314 314
 
315
-	public function applyCriterias($sql, $parameters=array(),$ordering=array(), $limit=-1, $offset=-1)
315
+	public function applyCriterias($sql, $parameters = array(), $ordering = array(), $limit = -1, $offset = -1)
316 316
 	{
317
-		if(count($ordering) > 0)
317
+		if (count($ordering) > 0)
318 318
 			$sql = $this->applyOrdering($sql, $ordering);
319
-		if($limit>=0 || $offset>=0)
319
+		if ($limit >= 0 || $offset >= 0)
320 320
 			$sql = $this->applyLimitOffset($sql, $limit, $offset);
321 321
 		$command = $this->createCommand($sql);
322 322
 		$this->bindArrayValues($command, $parameters);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @param array binding parameters.
330 330
 	 * @return TDbCommand count command.
331 331
 	 */
332
-	public function createCountCommand($where='1=1', $parameters=array(),$ordering=array(), $limit=-1, $offset=-1)
332
+	public function createCountCommand($where = '1=1', $parameters = array(), $ordering = array(), $limit = -1, $offset = -1)
333 333
 	{
334 334
 		return $this->createFindCommand($where, $parameters, $ordering, $limit, $offset, 'COUNT(*)');
335 335
 	}
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
 	 * @param array delete parameters.
343 343
 	 * @return TDbCommand delete command.
344 344
 	 */
345
-	public function createDeleteCommand($where,$parameters=array())
345
+	public function createDeleteCommand($where, $parameters = array())
346 346
 	{
347 347
 		$table = $this->getTableInfo()->getTableFullName();
348 348
 		if (!empty($where))
349
-			$where = ' WHERE '.$where;
350
-		$command = $this->createCommand("DELETE FROM {$table}".$where);
349
+			$where = ' WHERE ' . $where;
350
+		$command = $this->createCommand("DELETE FROM {$table}" . $where);
351 351
 		$this->bindArrayValues($command, $parameters);
352 352
 		return $command;
353 353
 	}
@@ -377,17 +377,17 @@  discard block
 block discarded – undo
377 377
 	 * @param array update parameters.
378 378
 	 * @return TDbCommand update command.
379 379
 	 */
380
-	public function createUpdateCommand($data, $where, $parameters=array())
380
+	public function createUpdateCommand($data, $where, $parameters = array())
381 381
 	{
382 382
 		$table = $this->getTableInfo()->getTableFullName();
383
-		if($this->hasIntegerKey($parameters))
383
+		if ($this->hasIntegerKey($parameters))
384 384
 			$fields = implode(', ', $this->getColumnBindings($data, true));
385 385
 		else
386 386
 			$fields = implode(', ', $this->getColumnBindings($data));
387 387
 
388 388
 		if (!empty($where))
389
-			$where = ' WHERE '.$where;
390
-		$command = $this->createCommand("UPDATE {$table} SET {$fields}".$where);
389
+			$where = ' WHERE ' . $where;
390
+		$command = $this->createCommand("UPDATE {$table} SET {$fields}" . $where);
391 391
 		$this->bindArrayValues($command, array_merge($data, $parameters));
392 392
 		return $command;
393 393
 	}
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	protected function getInsertFieldBindings($values)
401 401
 	{
402
-		$fields = array(); $bindings=array();
403
-		foreach(array_keys($values) as $name)
402
+		$fields = array(); $bindings = array();
403
+		foreach (array_keys($values) as $name)
404 404
 		{
405 405
 			$fields[] = $this->getTableInfo()->getColumn($name)->getColumnName();
406
-			$bindings[] = ':'.$name;
406
+			$bindings[] = ':' . $name;
407 407
 		}
408
-		return array(implode(', ',$fields), implode(', ', $bindings));
408
+		return array(implode(', ', $fields), implode(', ', $bindings));
409 409
 	}
410 410
 
411 411
 	/**
@@ -414,13 +414,13 @@  discard block
 block discarded – undo
414 414
 	 * @param boolean true to bind as position values.
415 415
 	 * @return string update column names with corresponding binding substrings.
416 416
 	 */
417
-	protected function getColumnBindings($values, $position=false)
417
+	protected function getColumnBindings($values, $position = false)
418 418
 	{
419
-		$bindings=array();
420
-		foreach(array_keys($values) as $name)
419
+		$bindings = array();
420
+		foreach (array_keys($values) as $name)
421 421
 		{
422 422
 			$column = $this->getTableInfo()->getColumn($name)->getColumnName();
423
-			$bindings[] = $position ? $column.' = ?' : $column.' = :'.$name;
423
+			$bindings[] = $position ? $column . ' = ?' : $column . ' = :' . $name;
424 424
 		}
425 425
 		return $bindings;
426 426
 	}
@@ -442,13 +442,13 @@  discard block
 block discarded – undo
442 442
 	 */
443 443
 	public function bindColumnValues($command, $values)
444 444
 	{
445
-		foreach($values as $name=>$value)
445
+		foreach ($values as $name=>$value)
446 446
 		{
447 447
 			$column = $this->getTableInfo()->getColumn($name);
448
-			if($value === null && $column->getAllowNull())
449
-				$command->bindValue(':'.$name, null, PDO::PARAM_NULL);
448
+			if ($value === null && $column->getAllowNull())
449
+				$command->bindValue(':' . $name, null, PDO::PARAM_NULL);
450 450
 			else
451
-				$command->bindValue(':'.$name, $value, $column->getPdoType());
451
+				$command->bindValue(':' . $name, $value, $column->getPdoType());
452 452
 		}
453 453
 	}
454 454
 
@@ -458,17 +458,17 @@  discard block
 block discarded – undo
458 458
 	 */
459 459
 	public function bindArrayValues($command, $values)
460 460
 	{
461
-		if($this->hasIntegerKey($values))
461
+		if ($this->hasIntegerKey($values))
462 462
 		{
463 463
 			$values = array_values($values);
464
-			for($i = 0, $max=count($values); $i<$max; $i++)
465
-				$command->bindValue($i+1, $values[$i], $this->getPdoType($values[$i]));
464
+			for ($i = 0, $max = count($values); $i < $max; $i++)
465
+				$command->bindValue($i + 1, $values[$i], $this->getPdoType($values[$i]));
466 466
 		}
467 467
 		else
468 468
 		{
469
-			foreach($values as $name=>$value)
469
+			foreach ($values as $name=>$value)
470 470
 			{
471
-				$prop = $name[0]===':' ? $name : ':'.$name;
471
+				$prop = $name[0] === ':' ? $name : ':' . $name;
472 472
 				$command->bindValue($prop, $value, $this->getPdoType($value));
473 473
 			}
474 474
 		}
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 	 */
481 481
 	public static function getPdoType($value)
482 482
 	{
483
-		switch(gettype($value))
483
+		switch (gettype($value))
484 484
 		{
485 485
 			case 'boolean': return PDO::PARAM_BOOL;
486 486
 			case 'integer': return PDO::PARAM_INT;
@@ -495,9 +495,9 @@  discard block
 block discarded – undo
495 495
 	 */
496 496
 	protected function hasIntegerKey($array)
497 497
 	{
498
-		foreach($array as $k=>$v)
498
+		foreach ($array as $k=>$v)
499 499
 		{
500
-			if(gettype($k)==='integer')
500
+			if (gettype($k) === 'integer')
501 501
 				return true;
502 502
 		}
503 503
 		return false;
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -149,8 +149,9 @@  discard block
 block discarded – undo
149 149
 	protected function getSearchCondition($column, $words)
150 150
 	{
151 151
 		$conditions=array();
152
-		foreach($words as $word)
153
-			$conditions[] = $column.' LIKE '.$this->getDbConnection()->quoteString('%'.$word.'%');
152
+		foreach($words as $word) {
153
+					$conditions[] = $column.' LIKE '.$this->getDbConnection()->quoteString('%'.$word.'%');
154
+		}
154 155
 		return '('.implode(' AND ', $conditions).')';
155 156
 	}
156 157
 
@@ -197,8 +198,9 @@  discard block
 block discarded – undo
197 198
 		if(is_scalar($data)) {
198 199
 			$tmp = explode(',', $data);
199 200
 			$result = array();
200
-			foreach($tmp as $v)
201
-				$result[] = trim($v);
201
+			foreach($tmp as $v) {
202
+							$result[] = trim($v);
203
+			}
202 204
 			return $result;
203 205
 		}
204 206
 
@@ -461,10 +463,10 @@  discard block
 block discarded – undo
461 463
 		if($this->hasIntegerKey($values))
462 464
 		{
463 465
 			$values = array_values($values);
464
-			for($i = 0, $max=count($values); $i<$max; $i++)
465
-				$command->bindValue($i+1, $values[$i], $this->getPdoType($values[$i]));
466
-		}
467
-		else
466
+			for($i = 0, $max=count($values); $i<$max; $i++) {
467
+							$command->bindValue($i+1, $values[$i], $this->getPdoType($values[$i]));
468
+			}
469
+		} else
468 470
 		{
469 471
 			foreach($values as $name=>$value)
470 472
 			{
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	{
307 307
 		$table = $this->getTableInfo()->getTableFullName();
308 308
 		$fields = implode(', ', $this -> getSelectFieldList($select));
309
-		$sql = "SELECT {$fields} FROM {$table}";
309
+		$sql = "select {$fields} FROM {$table}";
310 310
 		if(!empty($where))
311 311
 			$sql .= " WHERE {$where}";
312 312
 		return $this->applyCriterias($sql, $parameters, $ordering, $limit, $offset);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
 		if (!empty($where))
389 389
 			$where = ' WHERE '.$where;
390
-		$command = $this->createCommand("UPDATE {$table} SET {$fields}".$where);
390
+		$command = $this->createCommand("update {$table} SET {$fields}".$where);
391 391
 		$this->bindArrayValues($command, array_merge($data, $parameters));
392 392
 		return $command;
393 393
 	}
Please login to merge, or discard this patch.
framework/Data/Common/TDbMetaData.php 4 patches
Doc Comments   -6 removed lines patch added patch discarded remove patch
@@ -127,8 +127,6 @@  discard block
 block discarded – undo
127 127
 	/**
128 128
 	 * Quotes a table name for use in a query.
129 129
 	 * @param string $name table name
130
-	 * @param string $lft left delimiter
131
-	 * @param string $rgt right delimiter
132 130
 	 * @return string the properly quoted table name
133 131
 	 */
134 132
 	public function quoteTableName($name)
@@ -150,8 +148,6 @@  discard block
 block discarded – undo
150 148
 	/**
151 149
 	 * Quotes a column name for use in a query.
152 150
 	 * @param string $name column name
153
-	 * @param string $lft left delimiter
154
-	 * @param string $rgt right delimiter
155 151
 	 * @return string the properly quoted column name
156 152
 	 */
157 153
 	public function quoteColumnName($name)
@@ -166,8 +162,6 @@  discard block
 block discarded – undo
166 162
 	/**
167 163
 	 * Quotes a column alias for use in a query.
168 164
 	 * @param string $name column alias
169
-	 * @param string $lft left delimiter
170
-	 * @param string $rgt right delimiter
171 165
 	 * @return string the properly quoted column alias
172 166
 	 */
173 167
 	public function quoteColumnAlias($name)
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -179,14 +179,14 @@
 block discarded – undo
179 179
 		return $lft . str_replace(self::$delimiterIdentifier, '', $name) . $rgt;
180 180
 	}
181 181
 
182
-        /**
183
-	 * Returns all table names in the database.
184
-	 * This method should be overridden by child classes in order to support this feature
185
-	 * because the default implementation simply throws an exception.
186
-	 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
187
-	 * If not empty, the returned table names will be prefixed with the schema name.
188
-	 * @return array all table names in the database.
189
-	 */
182
+		/**
183
+		 * Returns all table names in the database.
184
+		 * This method should be overridden by child classes in order to support this feature
185
+		 * because the default implementation simply throws an exception.
186
+		 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
187
+		 * If not empty, the returned table names will be prefixed with the schema name.
188
+		 * @return array all table names in the database.
189
+		 */
190 190
 	abstract public function findTableNames($schema='');
191 191
 }
192 192
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  */
22 22
 abstract class TDbMetaData extends TComponent
23 23
 {
24
-	private $_tableInfoCache=array();
24
+	private $_tableInfoCache = array();
25 25
 	private $_connection;
26 26
 
27 27
 	/**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function __construct($conn)
36 36
 	{
37
-		$this->_connection=$conn;
37
+		$this->_connection = $conn;
38 38
 	}
39 39
 
40 40
 	/**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		$conn->setActive(true); //must be connected before retrieving driver name
56 56
 		$driver = $conn->getDriverName();
57
-		switch(strtolower($driver))
57
+		switch (strtolower($driver))
58 58
 		{
59 59
 			case 'pgsql':
60 60
 				Prado::using('System.Data.Common.Pgsql.TPgsqlMetaData');
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 //				Prado::using('System.Data.Common.IbmDb2.TIbmDb2MetaData');
80 80
 //				return new TIbmDb2MetaData($conn);
81 81
 			default:
82
-				throw new TDbException('ar_invalid_database_driver',$driver);
82
+				throw new TDbException('ar_invalid_database_driver', $driver);
83 83
 		}
84 84
 	}
85 85
 
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 	 * @param string table or view name
89 89
 	 * @return TDbTableInfo table information.
90 90
 	 */
91
-	public function getTableInfo($tableName=null)
91
+	public function getTableInfo($tableName = null)
92 92
 	{
93
-		$key = $tableName===null?$this->getDbConnection()->getConnectionString():$tableName;
94
-		if(!isset($this->_tableInfoCache[$key]))
93
+		$key = $tableName === null ? $this->getDbConnection()->getConnectionString() : $tableName;
94
+		if (!isset($this->_tableInfoCache[$key]))
95 95
 		{
96 96
 			$class = $this->getTableInfoClass();
97
-			$tableInfo = $tableName===null ? new $class : $this->createTableInfo($tableName);
97
+			$tableInfo = $tableName === null ? new $class : $this->createTableInfo($tableName);
98 98
 			$this->_tableInfoCache[$key] = $tableInfo;
99 99
 		}
100 100
 		return $this->_tableInfoCache[$key];
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param string table name.
106 106
 	 * @return TDbCommandBuilder command builder instance for the given table.
107 107
 	 */
108
-	public function createCommandBuilder($tableName=null)
108
+	public function createCommandBuilder($tableName = null)
109 109
 	{
110 110
 		return $this->getTableInfo($tableName)->createCommandBuilder($this->getDbConnection());
111 111
 	}
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 		$rgt = $lft = isset($args[1]) ? $args[1] : '';
140 140
 		$rgt = isset($args[2]) ? $args[2] : $rgt;
141 141
 
142
-		if(strpos($name, '.')===false)
142
+		if (strpos($name, '.') === false)
143 143
 			return $lft . $name . $rgt;
144
-		$names=explode('.', $name);
145
-		foreach($names as &$n)
144
+		$names = explode('.', $name);
145
+		foreach ($names as &$n)
146 146
 			$n = $lft . $n . $rgt;
147 147
 		return implode('.', $names);
148 148
 	}
@@ -187,6 +187,6 @@  discard block
 block discarded – undo
187 187
 	 * If not empty, the returned table names will be prefixed with the schema name.
188 188
 	 * @return array all table names in the database.
189 189
 	 */
190
-	abstract public function findTableNames($schema='');
190
+	abstract public function findTableNames($schema = '');
191 191
 }
192 192
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -142,8 +142,9 @@
 block discarded – undo
142 142
 		if(strpos($name, '.')===false)
143 143
 			return $lft . $name . $rgt;
144 144
 		$names=explode('.', $name);
145
-		foreach($names as &$n)
146
-			$n = $lft . $n . $rgt;
145
+		foreach($names as &$n) {
146
+					$n = $lft . $n . $rgt;
147
+		}
147 148
 		return implode('.', $names);
148 149
 	}
149 150
 
Please login to merge, or discard this patch.
framework/Data/DataGateway/TDataGatewayCommand.php 3 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,6 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * Updates the table with new data.
90 90
 	 * @param array date for update.
91 91
 	 * @param TSqlCriteria update conditions and parameters.
92
+	 * @param TSqlCriteria $criteria
92 93
 	 * @return integer number of records affected.
93 94
 	 */
94 95
 	public function update($data, $criteria)
@@ -207,6 +208,9 @@  discard block
 block discarded – undo
207 208
 		return $this->onExecuteCommand($command,$command->execute());
208 209
 	}
209 210
 
211
+	/**
212
+	 * @param TDbTableInfo $table
213
+	 */
210 214
 	public function getIndexKeyCondition($table,$fields,$values)
211 215
 	{
212 216
 		if (!count($values))
@@ -351,7 +355,7 @@  discard block
 block discarded – undo
351 355
 	 * Inserts a new record into the table. Each array key must
352 356
 	 * correspond to a column name in the table unless a null value is permitted.
353 357
 	 * @param array new record data.
354
-	 * @return mixed last insert id if one column contains a serial or sequence,
358
+	 * @return string|boolean last insert id if one column contains a serial or sequence,
355 359
 	 * otherwise true if command executes successfully and affected 1 or more rows.
356 360
 	 */
357 361
 	public function insert($data)
@@ -370,7 +374,7 @@  discard block
 block discarded – undo
370 374
 	/**
371 375
 	 * Iterate through all the columns and returns the last insert id of the
372 376
 	 * first column that has a sequence or serial.
373
-	 * @return mixed last insert id, null if none is found.
377
+	 * @return string|null last insert id, null if none is found.
374 378
 	 */
375 379
 	public function getLastInsertID()
376 380
 	{
@@ -381,6 +385,7 @@  discard block
 block discarded – undo
381 385
 	 * @param string __call method name
382 386
 	 * @param string criteria conditions
383 387
 	 * @param array method arguments
388
+	 * @param string $condition
384 389
 	 * @return TActiveRecordCriteria criteria created from the method name and its arguments.
385 390
 	 */
386 391
 	public function createCriteriaFromString($method, $condition, $args)
@@ -434,6 +439,7 @@  discard block
 block discarded – undo
434 439
 	 * inspected to obtain the sql query to be executed.
435 440
 	 * @param TDataGatewayCommand originator $sender
436 441
 	 * @param TDataGatewayEventParameter
442
+	 * @param TDbCommand $command
437 443
 	 */
438 444
 	public function onCreateCommand($command, $criteria)
439 445
 	{
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		$where = $criteria->getCondition();
81 81
 		$parameters = $criteria->getParameters()->toArray();
82 82
 		$command = $this->getBuilder()->createDeleteCommand($where, $parameters);
83
-		$this->onCreateCommand($command,$criteria);
83
+		$this->onCreateCommand($command, $criteria);
84 84
 		$command->prepare();
85 85
 		return $command->execute();
86 86
 	}
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 	{
96 96
 		$where = $criteria->getCondition();
97 97
 		$parameters = $criteria->getParameters()->toArray();
98
-		$command = $this->getBuilder()->createUpdateCommand($data,$where, $parameters);
99
-		$this->onCreateCommand($command,$criteria);
98
+		$command = $this->getBuilder()->createUpdateCommand($data, $where, $parameters);
99
+		$this->onCreateCommand($command, $criteria);
100 100
 		$command->prepare();
101 101
 		return $this->onExecuteCommand($command, $command->execute());
102 102
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function updateByPk($data, $keys)
110 110
 	{
111
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
111
+		list($where, $parameters) = $this->getPrimaryKeyCondition((array) $keys);
112 112
 		return $this->update($data, new TSqlCriteria($where, $parameters));
113 113
 	}
114 114
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	protected function getFindCommand($criteria)
143 143
 	{
144
-		if($criteria===null)
144
+		if ($criteria === null)
145 145
 			return $this->getBuilder()->createFindCommand();
146 146
 		$where = $criteria->getCondition();
147 147
 		$parameters = $criteria->getParameters()->toArray();
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		$limit = $criteria->getLimit();
150 150
 		$offset = $criteria->getOffset();
151 151
 		$select = $criteria->getSelect();
152
-		$command = $this->getBuilder()->createFindCommand($where,$parameters,$ordering,$limit,$offset,$select);
152
+		$command = $this->getBuilder()->createFindCommand($where, $parameters, $ordering, $limit, $offset, $select);
153 153
 		$this->onCreateCommand($command, $criteria);
154 154
 		return $command;
155 155
 	}
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function findByPk($keys)
162 162
 	{
163
-		if($keys===null)
163
+		if ($keys === null)
164 164
 			return null;
165
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
165
+		list($where, $parameters) = $this->getPrimaryKeyCondition((array) $keys);
166 166
 		$command = $this->getBuilder()->createFindCommand($where, $parameters);
167
-		$this->onCreateCommand($command, new TSqlCriteria($where,$parameters));
167
+		$this->onCreateCommand($command, new TSqlCriteria($where, $parameters));
168 168
 		return $this->onExecuteCommand($command, $command->queryRow());
169 169
 	}
170 170
 
@@ -174,22 +174,22 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function findAllByPk($keys)
176 176
 	{
177
-		$where = $this->getCompositeKeyCondition((array)$keys);
177
+		$where = $this->getCompositeKeyCondition((array) $keys);
178 178
 		$command = $this->getBuilder()->createFindCommand($where);
179
-		$this->onCreateCommand($command, new TSqlCriteria($where,$keys));
180
-		return $this->onExecuteCommand($command,$command->query());
179
+		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
180
+		return $this->onExecuteCommand($command, $command->query());
181 181
 	}
182 182
 
183
-	public function findAllByIndex($criteria,$fields,$values)
183
+	public function findAllByIndex($criteria, $fields, $values)
184 184
 	{
185
-		$index = $this->getIndexKeyCondition($this->getTableInfo(),$fields,$values);
186
-		if(strlen($where = $criteria->getCondition())>0)
185
+		$index = $this->getIndexKeyCondition($this->getTableInfo(), $fields, $values);
186
+		if (strlen($where = $criteria->getCondition()) > 0)
187 187
 			$criteria->setCondition("({$index}) AND ({$where})");
188 188
 		else
189 189
 			$criteria->setCondition($index);
190 190
 		$command = $this->getFindCommand($criteria);
191 191
 		$this->onCreateCommand($command, $criteria);
192
-		return $this->onExecuteCommand($command,$command->query());
192
+		return $this->onExecuteCommand($command, $command->query());
193 193
 	}
194 194
 
195 195
 	/**
@@ -198,24 +198,24 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function deleteByPk($keys)
200 200
 	{
201
-		if(count($keys)==0)
201
+		if (count($keys) == 0)
202 202
 			return 0;
203
-		$where = $this->getCompositeKeyCondition((array)$keys);
203
+		$where = $this->getCompositeKeyCondition((array) $keys);
204 204
 		$command = $this->getBuilder()->createDeleteCommand($where);
205
-		$this->onCreateCommand($command, new TSqlCriteria($where,$keys));
205
+		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
206 206
 		$command->prepare();
207
-		return $this->onExecuteCommand($command,$command->execute());
207
+		return $this->onExecuteCommand($command, $command->execute());
208 208
 	}
209 209
 
210
-	public function getIndexKeyCondition($table,$fields,$values)
210
+	public function getIndexKeyCondition($table, $fields, $values)
211 211
 	{
212 212
 		if (!count($values))
213 213
 			return 'FALSE';
214 214
 		$columns = array();
215 215
 		$tableName = $table->getTableFullName();
216
-		foreach($fields as $field)
217
-			$columns[] = $tableName.'.'.$table->getColumn($field)->getColumnName();
218
-		return '('.implode(', ',$columns).') IN '.$this->quoteTuple($values);
216
+		foreach ($fields as $field)
217
+			$columns[] = $tableName . '.' . $table->getColumn($field)->getColumnName();
218
+		return '(' . implode(', ', $columns) . ') IN ' . $this->quoteTuple($values);
219 219
 	}
220 220
 
221 221
 	/**
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	{
228 228
 		$primary = $this->getTableInfo()->getPrimaryKeys();
229 229
 		$count = count($primary);
230
-		if($count===0)
230
+		if ($count === 0)
231 231
 		{
232 232
 			throw new TDbException('dbtablegateway_no_primary_key_found',
233 233
 				$this->getTableInfo()->getTableFullName());
234 234
 		}
235
-		if(!is_array($values) || count($values) === 0)
235
+		if (!is_array($values) || count($values) === 0)
236 236
 		{
237 237
 			throw new TDbException('dbtablegateway_missing_pk_values',
238 238
 				$this->getTableInfo()->getTableFullName());
239 239
 		}
240
-		if($count>1 && (!isset($values[0]) || !is_array($values[0])))
240
+		if ($count > 1 && (!isset($values[0]) || !is_array($values[0])))
241 241
 			$values = array($values);
242
-		if($count > 1 && count($values[0]) !== $count)
242
+		if ($count > 1 && count($values[0]) !== $count)
243 243
 		{
244 244
 			throw new TDbException('dbtablegateway_pk_value_count_mismatch',
245 245
 				$this->getTableInfo()->getTableFullName());
246 246
 		}
247
-		return $this->getIndexKeyCondition($this->getTableInfo(),$primary, $values);
247
+		return $this->getIndexKeyCondition($this->getTableInfo(), $primary, $values);
248 248
 	}
249 249
 
250 250
 	/**
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	{
257 257
 		$conn = $this->getDbConnection();
258 258
 		$data = array();
259
-		foreach($array as $k=>$v)
259
+		foreach ($array as $k=>$v)
260 260
 			$data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
261
-		return '('.implode(', ', $data).')';
261
+		return '(' . implode(', ', $data) . ')';
262 262
 	}
263 263
 
264 264
 	/**
@@ -269,19 +269,19 @@  discard block
 block discarded – undo
269 269
 	protected function getPrimaryKeyCondition($values)
270 270
 	{
271 271
 		$primary = $this->getTableInfo()->getPrimaryKeys();
272
-		if(count($primary)===0)
272
+		if (count($primary) === 0)
273 273
 		{
274 274
 			throw new TDbException('dbtablegateway_no_primary_key_found',
275 275
 				$this->getTableInfo()->getTableFullName());
276 276
 		}
277
-		$criteria=array();
278
-		$bindings=array();
277
+		$criteria = array();
278
+		$bindings = array();
279 279
 		$i = 0;
280
-		foreach($primary as $key)
280
+		foreach ($primary as $key)
281 281
 		{
282 282
 			$column = $this->getTableInfo()->getColumn($key)->getColumnName();
283
-			$criteria[] = $column.' = :'.$key;
284
-			$bindings[$key] = isset($values[$key])?$values[$key]:$values[$i++];
283
+			$criteria[] = $column . ' = :' . $key;
284
+			$bindings[$key] = isset($values[$key]) ? $values[$key] : $values[$i++];
285 285
 		}
286 286
 		return array(implode(' AND ', $criteria), $bindings);
287 287
 	}
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 		$ordering = $criteria->getOrdersBy();
320 320
 		$limit = $criteria->getLimit();
321 321
 		$offset = $criteria->getOffset();
322
-		if(count($ordering) > 0)
322
+		if (count($ordering) > 0)
323 323
 			$sql = $this->getBuilder()->applyOrdering($sql, $ordering);
324
-		if($limit>=0 || $offset>=0)
324
+		if ($limit >= 0 || $offset >= 0)
325 325
 			$sql = $this->getBuilder()->applyLimitOffset($sql, $limit, $offset);
326 326
 		$command = $this->getBuilder()->createCommand($sql);
327 327
 		$this->getBuilder()->bindArrayValues($command, $criteria->getParameters()->toArray());
@@ -335,16 +335,16 @@  discard block
 block discarded – undo
335 335
 	 */
336 336
 	public function count($criteria)
337 337
 	{
338
-		if($criteria===null)
339
-			return (int)$this->getBuilder()->createCountCommand()->queryScalar();
338
+		if ($criteria === null)
339
+			return (int) $this->getBuilder()->createCountCommand()->queryScalar();
340 340
 		$where = $criteria->getCondition();
341 341
 		$parameters = $criteria->getParameters()->toArray();
342 342
 		$ordering = $criteria->getOrdersBy();
343 343
 		$limit = $criteria->getLimit();
344 344
 		$offset = $criteria->getOffset();
345
-		$command = $this->getBuilder()->createCountCommand($where,$parameters,$ordering,$limit,$offset);
345
+		$command = $this->getBuilder()->createCountCommand($where, $parameters, $ordering, $limit, $offset);
346 346
 		$this->onCreateCommand($command, $criteria);
347
-		return $this->onExecuteCommand($command, (int)$command->queryScalar());
347
+		return $this->onExecuteCommand($command, (int) $command->queryScalar());
348 348
 	}
349 349
 
350 350
 	/**
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 	 */
357 357
 	public function insert($data)
358 358
 	{
359
-		$command=$this->getBuilder()->createInsertCommand($data);
360
-		$this->onCreateCommand($command, new TSqlCriteria(null,$data));
359
+		$command = $this->getBuilder()->createInsertCommand($data);
360
+		$this->onCreateCommand($command, new TSqlCriteria(null, $data));
361 361
 		$command->prepare();
362
-		if($this->onExecuteCommand($command, $command->execute()) > 0)
362
+		if ($this->onExecuteCommand($command, $command->execute()) > 0)
363 363
 		{
364 364
 			$value = $this->getLastInsertId();
365 365
 			return $value !== null ? $value : true;
@@ -386,13 +386,13 @@  discard block
 block discarded – undo
386 386
 	public function createCriteriaFromString($method, $condition, $args)
387 387
 	{
388 388
 		$fields = $this->extractMatchingConditions($method, $condition);
389
-		$args=count($args) === 1 && is_array($args[0]) ? $args[0] : $args;
390
-		if(count($fields)>count($args))
389
+		$args = count($args) === 1 && is_array($args[0]) ? $args[0] : $args;
390
+		if (count($fields) > count($args))
391 391
 		{
392 392
 			throw new TDbException('dbtablegateway_mismatch_args_exception',
393
-				$method,count($fields),count($args));
393
+				$method, count($fields), count($args));
394 394
 		}
395
-		return new TSqlCriteria(implode(' ',$fields), $args);
395
+		return new TSqlCriteria(implode(' ', $fields), $args);
396 396
 	}
397 397
 
398 398
 	/**
@@ -406,21 +406,21 @@  discard block
 block discarded – undo
406 406
 	{
407 407
 		$table = $this->getTableInfo();
408 408
 		$columns = $table->getLowerCaseColumnNames();
409
-		$regexp = '/('.implode('|', array_keys($columns)).')(and|_and_|or|_or_)?/i';
409
+		$regexp = '/(' . implode('|', array_keys($columns)) . ')(and|_and_|or|_or_)?/i';
410 410
 		$matches = array();
411
-		if(!preg_match_all($regexp, strtolower($condition), $matches,PREG_SET_ORDER))
411
+		if (!preg_match_all($regexp, strtolower($condition), $matches, PREG_SET_ORDER))
412 412
 		{
413 413
 			throw new TDbException('dbtablegateway_mismatch_column_name',
414 414
 				$method, implode(', ', $columns), $table->getTableFullName());
415 415
 		}
416 416
 
417 417
 		$fields = array();
418
-		foreach($matches as $match)
418
+		foreach ($matches as $match)
419 419
 		{
420 420
 			$key = $columns[$match[1]];
421 421
 			$column = $table->getColumn($key)->getColumnName();
422 422
 			$sql = $column . ' = ? ';
423
-			if(count($match) > 2)
423
+			if (count($match) > 2)
424 424
 				$sql .= strtoupper(str_replace('_', '', $match[2]));
425 425
 			$fields[] = $sql;
426 426
 		}
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	public function onCreateCommand($command, $criteria)
439 439
 	{
440
-		$this->raiseEvent('OnCreateCommand', $this, new TDataGatewayEventParameter($command,$criteria));
440
+		$this->raiseEvent('OnCreateCommand', $this, new TDataGatewayEventParameter($command, $criteria));
441 441
 	}
442 442
 
443 443
 	/**
@@ -471,10 +471,10 @@  discard block
 block discarded – undo
471 471
 	private $_command;
472 472
 	private $_criteria;
473 473
 
474
-	public function __construct($command,$criteria)
474
+	public function __construct($command, $criteria)
475 475
 	{
476
-		$this->_command=$command;
477
-		$this->_criteria=$criteria;
476
+		$this->_command = $command;
477
+		$this->_criteria = $criteria;
478 478
 	}
479 479
 
480 480
 	/**
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
 	private $_command;
512 512
 	private $_result;
513 513
 
514
-	public function __construct($command,$result)
514
+	public function __construct($command, $result)
515 515
 	{
516
-		$this->_command=$command;
517
-		$this->_result=$result;
516
+		$this->_command = $command;
517
+		$this->_result = $result;
518 518
 	}
519 519
 
520 520
 	/**
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	public function setResult($value)
540 540
 	{
541
-		$this->_result=$value;
541
+		$this->_result = $value;
542 542
 	}
543 543
 }
544 544
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -213,8 +213,9 @@  discard block
 block discarded – undo
213 213
 			return 'FALSE';
214 214
 		$columns = array();
215 215
 		$tableName = $table->getTableFullName();
216
-		foreach($fields as $field)
217
-			$columns[] = $tableName.'.'.$table->getColumn($field)->getColumnName();
216
+		foreach($fields as $field) {
217
+					$columns[] = $tableName.'.'.$table->getColumn($field)->getColumnName();
218
+		}
218 219
 		return '('.implode(', ',$columns).') IN '.$this->quoteTuple($values);
219 220
 	}
220 221
 
@@ -256,8 +257,9 @@  discard block
 block discarded – undo
256 257
 	{
257 258
 		$conn = $this->getDbConnection();
258 259
 		$data = array();
259
-		foreach($array as $k=>$v)
260
-			$data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
260
+		foreach($array as $k=>$v) {
261
+					$data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
262
+		}
261 263
 		return '('.implode(', ', $data).')';
262 264
 	}
263 265
 
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TResultProperty.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -103,6 +103,7 @@  discard block
 block discarded – undo
103 103
 	/**
104 104
 	 * @param string name of the column in the result set from which the value
105 105
 	 * will be used to populate the property.
106
+	 * @param string $value
106 107
 	 */
107 108
 	public function setColumn($value)
108 109
 	{
@@ -121,6 +122,7 @@  discard block
 block discarded – undo
121 122
 	/**
122 123
 	 * @param int index of the column in the ResultSet from which the value will
123 124
 	 * be used to populate the object property
125
+	 * @param integer $value
124 126
 	 */
125 127
 	public function setColumnIndex($value)
126 128
 	{
@@ -185,6 +187,7 @@  discard block
 block discarded – undo
185 187
 
186 188
 	/**
187 189
 	 * @param string custom type handler class name (may use namespace).
190
+	 * @param string $value
188 191
 	 */
189 192
 	public function setTypeHandler($value)
190 193
 	{
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 	private $_nullValue;
37 37
 	private $_propertyName;
38 38
 	private $_columnName;
39
-	private $_columnIndex=-1;
39
+	private $_columnIndex = -1;
40 40
 	private $_nestedResultMapName;
41 41
 	private $_nestedResultMap;
42 42
 	private $_valueType;
43 43
 	private $_typeHandler;
44
-	private $_isLazyLoad=false;
44
+	private $_isLazyLoad = false;
45 45
 	private $_select;
46 46
 
47
-	private $_hostResultMapID='inplicit internal mapping';
47
+	private $_hostResultMapID = 'inplicit internal mapping';
48 48
 
49 49
 	const LIST_TYPE = 0;
50 50
 	const ARRAY_TYPE = 1;
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * Gets the containing result map ID.
54 54
 	 * @param TResultMap containing result map.
55 55
 	 */
56
-	public function __construct($resultMap=null)
56
+	public function __construct($resultMap = null)
57 57
 	{
58
-		if($resultMap instanceof TResultMap)
58
+		if ($resultMap instanceof TResultMap)
59 59
 			$this->_hostResultMapID = $resultMap->getID();
60 60
 	}
61 61
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public function setLazyLoad($value)
224 224
 	{
225
-		$this->_isLazyLoad = TPropertyValue::ensureBoolean($value,false);
225
+		$this->_isLazyLoad = TPropertyValue::ensureBoolean($value, false);
226 226
 	}
227 227
 
228 228
 	/**
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
 	 * @param array result row
232 232
 	 * @return mixed property value.
233 233
 	 */
234
-	public function getPropertyValue($registry,$row)
234
+	public function getPropertyValue($registry, $row)
235 235
 	{
236 236
 		$value = null;
237 237
 		$index = $this->getColumnIndex();
238 238
 		$name = $this->getColumn();
239
-		if($index > 0 && isset($row[$index]))
240
-			$value = $this->getTypedValue($registry,$row[$index]);
241
-		else if(isset($row[$name]))
242
-			$value = $this->getTypedValue($registry,$row[$name]);
243
-		if(($value===null) && ($this->getNullValue()!==null))
244
-			$value = $this->getTypedValue($registry,$this->getNullValue());
239
+		if ($index > 0 && isset($row[$index]))
240
+			$value = $this->getTypedValue($registry, $row[$index]);
241
+		else if (isset($row[$name]))
242
+			$value = $this->getTypedValue($registry, $row[$name]);
243
+		if (($value === null) && ($this->getNullValue() !== null))
244
+			$value = $this->getTypedValue($registry, $this->getNullValue());
245 245
 		return $value;
246 246
 	}
247 247
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	 * @param mixed raw property value
251 251
 	 * @return mixed property value casted to specific type.
252 252
 	 */
253
-	protected function getTypedValue($registry,$value)
253
+	protected function getTypedValue($registry, $value)
254 254
 	{
255
-		if(($handler = $this->createTypeHandler($registry))!==null)
255
+		if (($handler = $this->createTypeHandler($registry)) !== null)
256 256
 			return $handler->getResult($value);
257 257
 		else
258 258
 			return $registry->convertToType($this->getType(), $value);
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	protected function createTypeHandler($registry)
267 267
 	{
268
-		$type=$this->getTypeHandler() ? $this->getTypeHandler() : $this->getType();
269
-		$handler=$registry->getTypeHandler($type);
270
-		if($handler===null && $this->getTypeHandler())
268
+		$type = $this->getTypeHandler() ? $this->getTypeHandler() : $this->getType();
269
+		$handler = $registry->getTypeHandler($type);
270
+		if ($handler === null && $this->getTypeHandler())
271 271
 			$handler = Prado::createComponent($type);
272 272
 		return $handler;
273 273
 	}
@@ -278,17 +278,17 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	protected function getPropertyValueType()
280 280
 	{
281
-		if(class_exists($type = $this->getType(), false)) //NO force autoloading
281
+		if (class_exists($type = $this->getType(), false)) //NO force autoloading
282 282
 		{
283
-			if($type==='TList')
283
+			if ($type === 'TList')
284 284
 				return self::LIST_TYPE;
285 285
 			$class = new ReflectionClass($type);
286
-			if($class->isSubclassOf('TList'))
286
+			if ($class->isSubclassOf('TList'))
287 287
 				return self::LIST_TYPE;
288
-			if($class->implementsInterface('ArrayAccess'))
288
+			if ($class->implementsInterface('ArrayAccess'))
289 289
 				return self::ARRAY_TYPE;
290 290
 		}
291
-		if(strtolower($type) == 'array')
291
+		if (strtolower($type) == 'array')
292 292
 			return self::ARRAY_TYPE;
293 293
 	}
294 294
 
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	public function instanceOfListType($target)
302 302
 	{
303
-		if($this->getType()===null)
304
-			return  TPropertyAccess::get($target,$this->getProperty()) instanceof TList;
303
+		if ($this->getType() === null)
304
+			return  TPropertyAccess::get($target, $this->getProperty()) instanceof TList;
305 305
 		return $this->getPropertyValueType() == self::LIST_TYPE;
306 306
 	}
307 307
 
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	public function instanceOfArrayType($target)
315 315
 	{
316
-		if($this->getType()===null)
316
+		if ($this->getType() === null)
317 317
 		{
318
-			$prop = TPropertyAccess::get($target,$this->getProperty());
319
-			if(is_object($prop))
318
+			$prop = TPropertyAccess::get($target, $this->getProperty());
319
+			if (is_object($prop))
320 320
 				return $prop instanceof ArrayAccess;
321 321
 			return is_array($prop);
322 322
 		}
@@ -326,17 +326,17 @@  discard block
 block discarded – undo
326 326
 	public function __sleep()
327 327
 	{
328 328
 		$exprops = array(); $cn = 'TResultProperty';
329
-		if ($this->_nullValue===null) $exprops[] = "\0$cn\0_nullValue";
330
-		if ($this->_propertyName===null) $exprops[] = "\0$cn\0_propertyNama";
331
-		if ($this->_columnName===null) $exprops[] = "\0$cn\0_columnName";
332
-		if ($this->_columnIndex==-1) $exprops[] = "\0$cn\0_columnIndex";
333
-		if ($this->_nestedResultMapName===null) $exprops[] = "\0$cn\0_nestedResultMapName";
334
-		if ($this->_nestedResultMap===null) $exprops[] = "\0$cn\0_nestedResultMap";
335
-		if ($this->_valueType===null) $exprops[] = "\0$cn\0_valueType";
336
-		if ($this->_typeHandler===null) $exprops[] = "\0$cn\0_typeHandler";
337
-		if ($this->_isLazyLoad===false) $exprops[] = "\0$cn\0_isLazyLoad";
338
-		if ($this->_select===null) $exprops[] = "\0$cn\0_select";
339
-		return array_diff(parent::__sleep(),$exprops);
329
+		if ($this->_nullValue === null) $exprops[] = "\0$cn\0_nullValue";
330
+		if ($this->_propertyName === null) $exprops[] = "\0$cn\0_propertyNama";
331
+		if ($this->_columnName === null) $exprops[] = "\0$cn\0_columnName";
332
+		if ($this->_columnIndex == -1) $exprops[] = "\0$cn\0_columnIndex";
333
+		if ($this->_nestedResultMapName === null) $exprops[] = "\0$cn\0_nestedResultMapName";
334
+		if ($this->_nestedResultMap === null) $exprops[] = "\0$cn\0_nestedResultMap";
335
+		if ($this->_valueType === null) $exprops[] = "\0$cn\0_valueType";
336
+		if ($this->_typeHandler === null) $exprops[] = "\0$cn\0_typeHandler";
337
+		if ($this->_isLazyLoad === false) $exprops[] = "\0$cn\0_isLazyLoad";
338
+		if ($this->_select === null) $exprops[] = "\0$cn\0_select";
339
+		return array_diff(parent::__sleep(), $exprops);
340 340
 	}
341 341
 }
342 342
 
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapStatement.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -268,6 +268,7 @@
 block discarded – undo
268 268
 	 * @param TSqlMapTypeHandlerRegistry type handler registry
269 269
 	 * @param string result class name.
270 270
 	 * @param array result data.
271
+	 * @param string $type
271 272
 	 * @return mixed result object.
272 273
 	 */
273 274
 	protected function createInstanceOf($registry,$type,$row=null)
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function setID($value)
57 57
 	{
58
-		$this->_ID=$value;
58
+		$this->_ID = $value;
59 59
 	}
60 60
 
61 61
 	/**
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public function initialize($manager)
248 248
 	{
249
-		if(strlen($this->_resultMapName) > 0)
249
+		if (strlen($this->_resultMapName) > 0)
250 250
 			$this->_resultMap = $manager->getResultMap($this->_resultMapName);
251
-		if(strlen($this->_parameterMapName) > 0)
251
+		if (strlen($this->_parameterMapName) > 0)
252 252
 			$this->_parameterMap = $manager->getParameterMap($this->_parameterMapName);
253 253
 	}
254 254
 
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function createInstanceOfListClass($registry)
260 260
 	{
261
-		if(strlen($type = $this->getListClass()) > 0)
262
-			return $this->createInstanceOf($registry,$type);
261
+		if (strlen($type = $this->getListClass()) > 0)
262
+			return $this->createInstanceOf($registry, $type);
263 263
 		return array();
264 264
 	}
265 265
 
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 	 * @param array result data.
271 271
 	 * @return mixed result object.
272 272
 	 */
273
-	protected function createInstanceOf($registry,$type,$row=null)
273
+	protected function createInstanceOf($registry, $type, $row = null)
274 274
 	{
275 275
 		$handler = $registry->getTypeHandler($type);
276
-		if($handler!==null)
276
+		if ($handler !== null)
277 277
 			return $handler->createNewInstance($row);
278 278
 		else
279 279
 			return $registry->createInstanceOf($type);
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 	 * @param array result data.
286 286
 	 * @return mixed result object.
287 287
 	 */
288
-	public function createInstanceOfResultClass($registry,$row)
288
+	public function createInstanceOfResultClass($registry, $row)
289 289
 	{
290
-		if(strlen($type= $this->getResultClass()) > 0)
291
-			return $this->createInstanceOf($registry,$type,$row);
290
+		if (strlen($type = $this->getResultClass()) > 0)
291
+			return $this->createInstanceOf($registry, $type, $row);
292 292
 	}
293 293
 
294 294
 	public function __sleep()
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		if (!$this->_extendStatement) $exprops[] = "\0$cn\0_extendStatement";
309 309
 		if (!$this->_cache) $exprops[] = "\0$cn\0_cache";
310 310
 
311
-		return array_diff(parent::__sleep(),$exprops);
311
+		return array_diff(parent::__sleep(), $exprops);
312 312
 	}
313 313
 
314 314
 }
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 {
325 325
 	private $_generate;
326 326
 
327
-	public function getGenerate(){ return $this->_generate; }
328
-	public function setGenerate($value){ $this->_generate = $value; }
327
+	public function getGenerate() { return $this->_generate; }
328
+	public function setGenerate($value) { $this->_generate = $value; }
329 329
 }
330 330
 
331 331
 /**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
  */
341 341
 class TSqlMapInsert extends TSqlMapStatement
342 342
 {
343
-	private $_selectKey=null;
343
+	private $_selectKey = null;
344 344
 
345 345
 	/**
346 346
 	 * @return TSqlMapSelectKey select key element.
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php 3 patches
Doc Comments   +12 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * Create an instance of an object give by the attribute named 'class' in the
24 24
 	 * node and set the properties on the object given by attribute names and values.
25 25
 	 * @param SimpleXmlNode property node
26
-	 * @return Object new instance of class with class name given by 'class' attribute value.
26
+	 * @return TComponent new instance of class with class name given by 'class' attribute value.
27 27
 	 */
28 28
 	protected function createObjectFromNode($node)
29 29
 	{
@@ -44,6 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param Object object instance
45 45
 	 * @param SimpleXmlNode property node
46 46
 	 * @param array exception property name
47
+	 * @param TComponent $obj
47 48
 	 */
48 49
 	protected function setObjectPropFromNode($obj,$node,$except=array())
49 50
 	{
@@ -65,6 +66,8 @@  discard block
 block discarded – undo
65 66
 	 * Gets the filename relative to the basefile.
66 67
 	 * @param string base filename
67 68
 	 * @param string relative filename
69
+	 * @param string $basefile
70
+	 * @param string $resource
68 71
 	 * @return string absolute filename.
69 72
 	 */
70 73
 	protected function getAbsoluteFilePath($basefile,$resource)
@@ -98,9 +101,10 @@  discard block
 block discarded – undo
98 101
 
99 102
 	/**
100 103
 	 * Get element node by ID value (try for attribute name ID as case insensitive).
101
-	 * @param SimpleXmlDocument $document
104
+	 * @param SimpleXMLElement $document
102 105
 	 * @param string tag name.
103 106
 	 * @param string id value.
107
+	 * @param string $tag
104 108
 	 * @return SimpleXmlElement node if found, null otherwise.
105 109
 	 */
106 110
 	protected function getElementByIdValue($document, $tag, $value)
@@ -146,6 +150,7 @@  discard block
 block discarded – undo
146 150
 
147 151
 	/**
148 152
 	 * @param TSqlMapManager manager instance.
153
+	 * @param TSqlMapManager $manager
149 154
 	 */
150 155
 	public function __construct($manager)
151 156
 	{
@@ -524,6 +529,7 @@  discard block
 block discarded – undo
524 529
 	 * in the sql text. Extracts inline parameter maps.
525 530
 	 * @param TSqlMapStatement mapped statement.
526 531
 	 * @param SimpleXmlElement statement node.
532
+	 * @param TSqlMapStatement $statement
527 533
 	 */
528 534
 	protected function processSqlStatement($statement, $node)
529 535
 	{
@@ -547,6 +553,7 @@  discard block
 block discarded – undo
547 553
 	 * @param TSqlMapStatement statement object.
548 554
 	 * @param string sql text
549 555
 	 * @param SimpleXmlElement statement node.
556
+	 * @param string $sqlStatement
550 557
 	 */
551 558
 	protected function applyInlineParameterMap($statement, $sqlStatement, $node)
552 559
 	{
@@ -644,6 +651,7 @@  discard block
 block discarded – undo
644 651
 	/**
645 652
 	 * Load the selectKey statement from xml mapping.
646 653
 	 * @param SimpleXmlElement selectkey node
654
+	 * @param TSqlMapInsert $insert
647 655
 	 */
648 656
 	protected function loadSelectKeyTag($insert, $node)
649 657
 	{
@@ -734,6 +742,7 @@  discard block
 block discarded – undo
734 742
 	 * Load the flush interval
735 743
 	 * @param TSqlMapCacheModel cache model
736 744
 	 * @param SimpleXmlElement cache node
745
+	 * @param TSqlMapCacheModel $cacheModel
737 746
 	 */
738 747
 	protected function loadFlushInterval($cacheModel, $node)
739 748
 	{
@@ -769,6 +778,7 @@  discard block
 block discarded – undo
769 778
 	 * @param TSqlMapCacheModel cache model
770 779
 	 * @param SimpleXmlElement parent node.
771 780
 	 * @param SimpleXmlElement flush node.
781
+	 * @param TSqlMapCacheModel $cacheModel
772 782
 	 */
773 783
 	protected function loadFlushOnCache($cacheModel,$parent,$node)
774 784
 	{
Please login to merge, or discard this patch.
Braces   +55 added lines, -38 removed lines patch added patch discarded remove patch
@@ -109,8 +109,9 @@  discard block
 block discarded – undo
109 109
 		foreach(array('id','ID','Id', 'iD') as $id)
110 110
 		{
111 111
 			$xpath = "//{$tag}[@{$id}='{$value}']";
112
-			foreach($document->xpath($xpath) as $node)
113
-				return $node;
112
+			foreach($document->xpath($xpath) as $node) {
113
+							return $node;
114
+			}
114 115
 		}
115 116
 	}
116 117
 
@@ -171,21 +172,25 @@  discard block
 block discarded – undo
171 172
 		$this->_configFile=$filename;
172 173
 		$document = $this->loadXmlDocument($filename,$this);
173 174
 
174
-		foreach($document->xpath('//property') as $property)
175
-			$this->loadGlobalProperty($property);
175
+		foreach($document->xpath('//property') as $property) {
176
+					$this->loadGlobalProperty($property);
177
+		}
176 178
 
177
-		foreach($document->xpath('//typeHandler') as $handler)
178
-			$this->loadTypeHandler($handler);
179
+		foreach($document->xpath('//typeHandler') as $handler) {
180
+					$this->loadTypeHandler($handler);
181
+		}
179 182
 
180
-		foreach($document->xpath('//connection[last()]') as $conn)
181
-			$this->loadDatabaseConnection($conn);
183
+		foreach($document->xpath('//connection[last()]') as $conn) {
184
+					$this->loadDatabaseConnection($conn);
185
+		}
182 186
 
183 187
 		//try to load configuration in the current config file.
184 188
 		$mapping = new TSqlMapXmlMappingConfiguration($this);
185 189
 		$mapping->configure($filename);
186 190
 
187
-		foreach($document->xpath('//sqlMap') as $sqlmap)
188
-			$this->loadSqlMappingFiles($sqlmap);
191
+		foreach($document->xpath('//sqlMap') as $sqlmap) {
192
+					$this->loadSqlMappingFiles($sqlmap);
193
+		}
189 194
 
190 195
 		$this->resolveResultMapping();
191 196
 		$this->attachCacheModels();
@@ -286,8 +291,9 @@  discard block
 block discarded – undo
286 291
 	 */
287 292
 	public function replaceProperties($string)
288 293
 	{
289
-		foreach($this->_properties as $find => $replace)
290
-			$string = str_replace('${'.$find.'}', $replace, $string);
294
+		foreach($this->_properties as $find => $replace) {
295
+					$string = str_replace('${'.$find.'}', $replace, $string);
296
+		}
291 297
 		return $string;
292 298
 	}
293 299
 }
@@ -354,32 +360,41 @@  discard block
 block discarded – undo
354 360
 					->getDependencies()
355 361
 					->add(new TFileCacheDependency($filename));
356 362
 
357
-		foreach($document->xpath('//resultMap') as $node)
358
-			$this->loadResultMap($node);
363
+		foreach($document->xpath('//resultMap') as $node) {
364
+					$this->loadResultMap($node);
365
+		}
359 366
 
360
-		foreach($document->xpath('//parameterMap') as $node)
361
-			$this->loadParameterMap($node);
367
+		foreach($document->xpath('//parameterMap') as $node) {
368
+					$this->loadParameterMap($node);
369
+		}
362 370
 
363
-		foreach($document->xpath('//statement') as $node)
364
-			$this->loadStatementTag($node);
371
+		foreach($document->xpath('//statement') as $node) {
372
+					$this->loadStatementTag($node);
373
+		}
365 374
 
366
-		foreach($document->xpath('//select') as $node)
367
-			$this->loadSelectTag($node);
375
+		foreach($document->xpath('//select') as $node) {
376
+					$this->loadSelectTag($node);
377
+		}
368 378
 
369
-		foreach($document->xpath('//insert') as $node)
370
-			$this->loadInsertTag($node);
379
+		foreach($document->xpath('//insert') as $node) {
380
+					$this->loadInsertTag($node);
381
+		}
371 382
 
372
-		foreach($document->xpath('//update') as $node)
373
-			$this->loadUpdateTag($node);
383
+		foreach($document->xpath('//update') as $node) {
384
+					$this->loadUpdateTag($node);
385
+		}
374 386
 
375
-		foreach($document->xpath('//delete') as $node)
376
-			$this->loadDeleteTag($node);
387
+		foreach($document->xpath('//delete') as $node) {
388
+					$this->loadDeleteTag($node);
389
+		}
377 390
 
378
-		foreach($document->xpath('//procedure') as $node)
379
-			$this->loadProcedureTag($node);
391
+		foreach($document->xpath('//procedure') as $node) {
392
+					$this->loadProcedureTag($node);
393
+		}
380 394
 
381
-		foreach($document->xpath('//cacheModel') as $node)
382
-				$this->loadCacheModel($node);
395
+		foreach($document->xpath('//cacheModel') as $node) {
396
+						$this->loadCacheModel($node);
397
+		}
383 398
 
384 399
 		$this->registerCacheTriggers();
385 400
 	}
@@ -482,8 +497,9 @@  discard block
 block discarded – undo
482 497
 					'sqlmap_unable_to_find_parent_parameter_map', $node, $this->_configFile,$extendMap);
483 498
 			$superMap = $this->_manager->getParameterMap($extendMap);
484 499
 			$index = 0;
485
-			foreach($superMap->getPropertyNames() as $propertyName)
486
-				$parameterMap->insertProperty($index++,$superMap->getProperty($propertyName));
500
+			foreach($superMap->getPropertyNames() as $propertyName) {
501
+							$parameterMap->insertProperty($index++,$superMap->getProperty($propertyName));
502
+			}
487 503
 		}
488 504
 		$this->_manager->addParameterMap($parameterMap);
489 505
 	}
@@ -565,8 +581,9 @@  discard block
 block discarded – undo
565 581
 				$map = new TParameterMap();
566 582
 				$map->setID($statement->getID().'-InLineParameterMap');
567 583
 				$statement->setInlineParameterMap($map);
568
-				foreach($sqlText['parameters'] as $property)
569
-					$map->addProperty($property);
584
+				foreach($sqlText['parameters'] as $property) {
585
+									$map->addProperty($property);
586
+				}
570 587
 			}
571 588
 			$sqlStatement = $sqlText['sql'];
572 589
 		}
@@ -591,8 +608,7 @@  discard block
 block discarded – undo
591 608
 		{
592 609
 			$sql = new TSimpleDynamicSql($dynamics['parameters']);
593 610
 			$sqlStatement = $dynamics['sql'];
594
-		}
595
-		else
611
+		} else
596 612
 			$sql = new TStaticSql();
597 613
 		$sqlStatement=preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/',self::SIMPLE_MARK,$sqlStatement);
598 614
 		$sql->buildPreparedStatement($statement, $sqlStatement);
@@ -726,8 +742,9 @@  discard block
 block discarded – undo
726 742
 
727 743
 		$cacheModel->initialize($cache);
728 744
 		$this->_manager->addCacheModel($cacheModel);
729
-		foreach($node->xpath('flushOnExecute') as $flush)
730
-			$this->loadFlushOnCache($cacheModel,$node,$flush);
745
+		foreach($node->xpath('flushOnExecute') as $flush) {
746
+					$this->loadFlushOnCache($cacheModel,$node,$flush);
747
+		}
731 748
 	}
732 749
 
733 750
 	/**
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	protected function createObjectFromNode($node)
29 29
 	{
30
-		if(isset($node['class']))
30
+		if (isset($node['class']))
31 31
 		{
32
-			$obj = Prado::createComponent((string)$node['class']);
33
-			$this->setObjectPropFromNode($obj,$node,array('class'));
32
+			$obj = Prado::createComponent((string) $node['class']);
33
+			$this->setObjectPropFromNode($obj, $node, array('class'));
34 34
 			return $obj;
35 35
 		}
36 36
 		throw new TSqlMapConfigurationException(
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
 	 * @param SimpleXmlNode property node
46 46
 	 * @param array exception property name
47 47
 	 */
48
-	protected function setObjectPropFromNode($obj,$node,$except=array())
48
+	protected function setObjectPropFromNode($obj, $node, $except = array())
49 49
 	{
50
-		foreach($node->attributes() as $name=>$value)
50
+		foreach ($node->attributes() as $name=>$value)
51 51
 		{
52
-			if(!in_array($name,$except))
52
+			if (!in_array($name, $except))
53 53
 			{
54
-				if($obj->canSetProperty($name))
55
-					$obj->{$name} = (string)$value;
54
+				if ($obj->canSetProperty($name))
55
+					$obj->{$name} = (string) $value;
56 56
 				else
57 57
 					throw new TSqlMapConfigurationException(
58 58
 						'sqlmap_invalid_property', $name, get_class($obj),
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 * @param string relative filename
68 68
 	 * @return string absolute filename.
69 69
 	 */
70
-	protected function getAbsoluteFilePath($basefile,$resource)
70
+	protected function getAbsoluteFilePath($basefile, $resource)
71 71
 	{
72 72
 		$basedir = dirname($basefile);
73
-		$file = realpath($basedir.DIRECTORY_SEPARATOR.$resource);
74
-		if(!is_string($file) || !is_file($file))
73
+		$file = realpath($basedir . DIRECTORY_SEPARATOR . $resource);
74
+		if (!is_string($file) || !is_file($file))
75 75
 			$file = realpath($resource);
76
-		if(is_string($file) && is_file($file))
76
+		if (is_string($file) && is_file($file))
77 77
 			return $file;
78 78
 		else
79 79
 			throw new TSqlMapConfigurationException(
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 	 * @param string filename.
86 86
 	 * @return SimpleXmlElement xml document.
87 87
 	 */
88
-	protected function loadXmlDocument($filename,TSqlMapXmlConfiguration $config)
88
+	protected function loadXmlDocument($filename, TSqlMapXmlConfiguration $config)
89 89
 	{
90
-		if( strpos($filename, '${') !== false)
90
+		if (strpos($filename, '${') !== false)
91 91
 			$filename = $config->replaceProperties($filename);
92 92
 
93
-		if(!is_file($filename))
93
+		if (!is_file($filename))
94 94
 			throw new TSqlMapConfigurationException(
95 95
 				'sqlmap_unable_to_find_config', $filename);
96 96
 		return simplexml_load_string($config->replaceProperties(file_get_contents($filename)));
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	protected function getElementByIdValue($document, $tag, $value)
107 107
 	{
108 108
 		//hack to allow upper case and lower case attribute names.
109
-		foreach(array('id','ID','Id', 'iD') as $id)
109
+		foreach (array('id', 'ID', 'Id', 'iD') as $id)
110 110
 		{
111 111
 			$xpath = "//{$tag}[@{$id}='{$value}']";
112
-			foreach($document->xpath($xpath) as $node)
112
+			foreach ($document->xpath($xpath) as $node)
113 113
 				return $node;
114 114
 		}
115 115
 	}
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
 	/**
143 143
 	 * @var array global properties.
144 144
 	 */
145
-	private $_properties=array();
145
+	private $_properties = array();
146 146
 
147 147
 	/**
148 148
 	 * @param TSqlMapManager manager instance.
149 149
 	 */
150 150
 	public function __construct($manager)
151 151
 	{
152
-		$this->_manager=$manager;
152
+		$this->_manager = $manager;
153 153
 	}
154 154
 
155 155
 	public function getManager()
@@ -166,25 +166,25 @@  discard block
 block discarded – undo
166 166
 	 * Configure the TSqlMapManager using the given xml file.
167 167
 	 * @param string SqlMap configuration xml file.
168 168
 	 */
169
-	public function configure($filename=null)
169
+	public function configure($filename = null)
170 170
 	{
171
-		$this->_configFile=$filename;
172
-		$document = $this->loadXmlDocument($filename,$this);
171
+		$this->_configFile = $filename;
172
+		$document = $this->loadXmlDocument($filename, $this);
173 173
 
174
-		foreach($document->xpath('//property') as $property)
174
+		foreach ($document->xpath('//property') as $property)
175 175
 			$this->loadGlobalProperty($property);
176 176
 
177
-		foreach($document->xpath('//typeHandler') as $handler)
177
+		foreach ($document->xpath('//typeHandler') as $handler)
178 178
 			$this->loadTypeHandler($handler);
179 179
 
180
-		foreach($document->xpath('//connection[last()]') as $conn)
180
+		foreach ($document->xpath('//connection[last()]') as $conn)
181 181
 			$this->loadDatabaseConnection($conn);
182 182
 
183 183
 		//try to load configuration in the current config file.
184 184
 		$mapping = new TSqlMapXmlMappingConfiguration($this);
185 185
 		$mapping->configure($filename);
186 186
 
187
-		foreach($document->xpath('//sqlMap') as $sqlmap)
187
+		foreach ($document->xpath('//sqlMap') as $sqlmap)
188 188
 			$this->loadSqlMappingFiles($sqlmap);
189 189
 
190 190
 		$this->resolveResultMapping();
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	protected function loadGlobalProperty($node)
199 199
 	{
200
-		$this->_properties[(string)$node['name']] = (string)$node['value'];
200
+		$this->_properties[(string) $node['name']] = (string) $node['value'];
201 201
 	}
202 202
 
203 203
 	/**
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	protected function loadSqlMappingFiles($node)
228 228
 	{
229
-		if(strlen($resource = (string)$node['resource']) > 0)
229
+		if (strlen($resource = (string) $node['resource']) > 0)
230 230
 		{
231
-			if( strpos($resource, '${') !== false)
231
+			if (strpos($resource, '${') !== false)
232 232
 				$resource = $this->replaceProperties($resource);
233 233
 
234 234
 			$mapping = new TSqlMapXmlMappingConfiguration($this);
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 	protected function resolveResultMapping()
244 244
 	{
245 245
 		$maps = $this->_manager->getResultMaps();
246
-		foreach($maps as $entry)
246
+		foreach ($maps as $entry)
247 247
 		{
248
-			foreach($entry->getColumns() as $item)
248
+			foreach ($entry->getColumns() as $item)
249 249
 			{
250 250
 				$resultMap = $item->getResultMapping();
251
-				if(strlen($resultMap) > 0)
251
+				if (strlen($resultMap) > 0)
252 252
 				{
253
-					if($maps->contains($resultMap))
253
+					if ($maps->contains($resultMap))
254 254
 						$item->setNestedResultMap($maps[$resultMap]);
255 255
 					else
256 256
 						throw new TSqlMapConfigurationException(
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 								$resultMap, $this->_configFile, $entry->getID());
259 259
 				}
260 260
 			}
261
-			if($entry->getDiscriminator()!==null)
261
+			if ($entry->getDiscriminator() !== null)
262 262
 				$entry->getDiscriminator()->initialize($this->_manager);
263 263
 		}
264 264
 	}
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	protected function attachCacheModels()
270 270
 	{
271
-		foreach($this->_manager->getMappedStatements() as $mappedStatement)
271
+		foreach ($this->_manager->getMappedStatements() as $mappedStatement)
272 272
 		{
273
-			if(strlen($model = $mappedStatement->getStatement()->getCacheModel()) > 0)
273
+			if (strlen($model = $mappedStatement->getStatement()->getCacheModel()) > 0)
274 274
 			{
275 275
 				$cache = $this->_manager->getCacheModel($model);
276 276
 				$mappedStatement->getStatement()->setCache($cache);
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	public function replaceProperties($string)
288 288
 	{
289
-		foreach($this->_properties as $find => $replace)
290
-			$string = str_replace('${'.$find.'}', $replace, $string);
289
+		foreach ($this->_properties as $find => $replace)
290
+			$string = str_replace('${' . $find . '}', $replace, $string);
291 291
 		return $string;
292 292
 	}
293 293
 }
@@ -309,25 +309,25 @@  discard block
 block discarded – undo
309 309
 
310 310
 	private $_document;
311 311
 
312
-	private $_FlushOnExecuteStatements=array();
312
+	private $_FlushOnExecuteStatements = array();
313 313
 
314 314
 	/**
315 315
 	 * Regular expressions for escaping simple/inline parameter symbols
316 316
 	 */
317
-	const SIMPLE_MARK='$';
318
-	const INLINE_SYMBOL='#';
319
-	const ESCAPED_SIMPLE_MARK_REGEXP='/\$\$/';
320
-	const ESCAPED_INLINE_SYMBOL_REGEXP='/\#\#/';
321
-	const SIMPLE_PLACEHOLDER='`!!`';
322
-	const INLINE_PLACEHOLDER='`!!!`';
317
+	const SIMPLE_MARK = '$';
318
+	const INLINE_SYMBOL = '#';
319
+	const ESCAPED_SIMPLE_MARK_REGEXP = '/\$\$/';
320
+	const ESCAPED_INLINE_SYMBOL_REGEXP = '/\#\#/';
321
+	const SIMPLE_PLACEHOLDER = '`!!`';
322
+	const INLINE_PLACEHOLDER = '`!!!`';
323 323
 
324 324
 	/**
325 325
 	 * @param TSqlMapXmlConfiguration parent xml configuration.
326 326
 	 */
327 327
 	public function __construct(TSqlMapXmlConfiguration $xmlConfig)
328 328
 	{
329
-		$this->_xmlConfig=$xmlConfig;
330
-		$this->_manager=$xmlConfig->getManager();
329
+		$this->_xmlConfig = $xmlConfig;
330
+		$this->_manager = $xmlConfig->getManager();
331 331
 	}
332 332
 
333 333
 	protected function getConfigFile()
@@ -341,44 +341,44 @@  discard block
 block discarded – undo
341 341
 	 */
342 342
 	public function configure($filename)
343 343
 	{
344
-		$this->_configFile=$filename;
345
-		$document = $this->loadXmlDocument($filename,$this->_xmlConfig);
346
-		$this->_document=$document;
344
+		$this->_configFile = $filename;
345
+		$document = $this->loadXmlDocument($filename, $this->_xmlConfig);
346
+		$this->_document = $document;
347 347
 
348 348
 		static $bCacheDependencies;
349
-		if($bCacheDependencies === null)
349
+		if ($bCacheDependencies === null)
350 350
 			$bCacheDependencies = true; //Prado::getApplication()->getMode() !== TApplicationMode::Performance;
351 351
 
352
-		if($bCacheDependencies)
352
+		if ($bCacheDependencies)
353 353
 			$this->_manager->getCacheDependencies()
354 354
 					->getDependencies()
355 355
 					->add(new TFileCacheDependency($filename));
356 356
 
357
-		foreach($document->xpath('//resultMap') as $node)
357
+		foreach ($document->xpath('//resultMap') as $node)
358 358
 			$this->loadResultMap($node);
359 359
 
360
-		foreach($document->xpath('//parameterMap') as $node)
360
+		foreach ($document->xpath('//parameterMap') as $node)
361 361
 			$this->loadParameterMap($node);
362 362
 
363
-		foreach($document->xpath('//statement') as $node)
363
+		foreach ($document->xpath('//statement') as $node)
364 364
 			$this->loadStatementTag($node);
365 365
 
366
-		foreach($document->xpath('//select') as $node)
366
+		foreach ($document->xpath('//select') as $node)
367 367
 			$this->loadSelectTag($node);
368 368
 
369
-		foreach($document->xpath('//insert') as $node)
369
+		foreach ($document->xpath('//insert') as $node)
370 370
 			$this->loadInsertTag($node);
371 371
 
372
-		foreach($document->xpath('//update') as $node)
372
+		foreach ($document->xpath('//update') as $node)
373 373
 			$this->loadUpdateTag($node);
374 374
 
375
-		foreach($document->xpath('//delete') as $node)
375
+		foreach ($document->xpath('//delete') as $node)
376 376
 			$this->loadDeleteTag($node);
377 377
 
378
-		foreach($document->xpath('//procedure') as $node)
378
+		foreach ($document->xpath('//procedure') as $node)
379 379
 			$this->loadProcedureTag($node);
380 380
 
381
-		foreach($document->xpath('//cacheModel') as $node)
381
+		foreach ($document->xpath('//cacheModel') as $node)
382 382
 				$this->loadCacheModel($node);
383 383
 
384 384
 		$this->registerCacheTriggers();
@@ -393,16 +393,16 @@  discard block
 block discarded – undo
393 393
 		$resultMap = $this->createResultMap($node);
394 394
 
395 395
 		//find extended result map.
396
-		if(strlen($extendMap = $resultMap->getExtends()) > 0)
396
+		if (strlen($extendMap = $resultMap->getExtends()) > 0)
397 397
 		{
398
-			if(!$this->_manager->getResultMaps()->contains($extendMap))
398
+			if (!$this->_manager->getResultMaps()->contains($extendMap))
399 399
 			{
400
-				$extendNode=$this->getElementByIdValue($this->_document,'resultMap',$extendMap);
401
-				if($extendNode!==null)
400
+				$extendNode = $this->getElementByIdValue($this->_document, 'resultMap', $extendMap);
401
+				if ($extendNode !== null)
402 402
 					$this->loadResultMap($extendNode);
403 403
 			}
404 404
 
405
-			if(!$this->_manager->getResultMaps()->contains($extendMap))
405
+			if (!$this->_manager->getResultMaps()->contains($extendMap))
406 406
 				throw new TSqlMapConfigurationException(
407 407
 					'sqlmap_unable_to_find_parent_result_map', $node, $this->_configFile, $extendMap);
408 408
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 		}
412 412
 
413 413
 		//add the result map
414
-		if(!$this->_manager->getResultMaps()->contains($resultMap->getID()))
414
+		if (!$this->_manager->getResultMaps()->contains($resultMap->getID()))
415 415
 			$this->_manager->addResultMap($resultMap);
416 416
 	}
417 417
 
@@ -424,36 +424,36 @@  discard block
 block discarded – undo
424 424
 	protected function createResultMap($node)
425 425
 	{
426 426
 		$resultMap = new TResultMap();
427
-		$this->setObjectPropFromNode($resultMap,$node);
427
+		$this->setObjectPropFromNode($resultMap, $node);
428 428
 
429 429
 		//result nodes
430
-		foreach($node->result as $result)
430
+		foreach ($node->result as $result)
431 431
 		{
432 432
 			$property = new TResultProperty($resultMap);
433
-			$this->setObjectPropFromNode($property,$result);
433
+			$this->setObjectPropFromNode($property, $result);
434 434
 			$resultMap->addResultProperty($property);
435 435
 		}
436 436
 
437 437
 		//create the discriminator
438 438
 		$discriminator = null;
439
-		if(isset($node->discriminator))
439
+		if (isset($node->discriminator))
440 440
 		{
441 441
 			$discriminator = new TDiscriminator();
442 442
 			$this->setObjectPropFromNode($discriminator, $node->discriminator);
443 443
 			$discriminator->initMapping($resultMap);
444 444
 		}
445 445
 
446
-		foreach($node->xpath('subMap') as $subMapNode)
446
+		foreach ($node->xpath('subMap') as $subMapNode)
447 447
 		{
448
-			if($discriminator===null)
448
+			if ($discriminator === null)
449 449
 				throw new TSqlMapConfigurationException(
450
-					'sqlmap_undefined_discriminator', $node, $this->_configFile,$subMapNode);
450
+					'sqlmap_undefined_discriminator', $node, $this->_configFile, $subMapNode);
451 451
 			$subMap = new TSubMap;
452
-			$this->setObjectPropFromNode($subMap,$subMapNode);
452
+			$this->setObjectPropFromNode($subMap, $subMapNode);
453 453
 			$discriminator->addSubMap($subMap);
454 454
 		}
455 455
 
456
-		if($discriminator!==null)
456
+		if ($discriminator !== null)
457 457
 			$resultMap->setDiscriminator($discriminator);
458 458
 
459 459
 		return $resultMap;
@@ -468,22 +468,22 @@  discard block
 block discarded – undo
468 468
 	{
469 469
 		$parameterMap = $this->createParameterMap($node);
470 470
 
471
-		if(strlen($extendMap = $parameterMap->getExtends()) > 0)
471
+		if (strlen($extendMap = $parameterMap->getExtends()) > 0)
472 472
 		{
473
-			if(!$this->_manager->getParameterMaps()->contains($extendMap))
473
+			if (!$this->_manager->getParameterMaps()->contains($extendMap))
474 474
 			{
475
-				$extendNode=$this->getElementByIdValue($this->_document,'parameterMap',$extendMap);
476
-				if($extendNode!==null)
475
+				$extendNode = $this->getElementByIdValue($this->_document, 'parameterMap', $extendMap);
476
+				if ($extendNode !== null)
477 477
 					$this->loadParameterMap($extendNode);
478 478
 			}
479 479
 
480
-			if(!$this->_manager->getParameterMaps()->contains($extendMap))
480
+			if (!$this->_manager->getParameterMaps()->contains($extendMap))
481 481
 				throw new TSqlMapConfigurationException(
482
-					'sqlmap_unable_to_find_parent_parameter_map', $node, $this->_configFile,$extendMap);
482
+					'sqlmap_unable_to_find_parent_parameter_map', $node, $this->_configFile, $extendMap);
483 483
 			$superMap = $this->_manager->getParameterMap($extendMap);
484 484
 			$index = 0;
485
-			foreach($superMap->getPropertyNames() as $propertyName)
486
-				$parameterMap->insertProperty($index++,$superMap->getProperty($propertyName));
485
+			foreach ($superMap->getPropertyNames() as $propertyName)
486
+				$parameterMap->insertProperty($index++, $superMap->getProperty($propertyName));
487 487
 		}
488 488
 		$this->_manager->addParameterMap($parameterMap);
489 489
 	}
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
 	protected function createParameterMap($node)
497 497
 	{
498 498
 		$parameterMap = new TParameterMap();
499
-		$this->setObjectPropFromNode($parameterMap,$node);
500
-		foreach($node->parameter as $parameter)
499
+		$this->setObjectPropFromNode($parameterMap, $node);
500
+		foreach ($node->parameter as $parameter)
501 501
 		{
502 502
 			$property = new TParameterProperty();
503
-			$this->setObjectPropFromNode($property,$parameter);
503
+			$this->setObjectPropFromNode($property, $parameter);
504 504
 			$parameterMap->addProperty($property);
505 505
 		}
506 506
 		return $parameterMap;
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	protected function loadStatementTag($node)
514 514
 	{
515 515
 		$statement = new TSqlMapStatement();
516
-		$this->setObjectPropFromNode($statement,$node);
516
+		$this->setObjectPropFromNode($statement, $node);
517 517
 		$this->processSqlStatement($statement, $node);
518 518
 		$mappedStatement = new TMappedStatement($this->_manager, $statement);
519 519
 		$this->_manager->addMappedStatement($mappedStatement);
@@ -527,15 +527,15 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	protected function processSqlStatement($statement, $node)
529 529
 	{
530
-		$commandText = (string)$node;
531
-		if(strlen($extend = $statement->getExtends()) > 0)
530
+		$commandText = (string) $node;
531
+		if (strlen($extend = $statement->getExtends()) > 0)
532 532
 		{
533
-			$superNode = $this->getElementByIdValue($this->_document,'*',$extend);
534
-			if($superNode!==null)
535
-				$commandText = (string)$superNode . $commandText;
533
+			$superNode = $this->getElementByIdValue($this->_document, '*', $extend);
534
+			if ($superNode !== null)
535
+				$commandText = (string) $superNode . $commandText;
536 536
 			else
537 537
 				throw new TSqlMapConfigurationException(
538
-						'sqlmap_unable_to_find_parent_sql', $extend, $this->_configFile,$node);
538
+						'sqlmap_unable_to_find_parent_sql', $extend, $this->_configFile, $node);
539 539
 		}
540 540
 		//$commandText = $this->_xmlConfig->replaceProperties($commandText);
541 541
 		$statement->initialize($this->_manager);
@@ -553,24 +553,24 @@  discard block
 block discarded – undo
553 553
 		$scope['file'] = $this->_configFile;
554 554
 		$scope['node'] = $node;
555 555
 
556
-		$sqlStatement=preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP,self::INLINE_PLACEHOLDER,$sqlStatement);
557
-		if($statement->parameterMap() === null)
556
+		$sqlStatement = preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP, self::INLINE_PLACEHOLDER, $sqlStatement);
557
+		if ($statement->parameterMap() === null)
558 558
 		{
559 559
 			// Build a Parametermap with the inline parameters.
560 560
 			// if they exist. Then delete inline infos from sqltext.
561 561
 			$parameterParser = new TInlineParameterMapParser;
562 562
 			$sqlText = $parameterParser->parse($sqlStatement, $scope);
563
-			if(count($sqlText['parameters']) > 0)
563
+			if (count($sqlText['parameters']) > 0)
564 564
 			{
565 565
 				$map = new TParameterMap();
566
-				$map->setID($statement->getID().'-InLineParameterMap');
566
+				$map->setID($statement->getID() . '-InLineParameterMap');
567 567
 				$statement->setInlineParameterMap($map);
568
-				foreach($sqlText['parameters'] as $property)
568
+				foreach ($sqlText['parameters'] as $property)
569 569
 					$map->addProperty($property);
570 570
 			}
571 571
 			$sqlStatement = $sqlText['sql'];
572 572
 		}
573
-		$sqlStatement=preg_replace('/'.self::INLINE_PLACEHOLDER.'/',self::INLINE_SYMBOL,$sqlStatement);
573
+		$sqlStatement = preg_replace('/' . self::INLINE_PLACEHOLDER . '/', self::INLINE_SYMBOL, $sqlStatement);
574 574
 
575 575
 		$this->prepareSql($statement, $sqlStatement, $node);
576 576
 	}
@@ -582,19 +582,19 @@  discard block
 block discarded – undo
582 582
 	 * @param SimpleXmlElement statement node.
583 583
 	 * @todo Extend to dynamic sql.
584 584
 	 */
585
-	protected function prepareSql($statement,$sqlStatement, $node)
585
+	protected function prepareSql($statement, $sqlStatement, $node)
586 586
 	{
587 587
 		$simpleDynamic = new TSimpleDynamicParser;
588
-		$sqlStatement=preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP,self::SIMPLE_PLACEHOLDER,$sqlStatement);
588
+		$sqlStatement = preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP, self::SIMPLE_PLACEHOLDER, $sqlStatement);
589 589
 		$dynamics = $simpleDynamic->parse($sqlStatement);
590
-		if(count($dynamics['parameters']) > 0)
590
+		if (count($dynamics['parameters']) > 0)
591 591
 		{
592 592
 			$sql = new TSimpleDynamicSql($dynamics['parameters']);
593 593
 			$sqlStatement = $dynamics['sql'];
594 594
 		}
595 595
 		else
596 596
 			$sql = new TStaticSql();
597
-		$sqlStatement=preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/',self::SIMPLE_MARK,$sqlStatement);
597
+		$sqlStatement = preg_replace('/' . self::SIMPLE_PLACEHOLDER . '/', self::SIMPLE_MARK, $sqlStatement);
598 598
 		$sql->buildPreparedStatement($statement, $sqlStatement);
599 599
 		$statement->setSqlText($sql);
600 600
 	}
@@ -606,10 +606,10 @@  discard block
 block discarded – undo
606 606
 	protected function loadSelectTag($node)
607 607
 	{
608 608
 		$select = new TSqlMapSelect;
609
-		$this->setObjectPropFromNode($select,$node);
610
-		$this->processSqlStatement($select,$node);
609
+		$this->setObjectPropFromNode($select, $node);
610
+		$this->processSqlStatement($select, $node);
611 611
 		$mappedStatement = new TMappedStatement($this->_manager, $select);
612
-		if(strlen($select->getCacheModel()) > 0)
612
+		if (strlen($select->getCacheModel()) > 0)
613 613
 			$mappedStatement = new TCachingStatement($mappedStatement);
614 614
 
615 615
 		$this->_manager->addMappedStatement($mappedStatement);
@@ -635,9 +635,9 @@  discard block
 block discarded – undo
635 635
 	protected function createInsertStatement($node)
636 636
 	{
637 637
 		$insert = new TSqlMapInsert;
638
-		$this->setObjectPropFromNode($insert,$node);
639
-		if(isset($node->selectKey))
640
-			$this->loadSelectKeyTag($insert,$node->selectKey);
638
+		$this->setObjectPropFromNode($insert, $node);
639
+		if (isset($node->selectKey))
640
+			$this->loadSelectKeyTag($insert, $node->selectKey);
641 641
 		return $insert;
642 642
 	}
643 643
 
@@ -648,10 +648,10 @@  discard block
 block discarded – undo
648 648
 	protected function loadSelectKeyTag($insert, $node)
649 649
 	{
650 650
 		$selectKey = new TSqlMapSelectKey;
651
-		$this->setObjectPropFromNode($selectKey,$node);
651
+		$this->setObjectPropFromNode($selectKey, $node);
652 652
 		$selectKey->setID($insert->getID());
653
-		$selectKey->setID($insert->getID().'.SelectKey');
654
-		$this->processSqlStatement($selectKey,$node);
653
+		$selectKey->setID($insert->getID() . '.SelectKey');
654
+		$this->processSqlStatement($selectKey, $node);
655 655
 		$insert->setSelectKey($selectKey);
656 656
 		$mappedStatement = new TMappedStatement($this->_manager, $selectKey);
657 657
 		$this->_manager->addMappedStatement($mappedStatement);
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	protected function loadUpdateTag($node)
665 665
 	{
666 666
 		$update = new TSqlMapUpdate;
667
-		$this->setObjectPropFromNode($update,$node);
667
+		$this->setObjectPropFromNode($update, $node);
668 668
 		$this->processSqlStatement($update, $node);
669 669
 		$mappedStatement = new TUpdateMappedStatement($this->_manager, $update);
670 670
 		$this->_manager->addMappedStatement($mappedStatement);
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	protected function loadDeleteTag($node)
678 678
 	{
679 679
 		$delete = new TSqlMapDelete;
680
-		$this->setObjectPropFromNode($delete,$node);
680
+		$this->setObjectPropFromNode($delete, $node);
681 681
 		$this->processSqlStatement($delete, $node);
682 682
 		$mappedStatement = new TDeleteMappedStatement($this->_manager, $delete);
683 683
 		$this->_manager->addMappedStatement($mappedStatement);
@@ -700,34 +700,34 @@  discard block
 block discarded – undo
700 700
 	protected function loadCacheModel($node)
701 701
 	{
702 702
 		$cacheModel = new TSqlMapCacheModel;
703
-		$properties = array('id','implementation');
704
-		foreach($node->attributes() as $name=>$value)
703
+		$properties = array('id', 'implementation');
704
+		foreach ($node->attributes() as $name=>$value)
705 705
 		{
706
-			if(in_array(strtolower($name), $properties))
707
-				$cacheModel->{'set'.$name}((string)$value);
706
+			if (in_array(strtolower($name), $properties))
707
+				$cacheModel->{'set' . $name}((string) $value);
708 708
 		}
709 709
 		$cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel);
710
-		$this->setObjectPropFromNode($cache,$node,$properties);
710
+		$this->setObjectPropFromNode($cache, $node, $properties);
711 711
 
712
-		foreach($node->xpath('property') as $propertyNode)
712
+		foreach ($node->xpath('property') as $propertyNode)
713 713
 		{
714 714
 			$name = $propertyNode->attributes()->name;
715
-			if($name===null || $name==='') continue;
715
+			if ($name === null || $name === '') continue;
716 716
 
717 717
 			$value = $propertyNode->attributes()->value;
718
-			if($value===null || $value==='') continue;
718
+			if ($value === null || $value === '') continue;
719 719
 
720
-			if( !TPropertyAccess::has($cache, $name) ) continue;
720
+			if (!TPropertyAccess::has($cache, $name)) continue;
721 721
 
722 722
 			TPropertyAccess::set($cache, $name, $value);
723 723
 		}
724 724
 
725
-		$this->loadFlushInterval($cacheModel,$node);
725
+		$this->loadFlushInterval($cacheModel, $node);
726 726
 
727 727
 		$cacheModel->initialize($cache);
728 728
 		$this->_manager->addCacheModel($cacheModel);
729
-		foreach($node->xpath('flushOnExecute') as $flush)
730
-			$this->loadFlushOnCache($cacheModel,$node,$flush);
729
+		foreach ($node->xpath('flushOnExecute') as $flush)
730
+			$this->loadFlushOnCache($cacheModel, $node, $flush);
731 731
 	}
732 732
 
733 733
 	/**
@@ -738,26 +738,26 @@  discard block
 block discarded – undo
738 738
 	protected function loadFlushInterval($cacheModel, $node)
739 739
 	{
740 740
 		$flushInterval = $node->xpath('flushInterval');
741
-		if($flushInterval === null || count($flushInterval) === 0) return;
741
+		if ($flushInterval === null || count($flushInterval) === 0) return;
742 742
 		$duration = 0;
743
-		foreach($flushInterval[0]->attributes() as $name=>$value)
743
+		foreach ($flushInterval[0]->attributes() as $name=>$value)
744 744
 		{
745
-			switch(strToLower($name))
745
+			switch (strToLower($name))
746 746
 			{
747 747
 				case 'seconds':
748
-					$duration += (integer)$value;
748
+					$duration += (integer) $value;
749 749
 				break;
750 750
 				case 'minutes':
751
-					$duration += 60 * (integer)$value;
751
+					$duration += 60 * (integer) $value;
752 752
 				break;
753 753
 				case 'hours':
754
-					$duration += 3600 * (integer)$value;
754
+					$duration += 3600 * (integer) $value;
755 755
 				break;
756 756
 				case 'days':
757
-					$duration += 86400 * (integer)$value;
757
+					$duration += 86400 * (integer) $value;
758 758
 				break;
759 759
 				case 'duration':
760
-					$duration = (integer)$value;
760
+					$duration = (integer) $value;
761 761
 				break 2; // switch, foreach
762 762
 			}
763 763
 		}
@@ -770,15 +770,15 @@  discard block
 block discarded – undo
770 770
 	 * @param SimpleXmlElement parent node.
771 771
 	 * @param SimpleXmlElement flush node.
772 772
 	 */
773
-	protected function loadFlushOnCache($cacheModel,$parent,$node)
773
+	protected function loadFlushOnCache($cacheModel, $parent, $node)
774 774
 	{
775 775
 		$id = $cacheModel->getID();
776
-		if(!isset($this->_FlushOnExecuteStatements[$id]))
776
+		if (!isset($this->_FlushOnExecuteStatements[$id]))
777 777
 			$this->_FlushOnExecuteStatements[$id] = array();
778
-		foreach($node->attributes() as $name=>$value)
778
+		foreach ($node->attributes() as $name=>$value)
779 779
 		{
780
-			if(strtolower($name)==='statement')
781
-				$this->_FlushOnExecuteStatements[$id][] = (string)$value;
780
+			if (strtolower($name) === 'statement')
781
+				$this->_FlushOnExecuteStatements[$id][] = (string) $value;
782 782
 		}
783 783
 	}
784 784
 
@@ -787,10 +787,10 @@  discard block
 block discarded – undo
787 787
 	 */
788 788
 	protected function registerCacheTriggers()
789 789
 	{
790
-		foreach($this->_FlushOnExecuteStatements as $cacheID => $statementIDs)
790
+		foreach ($this->_FlushOnExecuteStatements as $cacheID => $statementIDs)
791 791
 		{
792 792
 			$cacheModel = $this->_manager->getCacheModel($cacheID);
793
-			foreach($statementIDs as $statementID)
793
+			foreach ($statementIDs as $statementID)
794 794
 			{
795 795
 				$statement = $this->_manager->getMappedStatement($statementID);
796 796
 				$cacheModel->registerTriggerStatement($statement);
Please login to merge, or discard this patch.
framework/Data/SqlMap/DataMapper/TLazyLoadList.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -116,6 +116,7 @@
 block discarded – undo
116 116
 	/**
117 117
 	 * @param object handler to method calls.
118 118
 	 * @param object the object to by proxied.
119
+	 * @param TLazyLoadList $handler
119 120
 	 */
120 121
 	public function __construct($handler, $object)
121 122
 	{
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 {
21 21
 	private $_param;
22 22
 	private $_target;
23
-	private $_propertyName='';
24
-	private $_statement='';
25
-	private $_loaded=false;
23
+	private $_propertyName = '';
24
+	private $_statement = '';
25
+	private $_loaded = false;
26 26
 	private $_innerList;
27 27
 	private $_connection;
28 28
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		$this->_param = $param;
40 40
 		$this->_target = $target;
41 41
 		$this->_statement = $mappedStatement;
42
-		$this->_connection=$mappedStatement->getManager()->getDbConnection();
42
+		$this->_connection = $mappedStatement->getManager()->getDbConnection();
43 43
 		$this->_propertyName = $propertyName;
44 44
 	}
45 45
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$handler = new self($mappedStatement, $param, $target, $propertyName);
57 57
 		$statement = $mappedStatement->getStatement();
58
-		$registry=$mappedStatement->getManager()->getTypeHandlers();
58
+		$registry = $mappedStatement->getManager()->getTypeHandlers();
59 59
 		$list = $statement->createInstanceOfListClass($registry);
60
-		if(!is_object($list))
61
-			throw new TSqlMapExecutionException('sqlmap_invalid_lazyload_list',$statement->getID());
60
+		if (!is_object($list))
61
+			throw new TSqlMapExecutionException('sqlmap_invalid_lazyload_list', $statement->getID());
62 62
 		return new TObjectProxy($handler, $list);
63 63
 	}
64 64
 
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	protected function fetchListData()
79 79
 	{
80
-		if($this->_loaded == false)
80
+		if ($this->_loaded == false)
81 81
 		{
82
-			$this->_innerList = $this->_statement->executeQueryForList($this->_connection,$this->_param);
82
+			$this->_innerList = $this->_statement->executeQueryForList($this->_connection, $this->_param);
83 83
 			$this->_loaded = true;
84 84
 			//replace the target property with real list
85 85
 			TPropertyAccess::set($this->_target, $this->_propertyName, $this->_innerList);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	public function hasMethod($method)
95 95
 	{
96 96
 		$this->fetchListData();
97
-		if(is_object($this->_innerList))
97
+		if (is_object($this->_innerList))
98 98
 			return in_array($method, get_class_methods($this->_innerList));
99 99
 		return false;
100 100
 	}
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @param array method arguments
131 131
 	 * @return mixed method return value.
132 132
 	 */
133
-	public function __call($method,$params)
133
+	public function __call($method, $params)
134 134
 	{
135
-		if($this->_handler->hasMethod($method))
135
+		if ($this->_handler->hasMethod($method))
136 136
 			return $this->_handler->intercept($method, $params);
137 137
 		else
138 138
 			return call_user_func_array(array($this->_object, $method), $params);
Please login to merge, or discard this patch.
framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -40,6 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param int page size
41 41
 	 * @param mixed delegate for each data row retrieved.
42 42
 	 * @param int number of page to fetch on initialization
43
+	 * @param integer $pageSize
43 44
 	 */
44 45
 	public function __construct(IMappedStatement $statement,$parameter, $pageSize, $delegate=null, $page=0)
45 46
 	{
@@ -55,6 +56,8 @@  discard block
 block discarded – undo
55 56
 	 * @param mixed query parameters
56 57
 	 * @param int page size.
57 58
 	 * @param int number of page.
59
+	 * @param IMappedStatement $statement
60
+	 * @param integer $page
58 61
 	 */
59 62
 	protected function initialize($statement, $parameter, $pageSize, $page)
60 63
 	{
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	private $_parameter;
32 32
 	private $_prevPageList;
33 33
 	private $_nextPageList;
34
-	private $_delegate=null;
34
+	private $_delegate = null;
35 35
 
36 36
 	/**
37 37
 	 * Create a new SqlMap paged list.
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @param mixed delegate for each data row retrieved.
42 42
 	 * @param int number of page to fetch on initialization
43 43
 	 */
44
-	public function __construct(IMappedStatement $statement,$parameter, $pageSize, $delegate=null, $page=0)
44
+	public function __construct(IMappedStatement $statement, $parameter, $pageSize, $delegate = null, $page = 0)
45 45
 	{
46 46
 		parent::__construct();
47 47
 		parent::setCustomPaging(true);
48
-		$this->initialize($statement,$parameter, $pageSize, $page);
49
-		$this->_delegate=$delegate;
48
+		$this->initialize($statement, $parameter, $pageSize, $page);
49
+		$this->_delegate = $delegate;
50 50
 	}
51 51
 
52 52
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	{
115 115
 		$total = $data instanceof TList ? $data->getCount() : count($data);
116 116
 		$pageSize = $this->getPageSize();
117
-		if($total < 1)
117
+		if ($total < 1)
118 118
 		{
119 119
 			$param->setData($data);
120 120
 			$this->_prevPageList = null;
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 			return;
123 123
 		}
124 124
 
125
-		if($param->getNewPageIndex() < 1)
125
+		if ($param->getNewPageIndex() < 1)
126 126
 		{
127 127
 			$this->_prevPageList = null;
128
-			if($total <= $pageSize)
128
+			if ($total <= $pageSize)
129 129
 			{
130 130
 				$param->setData($data);
131 131
 				$this->_nextPageList = null;
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
 			else
134 134
 			{
135 135
 				$param->setData(array_slice($data, 0, $pageSize));
136
-				$this->_nextPageList = array_slice($data, $pageSize-1,$total);
136
+				$this->_nextPageList = array_slice($data, $pageSize - 1, $total);
137 137
 			}
138 138
 		}
139 139
 		else
140 140
 		{
141
-			if($total <= $pageSize)
141
+			if ($total <= $pageSize)
142 142
 			{
143 143
 				$this->_prevPageList = array_slice($data, 0, $total);
144 144
 				$param->setData(array());
145 145
 				$this->_nextPageList = null;
146 146
 			}
147
-			else if($total <= $pageSize*2)
147
+			else if ($total <= $pageSize * 2)
148 148
 			{
149 149
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
150 150
 				$param->setData(array_slice($data, $pageSize, $total));
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 			{
155 155
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
156 156
 				$param->setData(array_slice($data, $pageSize, $pageSize));
157
-				$this->_nextPageList = array_slice($data, $pageSize*2, $total-$pageSize*2);
157
+				$this->_nextPageList = array_slice($data, $pageSize * 2, $total - $pageSize * 2);
158 158
 			}
159 159
 		}
160 160
 	}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	{
169 169
 		$index = $param->getNewPageIndex();
170 170
 		$pageSize = $this->getPageSize();
171
-		return $index < 1 ? array($index, $pageSize*2) : array(($index-1)*$pageSize, $pageSize*3);
171
+		return $index < 1 ? array($index, $pageSize * 2) : array(($index - 1) * $pageSize, $pageSize * 3);
172 172
 	}
173 173
 
174 174
 	/**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function getIsNextPageAvailable()
178 178
 	{
179
-		return $this->_nextPageList!==null;
179
+		return $this->_nextPageList !== null;
180 180
 	}
181 181
 
182 182
 	/**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function getIsPreviousPageAvailable()
186 186
 	{
187
-		return $this->_prevPageList!==null;
187
+		return $this->_prevPageList !== null;
188 188
 	}
189 189
 
190 190
 	/**
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function getIsLastPage()
194 194
 	{
195
-		return ($this->_nextPageList===null) || $this->_nextPageList->getCount() < 1;
195
+		return ($this->_nextPageList === null) || $this->_nextPageList->getCount() < 1;
196 196
 	}
197 197
 
198 198
 	/**
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -129,28 +129,24 @@
 block discarded – undo
129 129
 			{
130 130
 				$param->setData($data);
131 131
 				$this->_nextPageList = null;
132
-			}
133
-			else
132
+			} else
134 133
 			{
135 134
 				$param->setData(array_slice($data, 0, $pageSize));
136 135
 				$this->_nextPageList = array_slice($data, $pageSize-1,$total);
137 136
 			}
138
-		}
139
-		else
137
+		} else
140 138
 		{
141 139
 			if($total <= $pageSize)
142 140
 			{
143 141
 				$this->_prevPageList = array_slice($data, 0, $total);
144 142
 				$param->setData(array());
145 143
 				$this->_nextPageList = null;
146
-			}
147
-			else if($total <= $pageSize*2)
144
+			} else if($total <= $pageSize*2)
148 145
 			{
149 146
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
150 147
 				$param->setData(array_slice($data, $pageSize, $total));
151 148
 				$this->_nextPageList = null;
152
-			}
153
-			else
149
+			} else
154 150
 			{
155 151
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
156 152
 				$param->setData(array_slice($data, $pageSize, $pageSize));
Please login to merge, or discard this patch.