Completed
Push — prado4-sauce ( 31ba42...77d75b )
by Fabio
16:20 queued 08:27
created
framework/Security/TUserManager.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		{
115 115
 			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
116 116
 			{
117
-				$userFile = include $this->_userFile;
117
+				$userFile=include $this->_userFile;
118 118
 				$this->loadUserDataFromPhp($userFile);
119 119
 			}
120 120
 			else
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 		{
150 150
 			foreach($config['users'] as $user)
151 151
 			{
152
-				$name = trim(strtolower(isset($user['name'])?$user['name']:''));
153
-				$password = isset($user['password'])?$user['password']:'';
154
-				$this->_users[$name] = $password;
155
-				$roles = isset($user['roles'])?$user['roles']:'';
152
+				$name=trim(strtolower(isset($user['name']) ? $user['name'] : ''));
153
+				$password=isset($user['password']) ? $user['password'] : '';
154
+				$this->_users[$name]=$password;
155
+				$roles=isset($user['roles']) ? $user['roles'] : '';
156 156
 				if($roles!=='')
157 157
 				{
158
-					foreach(explode(',',$roles) as $role)
158
+					foreach(explode(',', $roles) as $role)
159 159
 					{
160 160
 						if(($role=trim($role))!=='')
161 161
 							$this->_roles[$name][]=$role;
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 		{
168 168
 			foreach($config['roles'] as $role)
169 169
 			{
170
-				$name = isset($role['name'])?$role['name']:'';
171
-				$users = isset($role['users'])?$role['users']:'';
172
-				foreach(explode(',',$users) as $user)
170
+				$name=isset($role['name']) ? $role['name'] : '';
171
+				$users=isset($role['users']) ? $role['users'] : '';
172
+				foreach(explode(',', $users) as $user)
173 173
 				{
174 174
 					if(($user=trim($user))!=='')
175 175
 						$this->_roles[strtolower($user)][]=$name;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			$this->_users[$name]=$node->getAttribute('password');
191 191
 			if(($roles=trim($node->getAttribute('roles')))!=='')
192 192
 			{
193
-				foreach(explode(',',$roles) as $role)
193
+				foreach(explode(',', $roles) as $role)
194 194
 				{
195 195
 					if(($role=trim($role))!=='')
196 196
 						$this->_roles[$name][]=$role;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		}
200 200
 		foreach($xmlNode->getElementsByTagName('role') as $node)
201 201
 		{
202
-			foreach(explode(',',$node->getAttribute('users')) as $user)
202
+			foreach(explode(',', $node->getAttribute('users')) as $user)
203 203
 			{
204 204
 				if(($user=trim($user))!=='')
205 205
 					$this->_roles[strtolower($user)][]=$node->getAttribute('name');
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 	{
250 250
 		if($this->_initialized)
251 251
 			throw new TInvalidOperationException('usermanager_userfile_unchangeable');
252
-		else if(($this->_userFile=Prado::getPathOfNamespace($value,self::USER_FILE_EXT))===null || !is_file($this->_userFile))
253
-			throw new TConfigurationException('usermanager_userfile_invalid',$value);
252
+		else if(($this->_userFile=Prado::getPathOfNamespace($value, self::USER_FILE_EXT))===null || !is_file($this->_userFile))
253
+			throw new TConfigurationException('usermanager_userfile_invalid', $value);
254 254
 	}
255 255
 
256 256
 	/**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public function setPasswordMode($value)
284 284
 	{
285
-		$this->_passwordMode=TPropertyValue::ensureEnum($value,'Prado\\Security\\TUserManagerPasswordMode');
285
+		$this->_passwordMode=TPropertyValue::ensureEnum($value, 'Prado\\Security\\TUserManagerPasswordMode');
286 286
 	}
287 287
 
288 288
 	/**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @param string password
292 292
 	 * @return boolean true if validation is successful, false otherwise.
293 293
 	 */
294
-	public function validateUser($username,$password)
294
+	public function validateUser($username, $password)
295 295
 	{
296 296
 		if($this->_passwordMode===TUserManagerPasswordMode::MD5)
297 297
 			$password=md5($password);
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			$data=unserialize($data);
345 345
 			if(is_array($data) && count($data)===2)
346 346
 			{
347
-				list($username,$token)=$data;
347
+				list($username, $token)=$data;
348 348
 				if(isset($this->_users[$username]) && $token===md5($username.$this->_users[$username]))
349 349
 					return $this->getUser($username);
350 350
 			}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		$username=strtolower($user->getName());
364 364
 		if(isset($this->_users[$username]))
365 365
 		{
366
-			$data=array($username,md5($username.$this->_users[$username]));
366
+			$data=array($username, md5($username.$this->_users[$username]));
367 367
 			$cookie->setValue(serialize($data));
368 368
 		}
369 369
 	}
Please login to merge, or discard this patch.
framework/Security/TAuthorizationRule.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 	 * @param string verb, can be empty, 'get', or 'post'
75 75
 	 * @param string IP rules (separated by comma, can contain wild card *)
76 76
 	 */
77
-	public function __construct($action,$users,$roles,$verb='',$ipRules='')
77
+	public function __construct($action, $users, $roles, $verb='', $ipRules='')
78 78
 	{
79 79
 		$action=strtolower(trim($action));
80 80
 		if($action==='allow' || $action==='deny')
81 81
 			$this->_action=$action;
82 82
 		else
83
-			throw new TInvalidDataValueException('authorizationrule_action_invalid',$action);
83
+			throw new TInvalidDataValueException('authorizationrule_action_invalid', $action);
84 84
 		$this->_users=array();
85 85
 		$this->_roles=array();
86 86
 		$this->_ipRules=array();
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 		if(trim($users)==='')
92 92
 			$users='*';
93
-		foreach(explode(',',$users) as $user)
93
+		foreach(explode(',', $users) as $user)
94 94
 		{
95 95
 			if(($user=trim(strtolower($user)))!=='')
96 96
 			{
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 		if(trim($roles)==='')
112 112
 			$roles='*';
113
-		foreach(explode(',',$roles) as $role)
113
+		foreach(explode(',', $roles) as $role)
114 114
 		{
115 115
 			if(($role=trim(strtolower($role)))!=='')
116 116
 				$this->_roles[]=$role;
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 		if($verb==='*' || $verb==='get' || $verb==='post')
122 122
 			$this->_verb=$verb;
123 123
 		else
124
-			throw new TInvalidDataValueException('authorizationrule_verb_invalid',$verb);
124
+			throw new TInvalidDataValueException('authorizationrule_verb_invalid', $verb);
125 125
 
126 126
 		if(trim($ipRules)==='')
127 127
 			$ipRules='*';
128
-		foreach(explode(',',$ipRules) as $ipRule)
128
+		foreach(explode(',', $ipRules) as $ipRule)
129 129
 		{
130 130
 			if(($ipRule=trim($ipRule))!=='')
131 131
 				$this->_ipRules[]=$ipRule;
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
 	 * @param string the request IP address
204 204
 	 * @return integer 1 if the user is allowed, -1 if the user is denied, 0 if the rule does not apply to the user
205 205
 	 */
206
-	public function isUserAllowed(IUser $user,$verb,$ip)
206
+	public function isUserAllowed(IUser $user, $verb, $ip)
207 207
 	{
208 208
 		if($this->isVerbMatched($verb) && $this->isIpMatched($ip) && $this->isUserMatched($user) && $this->isRoleMatched($user))
209
-			return ($this->_action==='allow')?1:-1;
209
+			return ($this->_action==='allow') ? 1 : -1;
210 210
 		else
211 211
 			return 0;
212 212
 	}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			return 1;
218 218
 		foreach($this->_ipRules as $rule)
219 219
 		{
220
-			if($rule==='*' || $rule===$ip || (($pos=strpos($rule,'*'))!==false && strncmp($ip,$rule,$pos)===0))
220
+			if($rule==='*' || $rule===$ip || (($pos=strpos($rule, '*'))!==false && strncmp($ip, $rule, $pos)===0))
221 221
 				return 1;
222 222
 		}
223 223
 		return 0;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 	private function isUserMatched($user)
227 227
 	{
228
-		return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()),$this->_users));
228
+		return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()), $this->_users));
229 229
 	}
230 230
 
231 231
 	private function isRoleMatched($user)
@@ -240,6 +240,6 @@  discard block
 block discarded – undo
240 240
 
241 241
 	private function isVerbMatched($verb)
242 242
 	{
243
-		return ($this->_verb==='*' || strcasecmp($verb,$this->_verb)===0);
243
+		return ($this->_verb==='*' || strcasecmp($verb, $this->_verb)===0);
244 244
 	}
245 245
 }
246 246
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Security/TDbUserManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	{
63 63
 		if($this->_userClass==='')
64 64
 			throw new TConfigurationException('dbusermanager_userclass_required');
65
-		$this->_userFactory=Prado::createComponent($this->_userClass,$this);
65
+		$this->_userFactory=Prado::createComponent($this->_userClass, $this);
66 66
 		if(!($this->_userFactory instanceof TDbUser))
67
-			throw new TInvalidDataTypeException('dbusermanager_userclass_invalid',$this->_userClass);
67
+			throw new TInvalidDataTypeException('dbusermanager_userclass_invalid', $this->_userClass);
68 68
 	}
69 69
 
70 70
 	/**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 * @param string password
106 106
 	 * @return boolean true if validation is successful, false otherwise.
107 107
 	 */
108
-	public function validateUser($username,$password)
108
+	public function validateUser($username, $password)
109 109
 	{
110
-		return $this->_userFactory->validateUser($username,$password);
110
+		return $this->_userFactory->validateUser($username, $password);
111 111
 	}
112 112
 
113 113
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	{
120 120
 		if($username===null)
121 121
 		{
122
-			$user=Prado::createComponent($this->_userClass,$this);
122
+			$user=Prado::createComponent($this->_userClass, $this);
123 123
 			$user->setIsGuest(true);
124 124
 			return $user;
125 125
 		}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			if($conn instanceof TDataSourceConfig)
174 174
 				return $conn->getDbConnection();
175 175
 			else
176
-				throw new TConfigurationException('dbusermanager_connectionid_invalid',$connectionID);
176
+				throw new TConfigurationException('dbusermanager_connectionid_invalid', $connectionID);
177 177
 		}
178 178
 		else
179 179
 			throw new TConfigurationException('dbusermanager_connectionid_required');
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecordChangeEventParameter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,6 +42,6 @@
 block discarded – undo
42 42
 	 */
43 43
 	public function setIsValid($value)
44 44
 	{
45
-		$this->_isValid = TPropertyValue::ensureBoolean($value);
45
+		$this->_isValid=TPropertyValue::ensureBoolean($value);
46 46
 	}
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecordGateway.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	protected function getRecordTableName(TActiveRecord $record)
72 72
 	{
73
-		$class = new ReflectionClass($record);
73
+		$class=new ReflectionClass($record);
74 74
 		if($class->hasConstant(self::TABLE_CONST))
75 75
 		{
76
-			$value = $class->getConstant(self::TABLE_CONST);
76
+			$value=$class->getConstant(self::TABLE_CONST);
77 77
 			if(empty($value))
78 78
 				throw new TActiveRecordException('ar_invalid_tablename_property',
79
-					get_class($record),self::TABLE_CONST);
79
+					get_class($record), self::TABLE_CONST);
80 80
 			return $value;
81 81
 		}
82
-		elseif ($class->hasMethod(self::TABLE_METHOD))
82
+		elseif($class->hasMethod(self::TABLE_METHOD))
83 83
 		{
84
-			$value = $record->{self::TABLE_METHOD}();
84
+			$value=$record->{self::TABLE_METHOD}();
85 85
 			if(empty($value))
86 86
 				throw new TActiveRecordException('ar_invalid_tablename_method',
87
-					get_class($record),self::TABLE_METHOD);
87
+					get_class($record), self::TABLE_METHOD);
88 88
 			return $value;
89 89
 		}
90 90
 		else
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function getRecordTableInfo(TActiveRecord $record)
100 100
 	{
101
-		$tableName = $this->getRecordTableName($record);
101
+		$tableName=$this->getRecordTableName($record);
102 102
 		return $this->getTableInfo($record->getDbConnection(), $tableName);
103 103
 	}
104 104
 
@@ -110,27 +110,27 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function getTableInfo(TDbConnection $connection, $tableName)
112 112
 	{
113
-		$connStr = $connection->getConnectionString();
114
-		$key = $connStr.$tableName;
113
+		$connStr=$connection->getConnectionString();
114
+		$key=$connStr.$tableName;
115 115
 		if(!isset($this->_tables[$key]))
116 116
 		{
117 117
 			//call this first to ensure that unserializing the cache
118 118
 			//will find the correct driver dependent classes.
119 119
 			if(!isset($this->_meta[$connStr]))
120 120
 			{
121
-				$this->_meta[$connStr] = TDbMetaData::getInstance($connection);
121
+				$this->_meta[$connStr]=TDbMetaData::getInstance($connection);
122 122
 			}
123 123
 
124
-			$tableInfo = null;
124
+			$tableInfo=null;
125 125
 			if(($cache=$this->getManager()->getCache())!==null)
126
-				$tableInfo = $cache->get($key);
126
+				$tableInfo=$cache->get($key);
127 127
 			if(empty($tableInfo))
128 128
 			{
129
-				$tableInfo = $this->_meta[$connStr]->getTableInfo($tableName);
129
+				$tableInfo=$this->_meta[$connStr]->getTableInfo($tableName);
130 130
 				if($cache!==null)
131 131
 					$cache->set($key, $tableInfo);
132 132
 			}
133
-			$this->_tables[$key] = $tableInfo;
133
+			$this->_tables[$key]=$tableInfo;
134 134
 		}
135 135
 		return $this->_tables[$key];
136 136
 	}
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function getCommand(TActiveRecord $record)
143 143
 	{
144
-		$conn = $record->getDbConnection();
145
-		$connStr = $conn->getConnectionString();
146
-		$tableInfo = $this->getRecordTableInfo($record);
144
+		$conn=$record->getDbConnection();
145
+		$connStr=$conn->getConnectionString();
146
+		$tableInfo=$this->getRecordTableInfo($record);
147 147
 		if(!isset($this->_commandBuilders[$connStr]))
148 148
 		{
149
-			$builder = $tableInfo->createCommandBuilder($record->getDbConnection());
150
-			$command = new TDataGatewayCommand($builder);
151
-			$command->OnCreateCommand[] = array($this, 'onCreateCommand');
152
-			$command->OnExecuteCommand[] = array($this, 'onExecuteCommand');
153
-			$this->_commandBuilders[$connStr] = $command;
149
+			$builder=$tableInfo->createCommandBuilder($record->getDbConnection());
150
+			$command=new TDataGatewayCommand($builder);
151
+			$command->OnCreateCommand[]=array($this, 'onCreateCommand');
152
+			$command->OnExecuteCommand[]=array($this, 'onExecuteCommand');
153
+			$this->_commandBuilders[$connStr]=$command;
154 154
 
155 155
 		}
156 156
 		$this->_commandBuilders[$connStr]->getBuilder()->setTableInfo($tableInfo);
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 * @param array primary name value pairs
201 201
 	 * @return array record data
202 202
 	 */
203
-	public function findRecordByPK(TActiveRecord $record,$keys)
203
+	public function findRecordByPK(TActiveRecord $record, $keys)
204 204
 	{
205
-		$command = $this->getCommand($record);
205
+		$command=$this->getCommand($record);
206 206
 		return $command->findByPk($keys);
207 207
 	}
208 208
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function findRecordsByCriteria(TActiveRecord $record, $criteria, $iterator=false)
230 230
 	{
231
-		$command = $this->getCommand($record);
231
+		$command=$this->getCommand($record);
232 232
 		return $iterator ? $command->findAll($criteria) : $command->find($criteria);
233 233
 	}
234 234
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
 	public function findRecordsByIndex(TActiveRecord $record, $criteria, $fields, $values)
258 258
 	{
259
-		return $this->getCommand($record)->findAllByIndex($criteria,$fields,$values);
259
+		return $this->getCommand($record)->findAllByIndex($criteria, $fields, $values);
260 260
 	}
261 261
 
262 262
 	/**
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	public function insert(TActiveRecord $record)
279 279
 	{
280 280
 		//$this->updateAssociatedRecords($record,true);
281
-		$result = $this->getCommand($record)->insert($this->getInsertValues($record));
281
+		$result=$this->getCommand($record)->insert($this->getInsertValues($record));
282 282
 		if($result)
283 283
 			$this->updatePostInsert($record);
284 284
 		//$this->updateAssociatedRecords($record);
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	protected function updatePostInsert($record)
293 293
 	{
294
-		$command = $this->getCommand($record);
295
-		$tableInfo = $command->getTableInfo();
294
+		$command=$this->getCommand($record);
295
+		$tableInfo=$command->getTableInfo();
296 296
 		foreach($tableInfo->getColumns() as $name => $column)
297 297
 		{
298 298
 			if($column->hasSequence())
299
-				$record->setColumnValue($name,$command->getLastInsertID($column->getSequenceName()));
299
+				$record->setColumnValue($name, $command->getLastInsertID($column->getSequenceName()));
300 300
 		}
301 301
 	}
302 302
 
@@ -307,20 +307,20 @@  discard block
 block discarded – undo
307 307
 	protected function getInsertValues(TActiveRecord $record)
308 308
 	{
309 309
 		$values=array();
310
-		$tableInfo = $this->getCommand($record)->getTableInfo();
310
+		$tableInfo=$this->getCommand($record)->getTableInfo();
311 311
 		foreach($tableInfo->getColumns() as $name=>$column)
312 312
 		{
313 313
 			if($column->getIsExcluded())
314 314
 				continue;
315
-			$value = $record->getColumnValue($name);
316
-			if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
315
+			$value=$record->getColumnValue($name);
316
+			if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && ($column->getDefaultValue()===TDbTableColumn::UNDEFINED_VALUE))
317 317
 			{
318 318
 				throw new TActiveRecordException(
319 319
 					'ar_value_must_not_be_null', get_class($record),
320 320
 					$tableInfo->getTableFullName(), $name);
321 321
 			}
322 322
 			if($value!==null)
323
-				$values[$name] = $value;
323
+				$values[$name]=$value;
324 324
 		}
325 325
 		return $values;
326 326
 	}
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 	public function update(TActiveRecord $record)
334 334
 	{
335 335
 		//$this->updateAssociatedRecords($record,true);
336
-		list($data, $keys) = $this->getUpdateValues($record);
337
-		$result = $this->getCommand($record)->updateByPk($data, $keys);
336
+		list($data, $keys)=$this->getUpdateValues($record);
337
+		$result=$this->getCommand($record)->updateByPk($data, $keys);
338 338
 		//$this->updateAssociatedRecords($record);
339 339
 		return $result;
340 340
 	}
@@ -342,30 +342,30 @@  discard block
 block discarded – undo
342 342
 	protected function getUpdateValues(TActiveRecord $record)
343 343
 	{
344 344
 		$values=array();
345
-		$tableInfo = $this->getCommand($record)->getTableInfo();
345
+		$tableInfo=$this->getCommand($record)->getTableInfo();
346 346
 		$primary=array();
347 347
 		foreach($tableInfo->getColumns() as $name=>$column)
348 348
 		{
349 349
 			if($column->getIsExcluded())
350 350
 				continue;
351
-			$value = $record->getColumnValue($name);
352
-			if(!$column->getAllowNull() && $value===null && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
351
+			$value=$record->getColumnValue($name);
352
+			if(!$column->getAllowNull() && $value===null && ($column->getDefaultValue()===TDbTableColumn::UNDEFINED_VALUE))
353 353
 			{
354 354
 				throw new TActiveRecordException(
355 355
 					'ar_value_must_not_be_null', get_class($record),
356 356
 					$tableInfo->getTableFullName(), $name);
357 357
 			}
358 358
 			if($column->getIsPrimaryKey())
359
-				$primary[$name] = $value;
359
+				$primary[$name]=$value;
360 360
 			else
361
-				$values[$name] = $value;
361
+				$values[$name]=$value;
362 362
 		}
363
-		return array($values,$primary);
363
+		return array($values, $primary);
364 364
 	}
365 365
 
366
-	protected function updateAssociatedRecords(TActiveRecord $record,$updateBelongsTo=false)
366
+	protected function updateAssociatedRecords(TActiveRecord $record, $updateBelongsTo=false)
367 367
 	{
368
-		$context = new TActiveRecordRelationContext($record);
368
+		$context=new TActiveRecordRelationContext($record);
369 369
 		return $context->updateAssociatedRecords($updateBelongsTo);
370 370
 	}
371 371
 
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 
382 382
 	protected function getPrimaryKeyValues(TActiveRecord $record)
383 383
 	{
384
-		$tableInfo = $this->getCommand($record)->getTableInfo();
384
+		$tableInfo=$this->getCommand($record)->getTableInfo();
385 385
 		$primary=array();
386 386
 		foreach($tableInfo->getColumns() as $name=>$column)
387 387
 		{
388 388
 			if($column->getIsPrimaryKey())
389
-				$primary[$name] = $record->getColumnValue($name);
389
+				$primary[$name]=$record->getColumnValue($name);
390 390
 		}
391 391
 		return $primary;
392 392
 	}
@@ -419,12 +419,12 @@  discard block
 block discarded – undo
419 419
 	 * @param TActiveRecord active record
420 420
 	 * @param TActiveRecordCriteria data for the command.
421 421
 	 */
422
-	protected function raiseCommandEvent($event,$command,$record,$criteria)
422
+	protected function raiseCommandEvent($event, $command, $record, $criteria)
423 423
 	{
424 424
 		if(!($criteria instanceof TSqlCriteria))
425
-			$criteria = new TActiveRecordCriteria(null,$criteria);
426
-		$param = new TActiveRecordEventParameter($command,$record,$criteria);
427
-		$manager = $record->getRecordManager();
425
+			$criteria=new TActiveRecordCriteria(null, $criteria);
426
+		$param=new TActiveRecordEventParameter($command, $record, $criteria);
427
+		$manager=$record->getRecordManager();
428 428
 		$manager->{$event}($param);
429 429
 		$record->{$event}($param);
430 430
 	}
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecordManager.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class TActiveRecordManager extends \Prado\TComponent
38 38
 {
39
-	const DEFAULT_GATEWAY_CLASS = 'System.Data.ActiveRecord.TActiveRecordGateway';
39
+	const DEFAULT_GATEWAY_CLASS='System.Data.ActiveRecord.TActiveRecordGateway';
40 40
 
41 41
 	/**
42 42
 	 * Defaults to {@link TActiveRecordManager::DEFAULT_GATEWAY_CLASS DEFAULT_GATEWAY_CLASS}
43 43
 	 * @var string
44 44
 	 */
45
-	private $_gatewayClass = self::DEFAULT_GATEWAY_CLASS;
45
+	private $_gatewayClass=self::DEFAULT_GATEWAY_CLASS;
46 46
 
47 47
 	private $_gateway;
48 48
 	private $_meta=array();
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @var TActiveRecordInvalidFinderResult
57 57
 	 * @since 3.1.5
58 58
 	 */
59
-	private $_invalidFinderResult = TActiveRecordInvalidFinderResult::Null;
59
+	private $_invalidFinderResult=TActiveRecordInvalidFinderResult::Null;
60 60
 
61 61
 	/**
62 62
 	 * @return ICache application cache.
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		if($self!==null)
100 100
 			$instance=$self;
101 101
 		else if($instance===null)
102
-			$instance = new self;
102
+			$instance=new self;
103 103
 		return $instance;
104 104
 	}
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getRecordGateway()
110 110
 	{
111
-		if($this->_gateway === null) {
112
-			$this->_gateway = $this->createRecordGateway();
111
+		if($this->_gateway===null) {
112
+			$this->_gateway=$this->createRecordGateway();
113 113
 		}
114 114
 		return $this->_gateway;
115 115
 	}
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function setGatewayClass($value)
130 130
 	{
131
-		$this->_gateway = null;
132
-		$this->_gatewayClass = (string)$value;
131
+		$this->_gateway=null;
132
+		$this->_gatewayClass=(string) $value;
133 133
 	}
134 134
 
135 135
 	/**
@@ -158,6 +158,6 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function setInvalidFinderResult($value)
160 160
 	{
161
-		$this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
161
+		$this->_invalidFinderResult=TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
162 162
 	}
163 163
 }
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecord.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 	 * @var TActiveRecordInvalidFinderResult
201 201
 	 * @since 3.1.5
202 202
 	 */
203
-	protected $_invalidFinderResult = null; // use protected so that serialization is fine
203
+	protected $_invalidFinderResult=null; // use protected so that serialization is fine
204 204
 
205 205
 	/**
206 206
 	 * Prevent __call() method creating __sleep() when serializing.
207 207
 	 */
208 208
 	public function __sleep()
209 209
 	{
210
-		return array_diff(parent::__sleep(),array("\0*\0_connection"));
210
+		return array_diff(parent::__sleep(), array("\0*\0_connection"));
211 211
 	}
212 212
 
213 213
 	/**
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 	 * @param mixed property value.
263 263
 	 * @since 3.1.2
264 264
 	 */
265
-	public function __set($name,$value)
265
+	public function __set($name, $value)
266 266
 	{
267 267
 		if($this->hasRecordRelation($name) && !$this->canSetProperty($name))
268 268
 			$this->$name=$value;
269 269
 		else
270
-			parent::__set($name,$value);
270
+			parent::__set($name, $value);
271 271
 	}
272 272
 
273 273
 	/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 			$class=new ReflectionClass($className);
295 295
 			$relations=array();
296 296
 			foreach($class->getStaticPropertyValue('RELATIONS') as $key=>$value)
297
-				$relations[strtolower($key)]=array($key,$value);
297
+				$relations[strtolower($key)]=array($key, $value);
298 298
 			self::$_relations[$className]=$relations;
299 299
 		}
300 300
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		if(!is_array($data))
311 311
 			throw new TActiveRecordException('ar_data_invalid', get_class($this));
312 312
 		foreach($data as $name=>$value)
313
-			$this->setColumnValue($name,$value);
313
+			$this->setColumnValue($name, $value);
314 314
 	}
315 315
 
316 316
 
@@ -361,16 +361,16 @@  discard block
 block discarded – undo
361 361
 	{
362 362
 		if($record===null || get_class($this)!==get_class($record))
363 363
 			return false;
364
-		$tableInfo = $this->getRecordTableInfo();
365
-		$pks = $tableInfo->getPrimaryKeys();
366
-		$properties = count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys();
364
+		$tableInfo=$this->getRecordTableInfo();
365
+		$pks=$tableInfo->getPrimaryKeys();
366
+		$properties=count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys();
367 367
 		$equals=true;
368 368
 		foreach($properties as $prop)
369 369
 		{
370 370
 			if($strict)
371
-				$equals = $equals && $this->getColumnValue($prop) === $record->getColumnValue($prop);
371
+				$equals=$equals && $this->getColumnValue($prop)===$record->getColumnValue($prop);
372 372
 			else
373
-				$equals = $equals && $this->getColumnValue($prop) == $record->getColumnValue($prop);
373
+				$equals=$equals && $this->getColumnValue($prop)==$record->getColumnValue($prop);
374 374
 			if(!$equals)
375 375
 				return false;
376 376
 		}
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 	 */
389 389
 	public static function finder($className=__CLASS__)
390 390
 	{
391
-		static $finders = array();
391
+		static $finders=array();
392 392
 		if(!isset($finders[$className]))
393 393
 		{
394
-			$f = Prado::createComponent($className);
394
+			$f=Prado::createComponent($className);
395 395
 			$finders[$className]=$f;
396 396
 		}
397 397
 		return $finders[$className];
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
 	 */
422 422
 	public function save()
423 423
 	{
424
-		$gateway = $this->getRecordGateway();
425
-		$param = new TActiveRecordChangeEventParameter();
424
+		$gateway=$this->getRecordGateway();
425
+		$param=new TActiveRecordChangeEventParameter();
426 426
 		if($this->_recordState===self::STATE_NEW)
427 427
 		{
428 428
 			$this->onInsert($param);
429 429
 			if($param->getIsValid() && $gateway->insert($this))
430 430
 			{
431
-				$this->_recordState = self::STATE_LOADED;
431
+				$this->_recordState=self::STATE_LOADED;
432 432
 				return true;
433 433
 			}
434 434
 		}
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 	{
454 454
 		if($this->_recordState===self::STATE_LOADED)
455 455
 		{
456
-			$gateway = $this->getRecordGateway();
457
-			$param = new TActiveRecordChangeEventParameter();
456
+			$gateway=$this->getRecordGateway();
457
+			$param=new TActiveRecordChangeEventParameter();
458 458
 			$this->onDelete($param);
459 459
 			if($param->getIsValid() && $gateway->delete($this))
460 460
 			{
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
 	public function deleteByPk($keys)
495 495
 	{
496 496
 		if(func_num_args() > 1)
497
-			$keys = func_get_args();
498
-		return $this->getRecordGateway()->deleteRecordsByPk($this,(array)$keys);
497
+			$keys=func_get_args();
498
+		return $this->getRecordGateway()->deleteRecordsByPk($this, (array) $keys);
499 499
 	}
500 500
 
501 501
 	/**
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	public function deleteAllByPks($keys)
505 505
 	{
506 506
 		if(func_num_args() > 1)
507
-			$keys = func_get_args();
507
+			$keys=func_get_args();
508 508
 		return $this->deleteByPk($keys);
509 509
 	}
510 510
 	/**
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	 */
516 516
 	public function deleteAll($criteria=null, $parameters=array())
517 517
 	{
518
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
519
-		$criteria = $this->getRecordCriteria($criteria,$parameters, $args);
518
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
519
+		$criteria=$this->getRecordCriteria($criteria, $parameters, $args);
520 520
 		return $this->getRecordGateway()->deleteRecordsByCriteria($this, $criteria);
521 521
 	}
522 522
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	{
541 541
 		$result=array();
542 542
 		foreach($reader as $data)
543
-			$result[] = $this->populateObject($data);
543
+			$result[]=$this->populateObject($data);
544 544
 		return $result;
545 545
 	}
546 546
 
@@ -579,12 +579,12 @@  discard block
 block discarded – undo
579 579
 	 * @param mixed parameter values.
580 580
 	 * @return TActiveRecord matching record object. Null if no result is found.
581 581
 	 */
582
-	public function find($criteria,$parameters=array())
582
+	public function find($criteria, $parameters=array())
583 583
 	{
584
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
585
-		$criteria = $this->getRecordCriteria($criteria,$parameters, $args);
584
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
585
+		$criteria=$this->getRecordCriteria($criteria, $parameters, $args);
586 586
 		$criteria->setLimit(1);
587
-		$data = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria);
587
+		$data=$this->getRecordGateway()->findRecordsByCriteria($this, $criteria);
588 588
 		return $this->populateObject($data);
589 589
 	}
590 590
 
@@ -595,12 +595,12 @@  discard block
 block discarded – undo
595 595
 	 * @param mixed parameter values.
596 596
 	 * @return array matching record objects. Empty array if no result is found.
597 597
 	 */
598
-	public function findAll($criteria=null,$parameters=array())
598
+	public function findAll($criteria=null, $parameters=array())
599 599
 	{
600
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
600
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
601 601
 		if($criteria!==null)
602
-			$criteria = $this->getRecordCriteria($criteria,$parameters, $args);
603
-		$result = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria,true);
602
+			$criteria=$this->getRecordCriteria($criteria, $parameters, $args);
603
+		$result=$this->getRecordGateway()->findRecordsByCriteria($this, $criteria, true);
604 604
 		return $this->populateObjects($result);
605 605
 	}
606 606
 
@@ -618,11 +618,11 @@  discard block
 block discarded – undo
618 618
 	 */
619 619
 	public function findByPk($keys)
620 620
 	{
621
-		if($keys === null)
621
+		if($keys===null)
622 622
 			return null;
623 623
 		if(func_num_args() > 1)
624
-			$keys = func_get_args();
625
-		$data = $this->getRecordGateway()->findRecordByPK($this,$keys);
624
+			$keys=func_get_args();
625
+		$data=$this->getRecordGateway()->findRecordByPK($this, $keys);
626 626
 		return $this->populateObject($data);
627 627
 	}
628 628
 
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
 	public function findAllByPks($keys)
647 647
 	{
648 648
 		if(func_num_args() > 1)
649
-			$keys = func_get_args();
650
-		$result = $this->getRecordGateway()->findRecordsByPks($this,(array)$keys);
649
+			$keys=func_get_args();
650
+		$result=$this->getRecordGateway()->findRecordsByPks($this, (array) $keys);
651 651
 		return $this->populateObjects($result);
652 652
 	}
653 653
 
@@ -659,12 +659,12 @@  discard block
 block discarded – undo
659 659
 	 * @param array $parameters
660 660
 	 * @return TActiveRecord, null if no result is returned.
661 661
 	 */
662
-	public function findBySql($sql,$parameters=array())
662
+	public function findBySql($sql, $parameters=array())
663 663
 	{
664
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
665
-		$criteria = $this->getRecordCriteria($sql,$parameters, $args);
664
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
665
+		$criteria=$this->getRecordCriteria($sql, $parameters, $args);
666 666
 		$criteria->setLimit(1);
667
-		$data = $this->getRecordGateway()->findRecordBySql($this,$criteria);
667
+		$data=$this->getRecordGateway()->findRecordBySql($this, $criteria);
668 668
 		return $this->populateObject($data);
669 669
 	}
670 670
 
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 	 * @param array $parameters
677 677
 	 * @return array matching active records. Empty array is returned if no result is found.
678 678
 	 */
679
-	public function findAllBySql($sql,$parameters=array())
679
+	public function findAllBySql($sql, $parameters=array())
680 680
 	{
681
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
682
-		$criteria = $this->getRecordCriteria($sql,$parameters, $args);
683
-		$result = $this->getRecordGateway()->findRecordsBySql($this,$criteria);
681
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
682
+		$criteria=$this->getRecordCriteria($sql, $parameters, $args);
683
+		$result=$this->getRecordGateway()->findRecordsBySql($this, $criteria);
684 684
 		return $this->populateObjects($result);
685 685
 	}
686 686
 
@@ -696,9 +696,9 @@  discard block
 block discarded – undo
696 696
 	 * @param array matching field values.
697 697
 	 * @return array matching active records. Empty array is returned if no result is found.
698 698
 	 */
699
-	public function findAllByIndex($criteria,$fields,$values)
699
+	public function findAllByIndex($criteria, $fields, $values)
700 700
 	{
701
-		$result = $this->getRecordGateway()->findRecordsByIndex($this,$criteria,$fields,$values);
701
+		$result=$this->getRecordGateway()->findRecordsByIndex($this, $criteria, $fields, $values);
702 702
 		return $this->populateObjects($result);
703 703
 	}
704 704
 
@@ -708,12 +708,12 @@  discard block
 block discarded – undo
708 708
 	 * @param mixed parameter values.
709 709
 	 * @return int number of records.
710 710
 	 */
711
-	public function count($criteria=null,$parameters=array())
711
+	public function count($criteria=null, $parameters=array())
712 712
 	{
713
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
713
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
714 714
 		if($criteria!==null)
715
-			$criteria = $this->getRecordCriteria($criteria,$parameters, $args);
716
-		return $this->getRecordGateway()->countRecords($this,$criteria);
715
+			$criteria=$this->getRecordCriteria($criteria, $parameters, $args);
716
+		return $this->getRecordGateway()->countRecords($this, $criteria);
717 717
 	}
718 718
 
719 719
 	/**
@@ -723,11 +723,11 @@  discard block
 block discarded – undo
723 723
 	 * @param array method call arguments.
724 724
 	 * @return TActiveRecordRelation, null if the context or the handler doesn't exist
725 725
 	 */
726
-	protected function getRelationHandler($name,$args=array())
726
+	protected function getRelationHandler($name, $args=array())
727 727
 	{
728
-		if(($context=$this->createRelationContext($name)) !== null)
728
+		if(($context=$this->createRelationContext($name))!==null)
729 729
 		{
730
-			$criteria = $this->getRecordCriteria(count($args)>0 ? $args[0] : null, array_slice($args,1));
730
+			$criteria=$this->getRecordCriteria(count($args) > 0 ? $args[0] : null, array_slice($args, 1));
731 731
 			return $context->getRelationHandler($criteria);
732 732
 		}
733 733
 		else
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
 	{
748 748
 		if(($definition=$this->getRecordRelation($name))!==null)
749 749
 		{
750
-			list($property, $relation) = $definition;
751
-			return new TActiveRecordRelationContext($this,$property,$relation);
750
+			list($property, $relation)=$definition;
751
+			return new TActiveRecordRelationContext($this, $property, $relation);
752 752
 		}
753 753
 		else
754 754
 			return null;
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 */
792 792
 	protected function fetchResultsFor($property)
793 793
 	{
794
-		if( ($context=$this->createRelationContext($property)) !== null)
794
+		if(($context=$this->createRelationContext($property))!==null)
795 795
 			return $context->getRelationHandler()->fetchResultsInto($this);
796 796
 		else
797 797
 			return false;
@@ -826,31 +826,31 @@  discard block
 block discarded – undo
826 826
 	 * @return mixed single record if method name starts with "findBy", 0 or more records
827 827
 	 * if method name starts with "findAllBy"
828 828
 	 */
829
-	public function __call($method,$args)
829
+	public function __call($method, $args)
830 830
 	{
831
-		$delete =false;
832
-		if(strncasecmp($method,'with',4)===0)
831
+		$delete=false;
832
+		if(strncasecmp($method, 'with', 4)===0)
833 833
 		{
834
-			$property= $method[4]==='_' ? substr($method,5) : substr($method,4);
834
+			$property=$method[4]==='_' ? substr($method, 5) : substr($method, 4);
835 835
 			return $this->getRelationHandler($property, $args);
836 836
 		}
837
-		else if($findOne=strncasecmp($method,'findby',6)===0)
838
-			$condition = $method[6]==='_' ? substr($method,7) : substr($method,6);
839
-		else if(strncasecmp($method,'findallby',9)===0)
840
-			$condition = $method[9]==='_' ? substr($method,10) : substr($method,9);
841
-		else if($delete=strncasecmp($method,'deleteby',8)===0)
842
-			$condition = $method[8]==='_' ? substr($method,9) : substr($method,8);
843
-		else if($delete=strncasecmp($method,'deleteallby',11)===0)
844
-			$condition = $method[11]==='_' ? substr($method,12) : substr($method,11);
837
+		else if($findOne=strncasecmp($method, 'findby', 6)===0)
838
+			$condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6);
839
+		else if(strncasecmp($method, 'findallby', 9)===0)
840
+			$condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9);
841
+		else if($delete=strncasecmp($method, 'deleteby', 8)===0)
842
+			$condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8);
843
+		else if($delete=strncasecmp($method, 'deleteallby', 11)===0)
844
+			$condition=$method[11]==='_' ? substr($method, 12) : substr($method, 11);
845 845
 		else
846 846
 		{
847
-			if($this->getInvalidFinderResult() == TActiveRecordInvalidFinderResult::Exception)
848
-				throw new TActiveRecordException('ar_invalid_finder_method',$method);
847
+			if($this->getInvalidFinderResult()==TActiveRecordInvalidFinderResult::Exception)
848
+				throw new TActiveRecordException('ar_invalid_finder_method', $method);
849 849
 			else
850 850
 				return null;
851 851
 		}
852 852
 
853
-		$criteria = $this->getRecordGateway()->getCommand($this)->createCriteriaFromString($method, $condition, $args);
853
+		$criteria=$this->getRecordGateway()->getCommand($this)->createCriteriaFromString($method, $condition, $args);
854 854
 		if($delete)
855 855
 			return $this->deleteAll($criteria);
856 856
 		else
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	 */
865 865
 	public function getInvalidFinderResult()
866 866
 	{
867
-		if($this->_invalidFinderResult !== null)
867
+		if($this->_invalidFinderResult!==null)
868 868
 			return $this->_invalidFinderResult;
869 869
 
870 870
 		return self::getRecordManager()->getInvalidFinderResult();
@@ -879,10 +879,10 @@  discard block
 block discarded – undo
879 879
 	 */
880 880
 	public function setInvalidFinderResult($value)
881 881
 	{
882
-		if($value === null)
883
-			$this->_invalidFinderResult = null;
882
+		if($value===null)
883
+			$this->_invalidFinderResult=null;
884 884
 		else
885
-			$this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
885
+			$this->_invalidFinderResult=TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
886 886
 	}
887 887
 
888 888
 	/**
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
 	{
899 899
 		if(is_string($criteria))
900 900
 		{
901
-			$useArgs = !is_array($parameters) && is_array($args);
902
-			return new TActiveRecordCriteria($criteria,$useArgs ? $args : $parameters);
901
+			$useArgs=!is_array($parameters) && is_array($args);
902
+			return new TActiveRecordCriteria($criteria, $useArgs ? $args : $parameters);
903 903
 		}
904 904
 		else if($criteria instanceof TSqlCriteria)
905 905
 			return $criteria;
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 	 * @param mixed the corresponding column value
994 994
 	 * @since 3.1.1
995 995
 	 */
996
-	public function setColumnValue($columnName,$value)
996
+	public function setColumnValue($columnName, $value)
997 997
 	{
998 998
 		$className=get_class($this);
999 999
 		if(isset(self::$_columnMapping[$className][$columnName]))
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 	{
1011 1011
 		$className=get_class($this);
1012 1012
 		$property=strtolower($property);
1013
-		return isset(self::$_relations[$className][$property])?self::$_relations[$className][$property]:null;
1013
+		return isset(self::$_relations[$className][$property]) ? self::$_relations[$className][$property] : null;
1014 1014
 	}
1015 1015
 
1016 1016
 	/**
@@ -1037,9 +1037,9 @@  discard block
 block discarded – undo
1037 1037
         * @return array of column name and column values
1038 1038
         * @since 3.2.4
1039 1039
         */
1040
-        public function toArray(){
1040
+        public function toArray() {
1041 1041
         	$result=array();
1042
-        	foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){
1042
+        	foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName) {
1043 1043
             		$result[$columnName]=$this->getColumnValue($columnName);
1044 1044
            	}
1045 1045
         
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
      	* @return JSON
1052 1052
      	* @since 3.2.4
1053 1053
      	*/
1054
-    	public function toJSON(){
1054
+    	public function toJSON() {
1055 1055
         	return json_encode($this->toArray());
1056 1056
     	}
1057 1057
 }
1058 1058
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecordConfig.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,25 +74,25 @@  discard block
 block discarded – undo
74 74
  */
75 75
 class TActiveRecordConfig extends TDataSourceConfig
76 76
 {
77
-	const DEFAULT_MANAGER_CLASS = 'System.Data.ActiveRecord.TActiveRecordManager';
78
-	const DEFAULT_GATEWAY_CLASS = 'System.Data.ActiveRecord.TActiveRecordGateway';
77
+	const DEFAULT_MANAGER_CLASS='System.Data.ActiveRecord.TActiveRecordManager';
78
+	const DEFAULT_GATEWAY_CLASS='System.Data.ActiveRecord.TActiveRecordGateway';
79 79
 
80 80
 	/**
81 81
 	 * Defaults to {@link TActiveRecordConfig::DEFAULT_GATEWAY_CLASS DEFAULT_MANAGER_CLASS}
82 82
 	 * @var string
83 83
 	 */
84
-	private $_managerClass = self::DEFAULT_MANAGER_CLASS;
84
+	private $_managerClass=self::DEFAULT_MANAGER_CLASS;
85 85
 
86 86
 	/**
87 87
 	 * Defaults to {@link TActiveRecordConfig::DEFAULT_GATEWAY_CLASS DEFAULT_GATEWAY_CLASS}
88 88
 	 * @var string
89 89
 	 */
90
-	private $_gatewayClass = self::DEFAULT_GATEWAY_CLASS;
90
+	private $_gatewayClass=self::DEFAULT_GATEWAY_CLASS;
91 91
 
92 92
 	/**
93 93
 	 * @var TActiveRecordManager
94 94
 	 */
95
-	private $_manager = null;
95
+	private $_manager=null;
96 96
 
97 97
 	private $_enableCache=false;
98 98
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @var TActiveRecordInvalidFinderResult
103 103
 	 * @since 3.1.5
104 104
 	 */
105
-	private $_invalidFinderResult = TActiveRecordInvalidFinderResult::Null;
105
+	private $_invalidFinderResult=TActiveRecordInvalidFinderResult::Null;
106 106
 
107 107
 	/**
108 108
 	 * Initialize the active record manager.
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	public function init($xml)
112 112
 	{
113 113
 		parent::init($xml);
114
-		$manager = $this -> getManager();
114
+		$manager=$this -> getManager();
115 115
 		if($this->getEnableCache())
116 116
 			$manager->setCache($this->getApplication()->getCache());
117 117
 		$manager->setDbConnection($this->getDbConnection());
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 * @return TActiveRecordManager
124 124
 	 */
125 125
 	public function getManager() {
126
-		if($this->_manager === null)
127
-			$this->_manager = Prado::createComponent($this -> getManagerClass());
126
+		if($this->_manager===null)
127
+			$this->_manager=Prado::createComponent($this -> getManagerClass());
128 128
 		return TActiveRecordManager::getInstance($this->_manager);
129 129
 	}
130 130
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function setManagerClass($value)
136 136
 	{
137
-		$this->_managerClass = TPropertyValue::ensureString($value);
137
+		$this->_managerClass=TPropertyValue::ensureString($value);
138 138
 	}
139 139
 
140 140
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function setGatewayClass($value)
153 153
 	{
154
-		$this->_gatewayClass = TPropertyValue::ensureString($value);
154
+		$this->_gatewayClass=TPropertyValue::ensureString($value);
155 155
 	}
156 156
 
157 157
 	/**
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function setEnableCache($value)
170 170
 	{
171
-		$this->_enableCache = TPropertyValue::ensureBoolean($value);
171
+		$this->_enableCache=TPropertyValue::ensureBoolean($value);
172 172
 	}
173 173
 
174 174
 	/**
@@ -198,6 +198,6 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function setInvalidFinderResult($value)
200 200
 	{
201
-		$this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
201
+		$this->_invalidFinderResult=TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
202 202
 	}
203 203
 }
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecordInvalidFinderResult.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,6 +29,6 @@
 block discarded – undo
29 29
  */
30 30
 class TActiveRecordInvalidFinderResult extends \Prado\TEnumerable
31 31
 {
32
-	const Null = 'Null';
33
-	const Exception = 'Exception';
32
+	const Null='Null';
33
+	const Exception='Exception';
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.