Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Data/SqlMap/TSqlMapManager.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function getTypeHandlers()
95 95
 	{
96
-		if($this->_typeHandlers === null)
96
+		if ($this->_typeHandlers === null)
97 97
 			$this->_typeHandlers = new TSqlMapTypeHandlerRegistry();
98 98
 		return $this->_typeHandlers;
99 99
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function getSqlmapGateway()
105 105
 	{
106
-		if($this->_gateway === null)
106
+		if ($this->_gateway === null)
107 107
 			$this->_gateway = $this->createSqlMapGateway();
108 108
 		return $this->_gateway;
109 109
 	}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function getCacheDependencies()
126 126
 	{
127
-		if($this->_cacheDependencies === null)
127
+		if ($this->_cacheDependencies === null)
128 128
 			$this->_cacheDependencies = new TChainedCacheDependency();
129 129
 
130 130
 		return $this->_cacheDependencies;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public function getMappedStatement($name)
158 158
 	{
159
-		if($this->_mappedStatements->contains($name) == false)
159
+		if ($this->_mappedStatements->contains($name) == false)
160 160
 			throw new TSqlMapUndefinedException('sqlmap_contains_no_statement', $name);
161 161
 		return $this->_mappedStatements[$name];
162 162
 	}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	public function addMappedStatement(IMappedStatement $statement)
171 171
 	{
172 172
 		$key = $statement->getID();
173
-		if($this->_mappedStatements->contains($key) == true)
173
+		if ($this->_mappedStatements->contains($key) == true)
174 174
 			throw new TSqlMapDuplicateException('sqlmap_already_contains_statement', $key);
175 175
 		$this->_mappedStatements->add($key, $statement);
176 176
 	}
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function getResultMap($name)
193 193
 	{
194
-		if($this->_resultMaps->contains($name) == false)
194
+		if ($this->_resultMaps->contains($name) == false)
195 195
 			throw new TSqlMapUndefinedException('sqlmap_contains_no_result_map', $name);
196 196
 		return $this->_resultMaps[$name];
197 197
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	public function addResultMap(TResultMap $result)
204 204
 	{
205 205
 		$key = $result->getID();
206
-		if($this->_resultMaps->contains($key) == true)
206
+		if ($this->_resultMaps->contains($key) == true)
207 207
 			throw new TSqlMapDuplicateException('sqlmap_already_contains_result_map', $key);
208 208
 		$this->_resultMaps->add($key, $result);
209 209
 	}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public function getParameterMap($name)
225 225
 	{
226
-		if($this->_parameterMaps->contains($name) == false)
226
+		if ($this->_parameterMaps->contains($name) == false)
227 227
 			throw new TSqlMapUndefinedException('sqlmap_contains_no_parameter_map', $name);
228 228
 		return $this->_parameterMaps[$name];
229 229
 	}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	public function addParameterMap(TParameterMap $parameter)
236 236
 	{
237 237
 		$key = $parameter->getID();
238
-		if($this->_parameterMaps->contains($key) == true)
238
+		if ($this->_parameterMaps->contains($key) == true)
239 239
 			throw new TSqlMapDuplicateException('sqlmap_already_contains_parameter_map', $key);
240 240
 		$this->_parameterMaps->add($key, $parameter);
241 241
 	}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function addCacheModel(TSqlMapCacheModel $cacheModel)
249 249
 	{
250
-		if($this->_cacheModels->contains($cacheModel->getID()))
250
+		if ($this->_cacheModels->contains($cacheModel->getID()))
251 251
 			throw new TSqlMapConfigurationException('sqlmap_cache_model_already_exists', $cacheModel->getID());
252 252
 		else
253 253
 			$this->_cacheModels->add($cacheModel->getID(), $cacheModel);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function getCacheModel($name)
263 263
 	{
264
-		if(!$this->_cacheModels->contains($name))
264
+		if (!$this->_cacheModels->contains($name))
265 265
 			throw new TSqlMapConfigurationException('sqlmap_unable_to_find_cache_model', $name);
266 266
 		return $this->_cacheModels[$name];
267 267
 	}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	public function flushCacheModels()
273 273
 	{
274
-		foreach($this->_cacheModels as $cache)
274
+		foreach ($this->_cacheModels as $cache)
275 275
 			$cache->flush();
276 276
 	}
277 277
 }
Please login to merge, or discard this patch.
Braces   +38 added lines, -26 removed lines patch added patch discarded remove patch
@@ -93,8 +93,9 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function getTypeHandlers()
95 95
 	{
96
-		if($this->_typeHandlers === null)
97
-			$this->_typeHandlers = new TSqlMapTypeHandlerRegistry();
96
+		if($this->_typeHandlers === null) {
97
+					$this->_typeHandlers = new TSqlMapTypeHandlerRegistry();
98
+		}
98 99
 		return $this->_typeHandlers;
99 100
 	}
100 101
 
@@ -103,8 +104,9 @@  discard block
 block discarded – undo
103 104
 	 */
104 105
 	public function getSqlmapGateway()
105 106
 	{
106
-		if($this->_gateway === null)
107
-			$this->_gateway = $this->createSqlMapGateway();
107
+		if($this->_gateway === null) {
108
+					$this->_gateway = $this->createSqlMapGateway();
109
+		}
108 110
 		return $this->_gateway;
109 111
 	}
110 112
 
@@ -124,8 +126,9 @@  discard block
 block discarded – undo
124 126
 	 */
125 127
 	public function getCacheDependencies()
126 128
 	{
127
-		if($this->_cacheDependencies === null)
128
-			$this->_cacheDependencies = new TChainedCacheDependency();
129
+		if($this->_cacheDependencies === null) {
130
+					$this->_cacheDependencies = new TChainedCacheDependency();
131
+		}
129 132
 
130 133
 		return $this->_cacheDependencies;
131 134
 	}
@@ -156,8 +159,9 @@  discard block
 block discarded – undo
156 159
 	 */
157 160
 	public function getMappedStatement($name)
158 161
 	{
159
-		if($this->_mappedStatements->contains($name) == false)
160
-			throw new TSqlMapUndefinedException('sqlmap_contains_no_statement', $name);
162
+		if($this->_mappedStatements->contains($name) == false) {
163
+					throw new TSqlMapUndefinedException('sqlmap_contains_no_statement', $name);
164
+		}
161 165
 		return $this->_mappedStatements[$name];
162 166
 	}
163 167
 
@@ -170,8 +174,9 @@  discard block
 block discarded – undo
170 174
 	public function addMappedStatement(IMappedStatement $statement)
171 175
 	{
172 176
 		$key = $statement->getID();
173
-		if($this->_mappedStatements->contains($key) == true)
174
-			throw new TSqlMapDuplicateException('sqlmap_already_contains_statement', $key);
177
+		if($this->_mappedStatements->contains($key) == true) {
178
+					throw new TSqlMapDuplicateException('sqlmap_already_contains_statement', $key);
179
+		}
175 180
 		$this->_mappedStatements->add($key, $statement);
176 181
 	}
177 182
 
@@ -191,8 +196,9 @@  discard block
 block discarded – undo
191 196
 	 */
192 197
 	public function getResultMap($name)
193 198
 	{
194
-		if($this->_resultMaps->contains($name) == false)
195
-			throw new TSqlMapUndefinedException('sqlmap_contains_no_result_map', $name);
199
+		if($this->_resultMaps->contains($name) == false) {
200
+					throw new TSqlMapUndefinedException('sqlmap_contains_no_result_map', $name);
201
+		}
196 202
 		return $this->_resultMaps[$name];
197 203
 	}
198 204
 
@@ -203,8 +209,9 @@  discard block
 block discarded – undo
203 209
 	public function addResultMap(TResultMap $result)
204 210
 	{
205 211
 		$key = $result->getID();
206
-		if($this->_resultMaps->contains($key) == true)
207
-			throw new TSqlMapDuplicateException('sqlmap_already_contains_result_map', $key);
212
+		if($this->_resultMaps->contains($key) == true) {
213
+					throw new TSqlMapDuplicateException('sqlmap_already_contains_result_map', $key);
214
+		}
208 215
 		$this->_resultMaps->add($key, $result);
209 216
 	}
210 217
 
@@ -223,8 +230,9 @@  discard block
 block discarded – undo
223 230
 	 */
224 231
 	public function getParameterMap($name)
225 232
 	{
226
-		if($this->_parameterMaps->contains($name) == false)
227
-			throw new TSqlMapUndefinedException('sqlmap_contains_no_parameter_map', $name);
233
+		if($this->_parameterMaps->contains($name) == false) {
234
+					throw new TSqlMapUndefinedException('sqlmap_contains_no_parameter_map', $name);
235
+		}
228 236
 		return $this->_parameterMaps[$name];
229 237
 	}
230 238
 
@@ -235,8 +243,9 @@  discard block
 block discarded – undo
235 243
 	public function addParameterMap(TParameterMap $parameter)
236 244
 	{
237 245
 		$key = $parameter->getID();
238
-		if($this->_parameterMaps->contains($key) == true)
239
-			throw new TSqlMapDuplicateException('sqlmap_already_contains_parameter_map', $key);
246
+		if($this->_parameterMaps->contains($key) == true) {
247
+					throw new TSqlMapDuplicateException('sqlmap_already_contains_parameter_map', $key);
248
+		}
240 249
 		$this->_parameterMaps->add($key, $parameter);
241 250
 	}
242 251
 
@@ -247,10 +256,11 @@  discard block
 block discarded – undo
247 256
 	 */
248 257
 	public function addCacheModel(TSqlMapCacheModel $cacheModel)
249 258
 	{
250
-		if($this->_cacheModels->contains($cacheModel->getID()))
251
-			throw new TSqlMapConfigurationException('sqlmap_cache_model_already_exists', $cacheModel->getID());
252
-		else
253
-			$this->_cacheModels->add($cacheModel->getID(), $cacheModel);
259
+		if($this->_cacheModels->contains($cacheModel->getID())) {
260
+					throw new TSqlMapConfigurationException('sqlmap_cache_model_already_exists', $cacheModel->getID());
261
+		} else {
262
+					$this->_cacheModels->add($cacheModel->getID(), $cacheModel);
263
+		}
254 264
 	}
255 265
 
256 266
 	/**
@@ -261,8 +271,9 @@  discard block
 block discarded – undo
261 271
 	 */
262 272
 	public function getCacheModel($name)
263 273
 	{
264
-		if(!$this->_cacheModels->contains($name))
265
-			throw new TSqlMapConfigurationException('sqlmap_unable_to_find_cache_model', $name);
274
+		if(!$this->_cacheModels->contains($name)) {
275
+					throw new TSqlMapConfigurationException('sqlmap_unable_to_find_cache_model', $name);
276
+		}
266 277
 		return $this->_cacheModels[$name];
267 278
 	}
268 279
 
@@ -271,8 +282,9 @@  discard block
 block discarded – undo
271 282
 	 */
272 283
 	public function flushCacheModels()
273 284
 	{
274
-		foreach($this->_cacheModels as $cache)
275
-			$cache->flush();
285
+		foreach($this->_cacheModels as $cache) {
286
+					$cache->flush();
287
+		}
276 288
 	}
277 289
 }
278 290
 
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
 	{
79 79
 		static $stack = [];
80 80
 
81
-		$results = call_user_func_array([$this->getSourceRecord(),$method], $args);
81
+		$results = call_user_func_array([$this->getSourceRecord(), $method], $args);
82 82
 		$validArray = is_array($results) && count($results) > 0;
83
-		if($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord)
83
+		if ($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord)
84 84
 		{
85 85
 			$this->collectForeignObjects($results);
86
-			while($obj = array_pop($stack))
86
+			while ($obj = array_pop($stack))
87 87
 				$obj->collectForeignObjects($results);
88 88
 		}
89
-		elseif($results instanceof TActiveRecordRelation)
89
+		elseif ($results instanceof TActiveRecordRelation)
90 90
 			$stack[] = $this; //call it later
91
-		elseif($results === null || !$validArray)
91
+		elseif ($results === null || !$validArray)
92 92
 			$stack = [];
93 93
 		return $results;
94 94
 	}
@@ -118,17 +118,17 @@  discard block
 block discarded – undo
118 118
 		$matchingTableName = strtolower($recordTableInfo->getTableName());
119 119
 		$matchingFullTableName = strtolower($recordTableInfo->getTableFullName());
120 120
 		$tableInfo = $from;
121
-		if($from instanceof TActiveRecord)
121
+		if ($from instanceof TActiveRecord)
122 122
 			$tableInfo = $gateway->getRecordTableInfo($from);
123 123
 		//find first non-empty FK
124
-		foreach($tableInfo->getForeignKeys() as $fkeys)
124
+		foreach ($tableInfo->getForeignKeys() as $fkeys)
125 125
 		{
126 126
 			$fkTable = strtolower($fkeys['table']);
127
-			if($fkTable === $matchingTableName || $fkTable === $matchingFullTableName)
127
+			if ($fkTable === $matchingTableName || $fkTable === $matchingFullTableName)
128 128
 			{
129 129
 				$hasFkField = !$loose && $this->getContext()->hasFkField();
130 130
 				$key = $hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys'];
131
-				if(!empty($key))
131
+				if (!empty($key))
132 132
 					return $key;
133 133
 			}
134 134
 		}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 		$matching = [];
156 156
 		preg_match_all('/\s*(\S+\.)?([\w-]+)\s*/', $this->getContext()->getFkField(), $matching);
157 157
 		$fields = [];
158
-		foreach($fkeys as $fkName => $field)
158
+		foreach ($fkeys as $fkName => $field)
159 159
 		{
160
-			if(in_array($fkName, $matching[2]))
160
+			if (in_array($fkName, $matching[2]))
161 161
 				$fields[$fkName] = $field;
162 162
 		}
163 163
 		return $fields;
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	protected function getObjectHash($obj, $properties)
172 172
 	{
173 173
 		$ids = [];
174
-		foreach($properties as $property)
175
-			$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
174
+		foreach ($properties as $property)
175
+			$ids[] = is_object($obj) ? (string) $obj->getColumnValue($property) : (string) $obj[$property];
176 176
 		return serialize($ids);
177 177
 	}
178 178
 
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	protected function getIndexValues($keys, $results)
198 198
 	{
199
-		if(!is_array($results) && !$results instanceof \ArrayAccess)
199
+		if (!is_array($results) && !$results instanceof \ArrayAccess)
200 200
 			$results = [$results];
201 201
 		$values = [];
202
-		foreach($results as $result)
202
+		foreach ($results as $result)
203 203
 		{
204 204
 			$value = [];
205
-			foreach($keys as $name)
205
+			foreach ($keys as $name)
206 206
 				$value[] = $result->getColumnValue($name);
207 207
 			$values[] = $value;
208 208
 		}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	protected function populateResult(&$results, $properties, &$fkObjects, $fields)
220 220
 	{
221 221
 		$collections = [];
222
-		foreach($fkObjects as $fkObject)
222
+		foreach ($fkObjects as $fkObject)
223 223
 			$collections[$this->getObjectHash($fkObject, $fields)][] = $fkObject;
224 224
 		$this->setResultCollection($results, $collections, $properties);
225 225
 	}
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	protected function setResultCollection(&$results, &$collections, $properties)
234 234
 	{
235
-		if(is_array($results) || $results instanceof \ArrayAccess)
235
+		if (is_array($results) || $results instanceof \ArrayAccess)
236 236
 		{
237
-			for($i = 0,$k = count($results);$i < $k;$i++)
237
+			for ($i = 0, $k = count($results); $i < $k; $i++)
238 238
 				$this->setObjectProperty($results[$i], $properties, $collections);
239 239
 		}
240 240
 		else
Please login to merge, or discard this patch.
Braces   +35 added lines, -24 removed lines patch added patch discarded remove patch
@@ -83,13 +83,16 @@  discard block
 block discarded – undo
83 83
 		if($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord)
84 84
 		{
85 85
 			$this->collectForeignObjects($results);
86
-			while($obj = array_pop($stack))
87
-				$obj->collectForeignObjects($results);
86
+			while($obj = array_pop($stack)) {
87
+							$obj->collectForeignObjects($results);
88
+			}
89
+		} elseif($results instanceof TActiveRecordRelation) {
90
+					$stack[] = $this;
91
+		}
92
+		//call it later
93
+		elseif($results === null || !$validArray) {
94
+					$stack = [];
88 95
 		}
89
-		elseif($results instanceof TActiveRecordRelation)
90
-			$stack[] = $this; //call it later
91
-		elseif($results === null || !$validArray)
92
-			$stack = [];
93 96
 		return $results;
94 97
 	}
95 98
 
@@ -118,8 +121,9 @@  discard block
 block discarded – undo
118 121
 		$matchingTableName = strtolower($recordTableInfo->getTableName());
119 122
 		$matchingFullTableName = strtolower($recordTableInfo->getTableFullName());
120 123
 		$tableInfo = $from;
121
-		if($from instanceof TActiveRecord)
122
-			$tableInfo = $gateway->getRecordTableInfo($from);
124
+		if($from instanceof TActiveRecord) {
125
+					$tableInfo = $gateway->getRecordTableInfo($from);
126
+		}
123 127
 		//find first non-empty FK
124 128
 		foreach($tableInfo->getForeignKeys() as $fkeys)
125 129
 		{
@@ -128,8 +132,9 @@  discard block
 block discarded – undo
128 132
 			{
129 133
 				$hasFkField = !$loose && $this->getContext()->hasFkField();
130 134
 				$key = $hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys'];
131
-				if(!empty($key))
132
-					return $key;
135
+				if(!empty($key)) {
136
+									return $key;
137
+				}
133 138
 			}
134 139
 		}
135 140
 
@@ -157,8 +162,9 @@  discard block
 block discarded – undo
157 162
 		$fields = [];
158 163
 		foreach($fkeys as $fkName => $field)
159 164
 		{
160
-			if(in_array($fkName, $matching[2]))
161
-				$fields[$fkName] = $field;
165
+			if(in_array($fkName, $matching[2])) {
166
+							$fields[$fkName] = $field;
167
+			}
162 168
 		}
163 169
 		return $fields;
164 170
 	}
@@ -171,8 +177,9 @@  discard block
 block discarded – undo
171 177
 	protected function getObjectHash($obj, $properties)
172 178
 	{
173 179
 		$ids = [];
174
-		foreach($properties as $property)
175
-			$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
180
+		foreach($properties as $property) {
181
+					$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
182
+		}
176 183
 		return serialize($ids);
177 184
 	}
178 185
 
@@ -196,14 +203,16 @@  discard block
 block discarded – undo
196 203
 	 */
197 204
 	protected function getIndexValues($keys, $results)
198 205
 	{
199
-		if(!is_array($results) && !$results instanceof \ArrayAccess)
200
-			$results = [$results];
206
+		if(!is_array($results) && !$results instanceof \ArrayAccess) {
207
+					$results = [$results];
208
+		}
201 209
 		$values = [];
202 210
 		foreach($results as $result)
203 211
 		{
204 212
 			$value = [];
205
-			foreach($keys as $name)
206
-				$value[] = $result->getColumnValue($name);
213
+			foreach($keys as $name) {
214
+							$value[] = $result->getColumnValue($name);
215
+			}
207 216
 			$values[] = $value;
208 217
 		}
209 218
 		return $values;
@@ -219,8 +228,9 @@  discard block
 block discarded – undo
219 228
 	protected function populateResult(&$results, $properties, &$fkObjects, $fields)
220 229
 	{
221 230
 		$collections = [];
222
-		foreach($fkObjects as $fkObject)
223
-			$collections[$this->getObjectHash($fkObject, $fields)][] = $fkObject;
231
+		foreach($fkObjects as $fkObject) {
232
+					$collections[$this->getObjectHash($fkObject, $fields)][] = $fkObject;
233
+		}
224 234
 		$this->setResultCollection($results, $collections, $properties);
225 235
 	}
226 236
 
@@ -234,11 +244,12 @@  discard block
 block discarded – undo
234 244
 	{
235 245
 		if(is_array($results) || $results instanceof \ArrayAccess)
236 246
 		{
237
-			for($i = 0,$k = count($results);$i < $k;$i++)
238
-				$this->setObjectProperty($results[$i], $properties, $collections);
247
+			for($i = 0,$k = count($results);$i < $k;$i++) {
248
+							$this->setObjectProperty($results[$i], $properties, $collections);
249
+			}
250
+		} else {
251
+					$this->setObjectProperty($results, $properties, $collections);
239 252
 		}
240
-		else
241
-			$this->setObjectProperty($results, $properties, $collections);
242 253
 	}
243 254
 
244 255
 	/**
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function getRelationForeignKeys()
83 83
 	{
84
-		if($this->_fkeys === null)
84
+		if ($this->_fkeys === null)
85 85
 			$this->_fkeys = $this->getRelationHandler()->getRelationForeignKeys();
86 86
 		return $this->_fkeys;
87 87
 	}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function getCondition()
119 119
 	{
120
-		return isset($this->_relation[3])?$this->_relation[3]:null;
120
+		return isset($this->_relation[3]) ? $this->_relation[3] : null;
121 121
 	}
122 122
 
123 123
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function getParameters()
128 128
 	{
129
-		return isset($this->_relation[4])?$this->_relation[4]:[];
129
+		return isset($this->_relation[4]) ? $this->_relation[4] : [];
130 130
 	}
131 131
 
132 132
 	/**
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function getRelationHandler($criteria = null)
176 176
 	{
177
-		if(!$this->hasRecordRelation())
177
+		if (!$this->hasRecordRelation())
178 178
 		{
179 179
 			throw new TActiveRecordException('ar_undefined_relation_prop',
180 180
 				$this->_property, get_class($this->_record), 'RELATIONS');
181 181
 		}
182
-		if($criteria === null)
182
+		if ($criteria === null)
183 183
 			$criteria = new TActiveRecordCriteria($this->getCondition(), $this->getParameters());
184
-		switch($this->getRelationType())
184
+		switch ($this->getRelationType())
185 185
 		{
186 186
 			case TActiveRecord::HAS_MANY:
187 187
 				return new TActiveRecordHasMany($this, $criteria);
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	public function updateAssociatedRecords($updateBelongsTo = false)
203 203
 	{
204 204
 		$success = true;
205
-		foreach($this->_record->getRecordRelations() as $data)
205
+		foreach ($this->_record->getRecordRelations() as $data)
206 206
 		{
207 207
 			list($property, $relation) = $data;
208 208
 			$belongsTo = $relation[0] == TActiveRecord::BELONGS_TO;
209
-			if(($updateBelongsTo && $belongsTo) || (!$updateBelongsTo && !$belongsTo))
209
+			if (($updateBelongsTo && $belongsTo) || (!$updateBelongsTo && !$belongsTo))
210 210
 			{
211 211
 				$obj = $this->getSourceRecord();
212
-				if(!$this->isEmptyFkObject($obj->getColumnValue($property)))
212
+				if (!$this->isEmptyFkObject($obj->getColumnValue($property)))
213 213
 				{
214 214
 					$context = new TActiveRecordRelationContext($this->getSourceRecord(), $property, $relation);
215 215
 					$success = $context->getRelationHandler()->updateAssociatedRecords() && $success;
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 
222 222
 	protected function isEmptyFkObject($obj)
223 223
 	{
224
-		if(is_object($obj))
224
+		if (is_object($obj))
225 225
 			return $obj instanceof TList ? $obj->count() === 0 : false;
226
-		elseif(is_array($obj))
226
+		elseif (is_array($obj))
227 227
 			return count($obj) === 0;
228 228
 		else
229 229
 			return empty($obj);
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function getRelationForeignKeys()
83 83
 	{
84
-		if($this->_fkeys === null)
85
-			$this->_fkeys = $this->getRelationHandler()->getRelationForeignKeys();
84
+		if($this->_fkeys === null) {
85
+					$this->_fkeys = $this->getRelationHandler()->getRelationForeignKeys();
86
+		}
86 87
 		return $this->_fkeys;
87 88
 	}
88 89
 
@@ -179,8 +180,9 @@  discard block
 block discarded – undo
179 180
 			throw new TActiveRecordException('ar_undefined_relation_prop',
180 181
 				$this->_property, get_class($this->_record), 'RELATIONS');
181 182
 		}
182
-		if($criteria === null)
183
-			$criteria = new TActiveRecordCriteria($this->getCondition(), $this->getParameters());
183
+		if($criteria === null) {
184
+					$criteria = new TActiveRecordCriteria($this->getCondition(), $this->getParameters());
185
+		}
184 186
 		switch($this->getRelationType())
185 187
 		{
186 188
 			case TActiveRecord::HAS_MANY:
@@ -221,12 +223,13 @@  discard block
 block discarded – undo
221 223
 
222 224
 	protected function isEmptyFkObject($obj)
223 225
 	{
224
-		if(is_object($obj))
225
-			return $obj instanceof TList ? $obj->count() === 0 : false;
226
-		elseif(is_array($obj))
227
-			return count($obj) === 0;
228
-		else
229
-			return empty($obj);
226
+		if(is_object($obj)) {
227
+					return $obj instanceof TList ? $obj->count() === 0 : false;
228
+		} elseif(is_array($obj)) {
229
+					return count($obj) === 0;
230
+		} else {
231
+					return empty($obj);
232
+		}
230 233
 	}
231 234
 }
232 235
 
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function getAssociationTable()
123 123
 	{
124
-		if($this->_association === null)
124
+		if ($this->_association === null)
125 125
 		{
126 126
 			$gateway = $this->getSourceRecord()->getRecordGateway();
127 127
 			$conn = $this->getSourceRecord()->getDbConnection();
128 128
 			//table name may include the fk column name separated with a dot.
129 129
 			$table = explode('.', $this->getContext()->getAssociationTable());
130
-			if(count($table) > 1)
130
+			if (count($table) > 1)
131 131
 			{
132 132
 				$columns = preg_replace('/^\((.*)\)/', '\1', $table[1]);
133 133
 				$this->_association_columns = preg_split('/\s*[, ]\*/', $columns);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function getSourceTable()
144 144
 	{
145
-		if($this->_sourceTable === null)
145
+		if ($this->_sourceTable === null)
146 146
 		{
147 147
 			$gateway = $this->getSourceRecord()->getRecordGateway();
148 148
 			$this->_sourceTable = $gateway->getRecordTableInfo($this->getSourceRecord());
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	protected function getForeignTable()
157 157
 	{
158
-		if($this->_foreignTable === null)
158
+		if ($this->_foreignTable === null)
159 159
 		{
160 160
 			$gateway = $this->getSourceRecord()->getRecordGateway();
161 161
 			$fkObject = $this->getContext()->getForeignRecordFinder();
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 		$command = $this->createCommand($criteria, $foreignKeys, $indexValues, $sourceKeys);
196 196
 		$srcProps = array_keys($sourceKeys);
197 197
 		$collections = [];
198
-		foreach($this->getCommandBuilder()->onExecuteCommand($command, $command->query()) as $row)
198
+		foreach ($this->getCommandBuilder()->onExecuteCommand($command, $command->query()) as $row)
199 199
 		{
200 200
 			$hash = $this->getObjectHash($row, $srcProps);
201
-			foreach($srcProps as $column)
201
+			foreach ($srcProps as $column)
202 202
 				unset($row[$column]);
203 203
 			$obj = $this->createFkObject($type, $row, $foreignKeys);
204 204
 			$collections[$hash][] = $obj;
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 	protected function createFkObject($type, $row, $foreignKeys)
216 216
 	{
217 217
 		$obj = TActiveRecord::createRecord($type, $row);
218
-		if(count($this->_association_columns) > 0)
218
+		if (count($this->_association_columns) > 0)
219 219
 		{
220 220
 			$i = 0;
221
-			foreach($foreignKeys as $ref => $fk)
221
+			foreach ($foreignKeys as $ref => $fk)
222 222
 				$obj->setColumnValue($ref, $row[$this->_association_columns[$i++]]);
223 223
 		}
224 224
 		return $obj;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		$innerJoin = $this->getAssociationJoin($foreignKeys, $indexValues, $sourceKeys);
236 236
 		$fkTable = $this->getForeignTable()->getTableFullName();
237 237
 		$srcColumns = $this->getSourceColumns($sourceKeys);
238
-		if(($where = $criteria->getCondition()) === null)
238
+		if (($where = $criteria->getCondition()) === null)
239 239
 			$where = '1=1';
240 240
 		$sql = "SELECT {$fkTable}.*, {$srcColumns} FROM {$fkTable} {$innerJoin} WHERE {$where}";
241 241
 
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 		$table = $this->getAssociationTable();
261 261
 		$tableName = $table->getTableFullName();
262 262
 		$columnNames = array_merge(array_keys($sourceKeys), $this->_association_columns);
263
-		foreach($columnNames as $name)
264
-			$columns[] = $tableName . '.' . $table->getColumn($name)->getColumnName();
263
+		foreach ($columnNames as $name)
264
+			$columns[] = $tableName.'.'.$table->getColumn($name)->getColumnName();
265 265
 		return implode(', ', $columns);
266 266
 	}
267 267
 
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 		$joins = [];
284 284
 		$hasAssociationColumns = count($this->_association_columns) > 0;
285 285
 		$i = 0;
286
-		foreach($foreignKeys as $ref => $fk)
286
+		foreach ($foreignKeys as $ref => $fk)
287 287
 		{
288
-			if($hasAssociationColumns)
288
+			if ($hasAssociationColumns)
289 289
 				$refField = $refInfo->getColumn($this->_association_columns[$i++])->getColumnName();
290 290
 			else
291 291
 				$refField = $refInfo->getColumn($ref)->getColumnName();
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
 		$obj = $this->getContext()->getSourceRecord();
307 307
 		$fkObjects = &$obj->{$this->getContext()->getProperty()};
308 308
 		$success = true;
309
-		if(($total = count($fkObjects)) > 0)
309
+		if (($total = count($fkObjects)) > 0)
310 310
 		{
311 311
 			$source = $this->getSourceRecord();
312 312
 			$builder = $this->getAssociationTableCommandBuilder();
313
-			for($i = 0;$i < $total;$i++)
313
+			for ($i = 0; $i < $total; $i++)
314 314
 				$success = $fkObjects[$i]->save() && $success;
315 315
 			return $this->updateAssociationTable($obj, $fkObjects, $builder) && $success;
316 316
 		}
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	{
331 331
 		$condition = [];
332 332
 		$table = $this->getAssociationTable();
333
-		foreach($data as $name => $value)
334
-			$condition[] = $table->getColumn($name)->getColumnName() . ' = ?';
333
+		foreach ($data as $name => $value)
334
+			$condition[] = $table->getColumn($name)->getColumnName().' = ?';
335 335
 		$command = $builder->createCountCommand(implode(' AND ', $condition), array_values($data));
336 336
 		$result = $this->getCommandBuilder()->onExecuteCommand($command, intval($command->queryScalar()));
337 337
 		return intval($result) > 0;
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 		$source = $this->getSourceRecordValues($obj);
349 349
 		$foreignKeys = $this->findForeignKeys($this->getAssociationTable(), $fkObjects[0]);
350 350
 		$success = true;
351
-		foreach($fkObjects as $fkObject)
351
+		foreach ($fkObjects as $fkObject)
352 352
 		{
353 353
 			$data = array_merge($source, $this->getForeignObjectValues($foreignKeys, $fkObject));
354
-			if(!$this->hasAssociationData($builder, $data))
354
+			if (!$this->hasAssociationData($builder, $data))
355 355
 				$success = $this->addAssociationData($builder, $data) && $success;
356 356
 		}
357 357
 		return $success;
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		$indexValues = $this->getIndexValues(array_values($sourceKeys), $obj);
364 364
 		$data = [];
365 365
 		$i = 0;
366
-		foreach($sourceKeys as $name => $srcKey)
366
+		foreach ($sourceKeys as $name => $srcKey)
367 367
 			$data[$name] = $indexValues[0][$i++];
368 368
 		return $data;
369 369
 	}
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	private function getForeignObjectValues($foreignKeys, $fkObject)
372 372
 	{
373 373
 		$data = [];
374
-		foreach($foreignKeys as $name => $fKey)
374
+		foreach ($foreignKeys as $name => $fKey)
375 375
 			$data[$name] = $fkObject->getColumnValue($fKey);
376 376
 		return $data;
377 377
 	}
Please login to merge, or discard this patch.
Braces   +32 added lines, -22 removed lines patch added patch discarded remove patch
@@ -198,8 +198,9 @@  discard block
 block discarded – undo
198 198
 		foreach($this->getCommandBuilder()->onExecuteCommand($command, $command->query()) as $row)
199 199
 		{
200 200
 			$hash = $this->getObjectHash($row, $srcProps);
201
-			foreach($srcProps as $column)
202
-				unset($row[$column]);
201
+			foreach($srcProps as $column) {
202
+							unset($row[$column]);
203
+			}
203 204
 			$obj = $this->createFkObject($type, $row, $foreignKeys);
204 205
 			$collections[$hash][] = $obj;
205 206
 		}
@@ -218,8 +219,9 @@  discard block
 block discarded – undo
218 219
 		if(count($this->_association_columns) > 0)
219 220
 		{
220 221
 			$i = 0;
221
-			foreach($foreignKeys as $ref => $fk)
222
-				$obj->setColumnValue($ref, $row[$this->_association_columns[$i++]]);
222
+			foreach($foreignKeys as $ref => $fk) {
223
+							$obj->setColumnValue($ref, $row[$this->_association_columns[$i++]]);
224
+			}
223 225
 		}
224 226
 		return $obj;
225 227
 	}
@@ -235,8 +237,9 @@  discard block
 block discarded – undo
235 237
 		$innerJoin = $this->getAssociationJoin($foreignKeys, $indexValues, $sourceKeys);
236 238
 		$fkTable = $this->getForeignTable()->getTableFullName();
237 239
 		$srcColumns = $this->getSourceColumns($sourceKeys);
238
-		if(($where = $criteria->getCondition()) === null)
239
-			$where = '1=1';
240
+		if(($where = $criteria->getCondition()) === null) {
241
+					$where = '1=1';
242
+		}
240 243
 		$sql = "SELECT {$fkTable}.*, {$srcColumns} FROM {$fkTable} {$innerJoin} WHERE {$where}";
241 244
 
242 245
 		$parameters = $criteria->getParameters()->toArray();
@@ -260,8 +263,9 @@  discard block
 block discarded – undo
260 263
 		$table = $this->getAssociationTable();
261 264
 		$tableName = $table->getTableFullName();
262 265
 		$columnNames = array_merge(array_keys($sourceKeys), $this->_association_columns);
263
-		foreach($columnNames as $name)
264
-			$columns[] = $tableName . '.' . $table->getColumn($name)->getColumnName();
266
+		foreach($columnNames as $name) {
267
+					$columns[] = $tableName . '.' . $table->getColumn($name)->getColumnName();
268
+		}
265 269
 		return implode(', ', $columns);
266 270
 	}
267 271
 
@@ -285,10 +289,11 @@  discard block
 block discarded – undo
285 289
 		$i = 0;
286 290
 		foreach($foreignKeys as $ref => $fk)
287 291
 		{
288
-			if($hasAssociationColumns)
289
-				$refField = $refInfo->getColumn($this->_association_columns[$i++])->getColumnName();
290
-			else
291
-				$refField = $refInfo->getColumn($ref)->getColumnName();
292
+			if($hasAssociationColumns) {
293
+							$refField = $refInfo->getColumn($this->_association_columns[$i++])->getColumnName();
294
+			} else {
295
+							$refField = $refInfo->getColumn($ref)->getColumnName();
296
+			}
292 297
 			$fkField = $fkInfo->getColumn($fk)->getColumnName();
293 298
 			$joins[] = "{$fkTable}.{$fkField} = {$refTable}.{$refField}";
294 299
 		}
@@ -310,8 +315,9 @@  discard block
 block discarded – undo
310 315
 		{
311 316
 			$source = $this->getSourceRecord();
312 317
 			$builder = $this->getAssociationTableCommandBuilder();
313
-			for($i = 0;$i < $total;$i++)
314
-				$success = $fkObjects[$i]->save() && $success;
318
+			for($i = 0;$i < $total;$i++) {
319
+							$success = $fkObjects[$i]->save() && $success;
320
+			}
315 321
 			return $this->updateAssociationTable($obj, $fkObjects, $builder) && $success;
316 322
 		}
317 323
 		return $success;
@@ -330,8 +336,9 @@  discard block
 block discarded – undo
330 336
 	{
331 337
 		$condition = [];
332 338
 		$table = $this->getAssociationTable();
333
-		foreach($data as $name => $value)
334
-			$condition[] = $table->getColumn($name)->getColumnName() . ' = ?';
339
+		foreach($data as $name => $value) {
340
+					$condition[] = $table->getColumn($name)->getColumnName() . ' = ?';
341
+		}
335 342
 		$command = $builder->createCountCommand(implode(' AND ', $condition), array_values($data));
336 343
 		$result = $this->getCommandBuilder()->onExecuteCommand($command, intval($command->queryScalar()));
337 344
 		return intval($result) > 0;
@@ -351,8 +358,9 @@  discard block
 block discarded – undo
351 358
 		foreach($fkObjects as $fkObject)
352 359
 		{
353 360
 			$data = array_merge($source, $this->getForeignObjectValues($foreignKeys, $fkObject));
354
-			if(!$this->hasAssociationData($builder, $data))
355
-				$success = $this->addAssociationData($builder, $data) && $success;
361
+			if(!$this->hasAssociationData($builder, $data)) {
362
+							$success = $this->addAssociationData($builder, $data) && $success;
363
+			}
356 364
 		}
357 365
 		return $success;
358 366
 	}
@@ -363,16 +371,18 @@  discard block
 block discarded – undo
363 371
 		$indexValues = $this->getIndexValues(array_values($sourceKeys), $obj);
364 372
 		$data = [];
365 373
 		$i = 0;
366
-		foreach($sourceKeys as $name => $srcKey)
367
-			$data[$name] = $indexValues[0][$i++];
374
+		foreach($sourceKeys as $name => $srcKey) {
375
+					$data[$name] = $indexValues[0][$i++];
376
+		}
368 377
 		return $data;
369 378
 	}
370 379
 
371 380
 	private function getForeignObjectValues($foreignKeys, $fkObject)
372 381
 	{
373 382
 		$data = [];
374
-		foreach($foreignKeys as $name => $fKey)
375
-			$data[$name] = $fkObject->getColumnValue($fKey);
383
+		foreach($foreignKeys as $name => $fKey) {
384
+					$data[$name] = $fkObject->getColumnValue($fKey);
385
+		}
376 386
 		return $data;
377 387
 	}
378 388
 }
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 	{
108 108
 		$hash = $this->getObjectHash($source, $properties);
109 109
 		$prop = $this->getContext()->getProperty();
110
-		if(isset($collections[$hash]) && count($collections[$hash]) > 0)
110
+		if (isset($collections[$hash]) && count($collections[$hash]) > 0)
111 111
 		{
112
-			if(count($collections[$hash]) > 1)
112
+			if (count($collections[$hash]) > 1)
113 113
 				throw new TActiveRecordException('ar_belongs_to_multiple_result');
114 114
 			$source->$prop = $collections[$hash][0];
115 115
 		}
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 	{
126 126
 		$obj = $this->getContext()->getSourceRecord();
127 127
 		$fkObject = $obj->getColumnValue($this->getContext()->getProperty());
128
-		if($fkObject !== null)
128
+		if ($fkObject !== null)
129 129
 		{
130 130
 			$fkObject->save();
131 131
 			$source = $this->getSourceRecord();
132 132
 			$fkeys = $this->findForeignKeys($source, $fkObject);
133
-			foreach($fkeys as $srcKey => $fKey)
133
+			foreach ($fkeys as $srcKey => $fKey)
134 134
 				$source->setColumnValue($srcKey, $fkObject->getColumnValue($fKey));
135 135
 			return true;
136 136
 		}
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -109,12 +109,13 @@  discard block
 block discarded – undo
109 109
 		$prop = $this->getContext()->getProperty();
110 110
 		if(isset($collections[$hash]) && count($collections[$hash]) > 0)
111 111
 		{
112
-			if(count($collections[$hash]) > 1)
113
-				throw new TActiveRecordException('ar_belongs_to_multiple_result');
112
+			if(count($collections[$hash]) > 1) {
113
+							throw new TActiveRecordException('ar_belongs_to_multiple_result');
114
+			}
114 115
 			$source->$prop = $collections[$hash][0];
116
+		} else {
117
+					$source->$prop = null;
115 118
 		}
116
-		else
117
-			$source->$prop = null;
118 119
 	}
119 120
 
120 121
 	/**
@@ -130,8 +131,9 @@  discard block
 block discarded – undo
130 131
 			$fkObject->save();
131 132
 			$source = $this->getSourceRecord();
132 133
 			$fkeys = $this->findForeignKeys($source, $fkObject);
133
-			foreach($fkeys as $srcKey => $fKey)
134
-				$source->setColumnValue($srcKey, $fkObject->getColumnValue($fKey));
134
+			foreach($fkeys as $srcKey => $fKey) {
135
+							$source->setColumnValue($srcKey, $fkObject->getColumnValue($fKey));
136
+			}
135 137
 			return true;
136 138
 		}
137 139
 		return false;
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 		$table = $this->getTableInfo();
66 66
 		$sorts = ['Sort By', str_repeat('-', 15)];
67 67
 		$headers = [];
68
-		foreach($table->getColumns() as $name => $colum)
68
+		foreach ($table->getColumns() as $name => $colum)
69 69
 		{
70 70
 			$fname = ucwords(str_replace('_', ' ', $name));
71
-			$sorts[$name . ' ASC'] = $fname . ' Ascending';
72
-			$sorts[$name . ' DESC'] = $fname . ' Descending';
73
-			$headers[] = $fname ;
71
+			$sorts[$name.' ASC'] = $fname.' Ascending';
72
+			$sorts[$name.' DESC'] = $fname.' Descending';
73
+			$headers[] = $fname;
74 74
 		}
75 75
 		$this->_sort->setDataSource($sorts);
76 76
 		$this->_sort->dataBind();
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	public function onPreRender($param)
85 85
 	{
86 86
 		parent::onPreRender($param);
87
-		if(!$this->getPage()->getIsPostBack() || $this->getViewState('CurrentClass') != $this->getRecordClass())
87
+		if (!$this->getPage()->getIsPostBack() || $this->getViewState('CurrentClass') != $this->getRecordClass())
88 88
 		{
89 89
 			$this->initializeSort();
90 90
 			$this->setViewState('CurrentClass', $this->getRecordClass());
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
 		$total = $this->_list->getVirtualItemCount();
114 114
 		$limit = $this->_list->getPageSize();
115 115
 		$offset = $this->_list->getCurrentPageIndex() * $limit;
116
-		if($offset + $limit > $total)
116
+		if ($offset + $limit > $total)
117 117
 			$limit = $total - $offset;
118 118
 		$criteria = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters());
119
-		if($limit > 0)
119
+		if ($limit > 0)
120 120
 		{
121 121
 			$criteria->setLimit($limit);
122
-			if($offset <= $total)
122
+			if ($offset <= $total)
123 123
 				$criteria->setOffset($offset);
124 124
 		}
125 125
 		$order = explode(' ', $this->_sort->getSelectedValue(), 2);
126
-		if(is_array($order) && count($order) === 2)
126
+		if (is_array($order) && count($order) === 2)
127 127
 			$criteria->OrdersBy[$order[0]] = $order[1];
128 128
 		return $criteria;
129 129
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	public function bubbleEvent($sender, $param)
167 167
 	{
168
-		switch(strtolower($param->getCommandName()))
168
+		switch (strtolower($param->getCommandName()))
169 169
 		{
170 170
 			case 'delete':
171 171
 				return $this->deleteRecord($sender, $param);
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	protected function initializeEdit($sender, $param)
183 183
 	{
184
-		if(($ctrl = $this->getEditViewControl()) !== null)
184
+		if (($ctrl = $this->getEditViewControl()) !== null)
185 185
 		{
186
-			if($param instanceof TRepeaterCommandEventParameter)
186
+			if ($param instanceof TRepeaterCommandEventParameter)
187 187
 			{
188 188
 				$pk = $param->getItem()->getCustomData();
189 189
 				$ctrl->setRecordPk($pk);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	protected function deleteRecord($sender, $param)
199 199
 	{
200
-		if($param instanceof TRepeaterCommandEventParameter)
200
+		if ($param instanceof TRepeaterCommandEventParameter)
201 201
 		{
202 202
 			$pk = $param->getItem()->getCustomData();
203 203
 			$this->getRecordFinder()->deleteByPk($pk);
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
 	protected function listItemCreated($sender, $param)
211 211
 	{
212 212
 		$item = $param->getItem();
213
-		if($item instanceof IItemDataRenderer)
213
+		if ($item instanceof IItemDataRenderer)
214 214
 		{
215 215
 			$type = $item->getItemType();
216
-			if($type == TListItemType::Item || $type == TListItemType::AlternatingItem)
216
+			if ($type == TListItemType::Item || $type == TListItemType::AlternatingItem)
217 217
 				$this->populateField($sender, $param);
218 218
 		}
219 219
 	}
@@ -225,10 +225,10 @@  discard block
 block discarded – undo
225 225
 	protected function populateField($sender, $param)
226 226
 	{
227 227
 		$item = $param->getItem();
228
-		if(($data = $item->getData()) !== null)
228
+		if (($data = $item->getData()) !== null)
229 229
 		{
230 230
 			$item->setCustomData($this->getRecordPkValues($data));
231
-			if(($prop = $item->findControl('_properties')) !== null)
231
+			if (($prop = $item->findControl('_properties')) !== null)
232 232
 			{
233 233
 				$item->_properties->setDataSource($this->getRecordPropertyValues($data));
234 234
 				$item->_properties->dataBind();
@@ -301,10 +301,10 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	protected function getEditViewControl()
303 303
 	{
304
-		if(($id = $this->getEditViewID()) !== null)
304
+		if (($id = $this->getEditViewID()) !== null)
305 305
 		{
306 306
 			$ctrl = $this->getParent()->findControl($id);
307
-			if($ctrl === null)
307
+			if ($ctrl === null)
308 308
 				throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id);
309 309
 			return $ctrl;
310 310
 		}
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -113,18 +113,21 @@  discard block
 block discarded – undo
113 113
 		$total = $this->_list->getVirtualItemCount();
114 114
 		$limit = $this->_list->getPageSize();
115 115
 		$offset = $this->_list->getCurrentPageIndex() * $limit;
116
-		if($offset + $limit > $total)
117
-			$limit = $total - $offset;
116
+		if($offset + $limit > $total) {
117
+					$limit = $total - $offset;
118
+		}
118 119
 		$criteria = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters());
119 120
 		if($limit > 0)
120 121
 		{
121 122
 			$criteria->setLimit($limit);
122
-			if($offset <= $total)
123
-				$criteria->setOffset($offset);
123
+			if($offset <= $total) {
124
+							$criteria->setOffset($offset);
125
+			}
124 126
 		}
125 127
 		$order = explode(' ', $this->_sort->getSelectedValue(), 2);
126
-		if(is_array($order) && count($order) === 2)
127
-			$criteria->OrdersBy[$order[0]] = $order[1];
128
+		if(is_array($order) && count($order) === 2) {
129
+					$criteria->OrdersBy[$order[0]] = $order[1];
130
+		}
128 131
 		return $criteria;
129 132
 	}
130 133
 
@@ -213,8 +216,9 @@  discard block
 block discarded – undo
213 216
 		if($item instanceof IItemDataRenderer)
214 217
 		{
215 218
 			$type = $item->getItemType();
216
-			if($type == TListItemType::Item || $type == TListItemType::AlternatingItem)
217
-				$this->populateField($sender, $param);
219
+			if($type == TListItemType::Item || $type == TListItemType::AlternatingItem) {
220
+							$this->populateField($sender, $param);
221
+			}
218 222
 		}
219 223
 	}
220 224
 
@@ -304,8 +308,9 @@  discard block
 block discarded – undo
304 308
 		if(($id = $this->getEditViewID()) !== null)
305 309
 		{
306 310
 			$ctrl = $this->getParent()->findControl($id);
307
-			if($ctrl === null)
308
-				throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id);
311
+			if($ctrl === null) {
312
+							throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id);
313
+			}
309 314
 			return $ctrl;
310 315
 		}
311 316
 	}
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	protected function getRecordPropertyValues($record)
60 60
 	{
61 61
 		$data = [];
62
-		foreach($this->getTableInfo()->getColumns() as $name => $column)
62
+		foreach ($this->getTableInfo()->getColumns() as $name => $column)
63 63
 			$data[] = $record->getColumnValue($name);
64 64
 		return $data;
65 65
 	}
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	protected function getRecordPkValues($record)
72 72
 	{
73 73
 		$data = [];
74
-		foreach($this->getTableInfo()->getColumns() as $name => $column)
74
+		foreach ($this->getTableInfo()->getColumns() as $name => $column)
75 75
 		{
76
-			if($column->getIsPrimaryKey())
76
+			if ($column->getIsPrimaryKey())
77 77
 				$data[] = $record->getColumnValue($name);
78 78
 		}
79 79
 		return $data;
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	protected function getRecordObject($pk = null)
126 126
 	{
127
-		if($this->_record === null)
127
+		if ($this->_record === null)
128 128
 		{
129
-			if($pk !== null)
129
+			if ($pk !== null)
130 130
 			{
131 131
 				$this->_record = $this->getRecordFinder()->findByPk($pk);
132
-				if($this->_record === null)
132
+				if ($this->_record === null)
133 133
 					throw new TConfigurationException('scaffold_invalid_record_pk',
134 134
 						$this->getRecordClass(), $pk);
135 135
 			}
136 136
 			else
137 137
 			{
138 138
 				$class = $this->getRecordClass();
139
-				if($class !== null)
139
+				if ($class !== null)
140 140
 					$this->_record = Prado::createComponent($class);
141 141
 				else
142 142
 				{
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 	public function onPreRender($param)
203 203
 	{
204 204
 		parent::onPreRender($param);
205
-		if($this->getEnableDefaultStyle())
205
+		if ($this->getEnableDefaultStyle())
206 206
 		{
207
-			$url = $this->publishAsset($this->getDefaultStyle() . '.css');
207
+			$url = $this->publishAsset($this->getDefaultStyle().'.css');
208 208
 			$this->getPage()->getClientScript()->registerStyleSheetFile($url, $url);
209 209
 		}
210 210
 	}
Please login to merge, or discard this patch.
Braces   +13 added lines, -11 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
 	protected function getRecordPropertyValues($record)
60 60
 	{
61 61
 		$data = [];
62
-		foreach($this->getTableInfo()->getColumns() as $name => $column)
63
-			$data[] = $record->getColumnValue($name);
62
+		foreach($this->getTableInfo()->getColumns() as $name => $column) {
63
+					$data[] = $record->getColumnValue($name);
64
+		}
64 65
 		return $data;
65 66
 	}
66 67
 
@@ -73,8 +74,9 @@  discard block
 block discarded – undo
73 74
 		$data = [];
74 75
 		foreach($this->getTableInfo()->getColumns() as $name => $column)
75 76
 		{
76
-			if($column->getIsPrimaryKey())
77
-				$data[] = $record->getColumnValue($name);
77
+			if($column->getIsPrimaryKey()) {
78
+							$data[] = $record->getColumnValue($name);
79
+			}
78 80
 		}
79 81
 		return $data;
80 82
 	}
@@ -129,16 +131,16 @@  discard block
 block discarded – undo
129 131
 			if($pk !== null)
130 132
 			{
131 133
 				$this->_record = $this->getRecordFinder()->findByPk($pk);
132
-				if($this->_record === null)
133
-					throw new TConfigurationException('scaffold_invalid_record_pk',
134
+				if($this->_record === null) {
135
+									throw new TConfigurationException('scaffold_invalid_record_pk',
134 136
 						$this->getRecordClass(), $pk);
135
-			}
136
-			else
137
+				}
138
+			} else
137 139
 			{
138 140
 				$class = $this->getRecordClass();
139
-				if($class !== null)
140
-					$this->_record = Prado::createComponent($class);
141
-				else
141
+				if($class !== null) {
142
+									$this->_record = Prado::createComponent($class);
143
+				} else
142 144
 				{
143 145
 					throw new TConfigurationException('scaffold_invalid_record_class',
144 146
 						$this->getRecordClass(), $this->getID());
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TIbmScaffoldInput.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 {
19 19
 	protected function createControl($container, $column, $record)
20 20
 	{
21
-		switch(strtolower($column->getDbType()))
21
+		switch (strtolower($column->getDbType()))
22 22
 		{
23 23
 			case 'date':
24 24
 				return $this->createDateControl($container, $column, $record);
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 	protected function getControlValue($container, $column, $record)
41 41
 	{
42
-		switch(strtolower($column->getDbType()))
42
+		switch (strtolower($column->getDbType()))
43 43
 		{
44 44
 			case 'date':
45 45
 				return $container->findControl(self::DEFAULT_ID)->getDate();
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TMysqlScaffoldInput.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 {
18 18
 	protected function createControl($container, $column, $record)
19 19
 	{
20
-		$dbtype = trim(str_replace(['unsigned', 'zerofill'], ['','',], strtolower($column->getDbType())));
21
-		switch($dbtype)
20
+		$dbtype = trim(str_replace(['unsigned', 'zerofill'], ['', '', ], strtolower($column->getDbType())));
21
+		switch ($dbtype)
22 22
 		{
23 23
 			case 'date':
24 24
 				return $this->createDateControl($container, $column, $record);
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 	protected function getControlValue($container, $column, $record)
48 48
 	{
49
-		$dbtype = trim(str_replace(['unsigned', 'zerofill'], ['','',], strtolower($column->getDbType())));
50
-		switch($dbtype)
49
+		$dbtype = trim(str_replace(['unsigned', 'zerofill'], ['', '', ], strtolower($column->getDbType())));
50
+		switch ($dbtype)
51 51
 		{
52 52
 			case 'date':
53 53
 				return $container->findControl(self::DEFAULT_ID)->getDate();
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 	protected function createIntegerControl($container, $column, $record)
72 72
 	{
73
-		if($column->getColumnSize() == 1)
73
+		if ($column->getColumnSize() == 1)
74 74
 			return $this->createBooleanControl($container, $column, $record);
75 75
 		else
76 76
 			parent::createIntegerControl($container, $column, $record);
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 
79 79
 	protected function getIntBooleanValue($container, $column, $record)
80 80
 	{
81
-		if($column->getColumnSize() == 1)
82
-			return (int)$container->findControl(self::DEFAULT_ID)->getChecked();
81
+		if ($column->getColumnSize() == 1)
82
+			return (int) $container->findControl(self::DEFAULT_ID)->getChecked();
83 83
 		else
84 84
 			return $this->getDefaultControlValue($container, $column, $record);
85 85
 	}
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -70,18 +70,20 @@
 block discarded – undo
70 70
 
71 71
 	protected function createIntegerControl($container, $column, $record)
72 72
 	{
73
-		if($column->getColumnSize() == 1)
74
-			return $this->createBooleanControl($container, $column, $record);
75
-		else
76
-			parent::createIntegerControl($container, $column, $record);
73
+		if($column->getColumnSize() == 1) {
74
+					return $this->createBooleanControl($container, $column, $record);
75
+		} else {
76
+					parent::createIntegerControl($container, $column, $record);
77
+		}
77 78
 	}
78 79
 
79 80
 	protected function getIntBooleanValue($container, $column, $record)
80 81
 	{
81
-		if($column->getColumnSize() == 1)
82
-			return (int)$container->findControl(self::DEFAULT_ID)->getChecked();
83
-		else
84
-			return $this->getDefaultControlValue($container, $column, $record);
82
+		if($column->getColumnSize() == 1) {
83
+					return (int)$container->findControl(self::DEFAULT_ID)->getChecked();
84
+		} else {
85
+					return $this->getDefaultControlValue($container, $column, $record);
86
+		}
85 87
 	}
86 88
 }
87 89
 
Please login to merge, or discard this patch.