Completed
Push — php-cs-fixer ( b6f93e...b9836a )
by Fabio
07:15
created
bin/prado-cli.php 3 patches
Doc Comments   +25 added lines patch added patch discarded remove patch
@@ -143,6 +143,10 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	abstract public function performAction($args);
145 145
 
146
+	/**
147
+	 * @param string $dir
148
+	 * @param integer $mask
149
+	 */
146 150
 	protected function createDirectory($dir, $mask)
147 151
 	{
148 152
 		if(!is_dir($dir))
@@ -154,6 +158,9 @@  discard block
 block discarded – undo
154 158
 			chmod($dir, $mask);
155 159
 	}
156 160
 
161
+	/**
162
+	 * @param string $filename
163
+	 */
157 164
 	protected function createFile($filename, $content)
158 165
 	{
159 166
 		if(!is_file($filename))
@@ -302,6 +309,9 @@  discard block
 block discarded – undo
302 309
 ';
303 310
 	}
304 311
 
312
+	/**
313
+	 * @param string $appName
314
+	 */
305 315
 	protected function renderConfigFile($appName)
306 316
 	{
307 317
 		return <<<EOD
@@ -515,6 +525,9 @@  discard block
 block discarded – undo
515 525
 		return false;
516 526
 	}
517 527
 
528
+	/**
529
+	 * @param string $app_dir
530
+	 */
518 531
 	protected function getActiveRecordConfig($app_dir)
519 532
 	{
520 533
 		if(false === ($xml = $this->getXmlFile($app_dir)))
@@ -530,6 +543,9 @@  discard block
 block discarded – undo
530 543
 		return false;
531 544
 	}
532 545
 
546
+	/**
547
+	 * @param string $app_dir
548
+	 */
533 549
 	protected function getOutputFile($app_dir, $namespace)
534 550
 	{
535 551
 		if(is_file($namespace) && strpos($namespace, $app_dir) === 0)
@@ -591,6 +607,9 @@  discard block
 block discarded – undo
591 607
 		return $prop;
592 608
 	}
593 609
 
610
+	/**
611
+	 * @param string $class
612
+	 */
594 613
 	protected function generateClass($properties, $tablename, $class)
595 614
 	{
596 615
 		$props = implode("\n", $properties);
@@ -686,6 +705,9 @@  discard block
 block discarded – undo
686 705
 		return true;
687 706
 	}
688 707
 
708
+	/**
709
+	 * @param string $l
710
+	 */
689 711
 	public function generate($l)
690 712
 	{
691 713
 		$input = explode(" ", trim($l));
@@ -724,6 +746,9 @@  discard block
 block discarded – undo
724 746
 		return false;
725 747
 	}
726 748
 
749
+	/**
750
+	 * @param string $app_dir
751
+	 */
727 752
 	protected function getActiveRecordConfig($app_dir) {
728 753
 		if (false === ($xml = $this->getXmlFile($app_dir)))
729 754
 			return false;
Please login to merge, or discard this patch.
Spacing   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
  * @license https://github.com/pradosoft/prado/blob/master/LICENSE
10 10
  */
11 11
 
12
-if(!isset($_SERVER['argv']) || php_sapi_name() !== 'cli')
12
+if(!isset($_SERVER['argv']) || php_sapi_name()!=='cli')
13 13
 	die('Must be run from the command line');
14 14
 
15 15
 // Locate composer's autoloader
16
-if(file_exists($autoloader = realpath(__DIR__ . '/../vendor/autoload.php')))
16
+if(file_exists($autoloader=realpath(__DIR__.'/../vendor/autoload.php')))
17 17
 {
18 18
 	// if we are running inside a prado repo checkout, get out of bin/
19 19
 	include($autoloader);
20
-} elseif(file_exists($autoloader = realpath(__DIR__ . '/../../../autoload.php'))) {
20
+} elseif(file_exists($autoloader=realpath(__DIR__.'/../../../autoload.php'))) {
21 21
 	// if we are running from inside an application's vendor/ directory, get out of pradosoft/prado/bin/
22 22
 	include($autoloader);
23 23
 }
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 	/**
63 63
 	 * @var array command action classes
64 64
 	 */
65
-	protected $_actions = [];
65
+	protected $_actions=[];
66 66
 
67 67
 	/**
68 68
 	 * @param string action class name
69 69
 	 */
70 70
 	public function addActionClass($class)
71 71
 	{
72
-		$this->_actions[$class] = new $class;
72
+		$this->_actions[$class]=new $class;
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 	public static function getInstance()
79 79
 	{
80 80
 		static $instance;
81
-		if($instance === null)
82
-			$instance = new self;
81
+		if($instance===null)
82
+			$instance=new self;
83 83
 		return $instance;
84 84
 	}
85 85
 
86 86
 	public static function printGreeting()
87 87
 	{
88
-		echo "Command line tools for Prado " . Prado::getVersion() . ".\n";
88
+		echo "Command line tools for Prado ".Prado::getVersion().".\n";
89 89
 	}
90 90
 
91 91
 	/**
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
 	{
97 97
 		if(count($args) > 1)
98 98
 			array_shift($args);
99
-		$valid = false;
99
+		$valid=false;
100 100
 		foreach($this->_actions as $class => $action)
101 101
 		{
102 102
 			if($action->isValidAction($args))
103 103
 			{
104
-				$valid |= $action->performAction($args);
104
+				$valid|=$action->performAction($args);
105 105
 				break;
106 106
 			}
107 107
 			else
108 108
 			{
109
-				$valid = false;
109
+				$valid=false;
110 110
 			}
111 111
 		}
112 112
 		if(!$valid)
@@ -165,23 +165,23 @@  discard block
 block discarded – undo
165 165
 
166 166
 	public function isValidAction($args)
167 167
 	{
168
-		return 0 == strcasecmp($args[0], $this->action) &&
168
+		return 0==strcasecmp($args[0], $this->action) &&
169 169
 			count($args) - 1 >= count($this->parameters);
170 170
 	}
171 171
 
172 172
 	public function renderHelp()
173 173
 	{
174
-		$params = [];
174
+		$params=[];
175 175
 		foreach($this->parameters as $v)
176
-			$params[] = '<' . $v . '>';
177
-		$parameters = implode($params, ' ');
178
-		$options = [];
176
+			$params[]='<'.$v.'>';
177
+		$parameters=implode($params, ' ');
178
+		$options=[];
179 179
 		foreach($this->optional as $v)
180
-			$options[] = '[' . $v . ']';
181
-		$optional = (strlen($parameters) ? ' ' : '') . implode($options, ' ');
182
-		$description = '';
180
+			$options[]='['.$v.']';
181
+		$optional=(strlen($parameters) ? ' ' : '').implode($options, ' ');
182
+		$description='';
183 183
 		foreach(explode("\n", wordwrap($this->description, 65)) as $line)
184
-			$description .= '    ' . $line . "\n";
184
+			$description.='    '.$line."\n";
185 185
 		return <<<EOD
186 186
   {$this->action} {$parameters}{$optional}
187 187
 {$description}
@@ -191,17 +191,17 @@  discard block
 block discarded – undo
191 191
 
192 192
 	protected function initializePradoApplication($directory)
193 193
 	{
194
-		$_SERVER['SCRIPT_FILENAME'] = $directory . '/index.php';
195
-		$app_dir = realpath($directory . '/protected/');
196
-		if($app_dir !== false && is_dir($app_dir))
194
+		$_SERVER['SCRIPT_FILENAME']=$directory.'/index.php';
195
+		$app_dir=realpath($directory.'/protected/');
196
+		if($app_dir!==false && is_dir($app_dir))
197 197
 		{
198
-			if(Prado::getApplication() === null)
198
+			if(Prado::getApplication()===null)
199 199
 			{
200
-				$app = new PradoShellApplication($app_dir);
200
+				$app=new PradoShellApplication($app_dir);
201 201
 				$app->run();
202
-				$dir = substr(str_replace(realpath('./'), '', $app_dir), 1);
202
+				$dir=substr(str_replace(realpath('./'), '', $app_dir), 1);
203 203
 				PradoCommandLineInterpreter::printGreeting();
204
-				echo '** Loaded PRADO appplication in directory "' . $dir . "\".\n";
204
+				echo '** Loaded PRADO appplication in directory "'.$dir."\".\n";
205 205
 			}
206 206
 
207 207
 			return Prado::getApplication();
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 		else
210 210
 		{
211 211
 			PradoCommandLineInterpreter::printGreeting();
212
-			echo '+' . str_repeat('-', 77) . "+\n";
213
-			echo '** Unable to load PRADO application in directory "' . $directory . "\".\n";
214
-			echo '+' . str_repeat('-', 77) . "+\n";
212
+			echo '+'.str_repeat('-', 77)."+\n";
213
+			echo '** Unable to load PRADO application in directory "'.$directory."\".\n";
214
+			echo '+'.str_repeat('-', 77)."+\n";
215 215
 		}
216 216
 		return false;
217 217
 	}
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
  */
227 227
 class PradoCommandLineCreateProject extends PradoCommandLineAction
228 228
 {
229
-	protected $action = '-c';
230
-	protected $parameters = ['directory'];
231
-	protected $optional = [];
232
-	protected $description = 'Creates a Prado project skeleton for the given <directory>.';
229
+	protected $action='-c';
230
+	protected $parameters=['directory'];
231
+	protected $optional=[];
232
+	protected $description='Creates a Prado project skeleton for the given <directory>.';
233 233
 
234 234
 	public function performAction($args)
235 235
 	{
@@ -243,25 +243,25 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	protected function createNewPradoProject($dir)
245 245
 	{
246
-		if(strlen(trim($dir)) == 0)
246
+		if(strlen(trim($dir))==0)
247 247
 			return;
248 248
 
249
-		$rootPath = realpath(dirname(trim($dir)));
249
+		$rootPath=realpath(dirname(trim($dir)));
250 250
 
251
-		if(basename($dir) !== '.')
252
-			$basePath = $rootPath . DIRECTORY_SEPARATOR . basename($dir);
251
+		if(basename($dir)!=='.')
252
+			$basePath=$rootPath.DIRECTORY_SEPARATOR.basename($dir);
253 253
 		else
254
-			$basePath = $rootPath;
255
-		$appName = basename($basePath);
256
-		$assetPath = $basePath . DIRECTORY_SEPARATOR . 'assets';
257
-		$protectedPath = $basePath . DIRECTORY_SEPARATOR . 'protected';
258
-		$runtimePath = $basePath . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'runtime';
259
-		$pagesPath = $protectedPath . DIRECTORY_SEPARATOR . 'pages';
260
-
261
-		$indexFile = $basePath . DIRECTORY_SEPARATOR . 'index.php';
262
-		$htaccessFile = $protectedPath . DIRECTORY_SEPARATOR . '.htaccess';
263
-		$configFile = $protectedPath . DIRECTORY_SEPARATOR . 'application.xml';
264
-		$defaultPageFile = $pagesPath . DIRECTORY_SEPARATOR . 'Home.page';
254
+			$basePath=$rootPath;
255
+		$appName=basename($basePath);
256
+		$assetPath=$basePath.DIRECTORY_SEPARATOR.'assets';
257
+		$protectedPath=$basePath.DIRECTORY_SEPARATOR.'protected';
258
+		$runtimePath=$basePath.DIRECTORY_SEPARATOR.'protected'.DIRECTORY_SEPARATOR.'runtime';
259
+		$pagesPath=$protectedPath.DIRECTORY_SEPARATOR.'pages';
260
+
261
+		$indexFile=$basePath.DIRECTORY_SEPARATOR.'index.php';
262
+		$htaccessFile=$protectedPath.DIRECTORY_SEPARATOR.'.htaccess';
263
+		$configFile=$protectedPath.DIRECTORY_SEPARATOR.'application.xml';
264
+		$defaultPageFile=$pagesPath.DIRECTORY_SEPARATOR.'Home.page';
265 265
 
266 266
 		$this->createDirectory($basePath, 0755);
267 267
 		$this->createDirectory($assetPath, 0777);
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
 
278 278
 	protected function renderIndexFile()
279 279
 	{
280
-		$framework = realpath(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR . 'prado.php';
280
+		$framework=realpath(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'framework'.DIRECTORY_SEPARATOR.'prado.php';
281 281
 return '<?php
282 282
 
283
-$frameworkPath=\'' . $framework . '\';
283
+$frameworkPath=\'' . $framework.'\';
284 284
 
285 285
 // The following directory checks may be removed if performance is required
286 286
 $basePath=dirname(__FILE__);
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
  */
377 377
 class PradoCommandLineCreateTests extends PradoCommandLineAction
378 378
 {
379
-	protected $action = '-t';
380
-	protected $parameters = ['directory'];
381
-	protected $optional = [];
382
-	protected $description = 'Create test fixtures in the given <directory>.';
379
+	protected $action='-t';
380
+	protected $parameters=['directory'];
381
+	protected $optional=[];
382
+	protected $description='Create test fixtures in the given <directory>.';
383 383
 
384 384
 	public function performAction($args)
385 385
 	{
@@ -390,22 +390,22 @@  discard block
 block discarded – undo
390 390
 
391 391
 	protected function createTestFixtures($dir)
392 392
 	{
393
-		if(strlen(trim($dir)) == 0)
393
+		if(strlen(trim($dir))==0)
394 394
 			return;
395 395
 
396
-		$rootPath = realpath(dirname(trim($dir)));
397
-		$basePath = $rootPath . '/' . basename($dir);
396
+		$rootPath=realpath(dirname(trim($dir)));
397
+		$basePath=$rootPath.'/'.basename($dir);
398 398
 
399
-		$tests = $basePath . '/tests';
400
-		$unit_tests = $tests . '/unit';
401
-		$functional_tests = $tests . '/functional';
399
+		$tests=$basePath.'/tests';
400
+		$unit_tests=$tests.'/unit';
401
+		$functional_tests=$tests.'/functional';
402 402
 
403 403
 		$this->createDirectory($tests, 0755);
404 404
 		$this->createDirectory($unit_tests, 0755);
405 405
 		$this->createDirectory($functional_tests, 0755);
406 406
 
407
-		$unit_test_index = $tests . '/unit.php';
408
-		$functional_test_index = $tests . '/functional.php';
407
+		$unit_test_index=$tests.'/unit.php';
408
+		$functional_test_index=$tests.'/functional.php';
409 409
 
410 410
 		$this->createFile($unit_test_index, $this->renderUnitTestFixture());
411 411
 		$this->createFile($functional_test_index, $this->renderFunctionalTestFixture());
@@ -413,10 +413,10 @@  discard block
 block discarded – undo
413 413
 
414 414
 	protected function renderUnitTestFixture()
415 415
 	{
416
-		$tester = realpath(dirname(dirname(__FILE__))) . '/tests/test_tools/unit_tests.php';
416
+		$tester=realpath(dirname(dirname(__FILE__))).'/tests/test_tools/unit_tests.php';
417 417
 return '<?php
418 418
 
419
-include_once \'' . $tester . '\';
419
+include_once \'' . $tester.'\';
420 420
 
421 421
 $app_directory = "../protected";
422 422
 $test_cases = dirname(__FILE__)."/unit";
@@ -428,10 +428,10 @@  discard block
 block discarded – undo
428 428
 
429 429
 	protected function renderFunctionalTestFixture()
430 430
 	{
431
-		$tester = realpath(dirname(dirname(__FILE__))) . '/tests/test_tools/functional_tests.php';
431
+		$tester=realpath(dirname(dirname(__FILE__))).'/tests/test_tools/functional_tests.php';
432 432
 return '<?php
433 433
 
434
-include_once \'' . $tester . '\';
434
+include_once \'' . $tester.'\';
435 435
 
436 436
 $test_cases = dirname(__FILE__)."/functional";
437 437
 
@@ -450,10 +450,10 @@  discard block
 block discarded – undo
450 450
  */
451 451
 class PradoCommandLinePhpShell extends PradoCommandLineAction
452 452
 {
453
-	protected $action = 'shell';
454
-	protected $parameters = [];
455
-	protected $optional = ['directory'];
456
-	protected $description = 'Runs a PHP interactive interpreter. Initializes the Prado application in the given [directory].';
453
+	protected $action='shell';
454
+	protected $parameters=[];
455
+	protected $optional=['directory'];
456
+	protected $description='Runs a PHP interactive interpreter. Initializes the Prado application in the given [directory].';
457 457
 
458 458
 	public function performAction($args)
459 459
 	{
@@ -473,112 +473,112 @@  discard block
 block discarded – undo
473 473
  */
474 474
 class PradoCommandLineActiveRecordGen extends PradoCommandLineAction
475 475
 {
476
-	protected $action = 'generate';
477
-	protected $parameters = ['table', 'output'];
478
-	protected $optional = ['directory', 'soap'];
479
-	protected $description = 'Generate Active Record skeleton for <table> to <output> file using application.xml in [directory]. May also generate [soap] properties.';
480
-	private $_soap = false;
476
+	protected $action='generate';
477
+	protected $parameters=['table', 'output'];
478
+	protected $optional=['directory', 'soap'];
479
+	protected $description='Generate Active Record skeleton for <table> to <output> file using application.xml in [directory]. May also generate [soap] properties.';
480
+	private $_soap=false;
481 481
 
482 482
 	public function performAction($args)
483 483
 	{
484
-		$app_dir = count($args) > 3 ? $this->getAppDir($args[3]) : $this->getAppDir();
485
-		$this->_soap = count($args) > 4;
486
-		if($app_dir !== false)
484
+		$app_dir=count($args) > 3 ? $this->getAppDir($args[3]) : $this->getAppDir();
485
+		$this->_soap=count($args) > 4;
486
+		if($app_dir!==false)
487 487
 		{
488
-			$config = $this->getActiveRecordConfig($app_dir);
489
-			$output = $this->getOutputFile($app_dir, $args[2]);
488
+			$config=$this->getActiveRecordConfig($app_dir);
489
+			$output=$this->getOutputFile($app_dir, $args[2]);
490 490
 			if(is_file($output))
491 491
 				echo "** File $output already exists, skiping. \n";
492
-			elseif($config !== false && $output !== false)
492
+			elseif($config!==false && $output!==false)
493 493
 				$this->generateActiveRecord($config, $args[1], $output);
494 494
 		}
495 495
 		return true;
496 496
 	}
497 497
 
498
-	protected function getAppDir($dir = ".")
498
+	protected function getAppDir($dir=".")
499 499
 	{
500 500
 		if(is_dir($dir))
501 501
 			return realpath($dir);
502
-		if(false !== ($app_dir = realpath($dir . '/protected/')) && is_dir($app_dir))
502
+		if(false!==($app_dir=realpath($dir.'/protected/')) && is_dir($app_dir))
503 503
 			return $app_dir;
504
-		echo '** Unable to find directory "' . $dir . "\".\n";
504
+		echo '** Unable to find directory "'.$dir."\".\n";
505 505
 		return false;
506 506
 	}
507 507
 
508 508
 	protected function getXmlFile($app_dir)
509 509
 	{
510
-		if(false !== ($xml = realpath($app_dir . '/application.xml')) && is_file($xml))
510
+		if(false!==($xml=realpath($app_dir.'/application.xml')) && is_file($xml))
511 511
 			return $xml;
512
-		if(false !== ($xml = realpath($app_dir . '/protected/application.xml')) && is_file($xml))
512
+		if(false!==($xml=realpath($app_dir.'/protected/application.xml')) && is_file($xml))
513 513
 			return $xml;
514
-		echo '** Unable to find application.xml in ' . $app_dir . "\n";
514
+		echo '** Unable to find application.xml in '.$app_dir."\n";
515 515
 		return false;
516 516
 	}
517 517
 
518 518
 	protected function getActiveRecordConfig($app_dir)
519 519
 	{
520
-		if(false === ($xml = $this->getXmlFile($app_dir)))
520
+		if(false===($xml=$this->getXmlFile($app_dir)))
521 521
 			return false;
522
-		if(false !== ($app = $this->initializePradoApplication($app_dir)))
522
+		if(false!==($app=$this->initializePradoApplication($app_dir)))
523 523
 		{
524 524
 			Prado::using('System.Data.ActiveRecord.TActiveRecordConfig');
525 525
 			foreach($app->getModules() as $module)
526 526
 				if($module instanceof TActiveRecordConfig)
527 527
 					return $module;
528
-			echo '** Unable to find TActiveRecordConfig module in ' . $xml . "\n";
528
+			echo '** Unable to find TActiveRecordConfig module in '.$xml."\n";
529 529
 		}
530 530
 		return false;
531 531
 	}
532 532
 
533 533
 	protected function getOutputFile($app_dir, $namespace)
534 534
 	{
535
-		if(is_file($namespace) && strpos($namespace, $app_dir) === 0)
535
+		if(is_file($namespace) && strpos($namespace, $app_dir)===0)
536 536
 				return $namespace;
537
-		$file = Prado::getPathOfNamespace($namespace, ".php");
538
-		if($file !== null && false !== ($path = realpath(dirname($file))) && is_dir($path))
537
+		$file=Prado::getPathOfNamespace($namespace, ".php");
538
+		if($file!==null && false!==($path=realpath(dirname($file))) && is_dir($path))
539 539
 		{
540
-			if(strpos($path, $app_dir) === 0)
540
+			if(strpos($path, $app_dir)===0)
541 541
 				return $file;
542 542
 		}
543
-		echo '** Output file ' . $file . ' must be within directory ' . $app_dir . "\n";
543
+		echo '** Output file '.$file.' must be within directory '.$app_dir."\n";
544 544
 		return false;
545 545
 	}
546 546
 
547 547
 	protected function generateActiveRecord($config, $tablename, $output)
548 548
 	{
549
-		$manager = TActiveRecordManager::getInstance();
549
+		$manager=TActiveRecordManager::getInstance();
550 550
 		if($manager->getDbConnection()) {
551
-			$gateway = $manager->getRecordGateway();
552
-			$tableInfo = $gateway->getTableInfo($manager->getDbConnection(), $tablename);
553
-			if(count($tableInfo->getColumns()) === 0)
551
+			$gateway=$manager->getRecordGateway();
552
+			$tableInfo=$gateway->getTableInfo($manager->getDbConnection(), $tablename);
553
+			if(count($tableInfo->getColumns())===0)
554 554
 			{
555
-				echo '** Unable to find table or view "' . $tablename . '" in "' . $manager->getDbConnection()->getConnectionString() . "\".\n";
555
+				echo '** Unable to find table or view "'.$tablename.'" in "'.$manager->getDbConnection()->getConnectionString()."\".\n";
556 556
 				return false;
557 557
 			}
558 558
 			else
559 559
 			{
560
-				$properties = [];
560
+				$properties=[];
561 561
 				foreach($tableInfo->getColumns() as $field => $column)
562
-					$properties[] = $this->generateProperty($field, $column);
562
+					$properties[]=$this->generateProperty($field, $column);
563 563
 			}
564 564
 
565
-			$classname = basename($output, '.php');
566
-			$class = $this->generateClass($properties, $tablename, $classname);
565
+			$classname=basename($output, '.php');
566
+			$class=$this->generateClass($properties, $tablename, $classname);
567 567
 			echo "  Writing class $classname to file $output\n";
568 568
 			file_put_contents($output, $class);
569 569
 		} else {
570
-			echo '** Unable to connect to database with ConnectionID=\'' . $config->getConnectionID() . "'. Please check your settings in application.xml and ensure your database connection is set up first.\n";
570
+			echo '** Unable to connect to database with ConnectionID=\''.$config->getConnectionID()."'. Please check your settings in application.xml and ensure your database connection is set up first.\n";
571 571
 		}
572 572
 	}
573 573
 
574 574
 	protected function generateProperty($field, $column)
575 575
 	{
576
-		$prop = '';
577
-		$name = '$' . $field;
578
-		$type = $column->getPHPType();
576
+		$prop='';
577
+		$name='$'.$field;
578
+		$type=$column->getPHPType();
579 579
 		if($this->_soap)
580 580
 		{
581
-			$prop .= <<<EOD
581
+			$prop.=<<<EOD
582 582
 
583 583
 	/**
584 584
 	 * @var $type $name
@@ -587,14 +587,14 @@  discard block
 block discarded – undo
587 587
 
588 588
 EOD;
589 589
 		}
590
-		$prop .= "\tpublic $name;";
590
+		$prop.="\tpublic $name;";
591 591
 		return $prop;
592 592
 	}
593 593
 
594 594
 	protected function generateClass($properties, $tablename, $class)
595 595
 	{
596
-		$props = implode("\n", $properties);
597
-		$date = date('Y-m-d h:i:s');
596
+		$props=implode("\n", $properties);
597
+		$date=date('Y-m-d h:i:s');
598 598
 return <<<EOD
599 599
 <?php
600 600
 /**
@@ -625,38 +625,38 @@  discard block
 block discarded – undo
625 625
  */
626 626
 class PradoCommandLineActiveRecordGenAll extends PradoCommandLineAction
627 627
 {
628
-	protected $action = 'generateAll';
629
-	protected $parameters = ['output'];
630
-	protected $optional = ['directory', 'soap', 'overwrite', 'prefix', 'postfix'];
631
-	protected $description = "Generate Active Record skeleton for all Tables to <output> file using application.xml in [directory]. May also generate [soap] properties.\nGenerated Classes are named like the Table with optional [Prefix] and/or [Postfix]. [Overwrite] is used to overwrite existing Files.";
632
-	private $_soap = false;
633
-	private $_prefix = '';
634
-	private $_postfix = '';
635
-	private $_overwrite = false;
628
+	protected $action='generateAll';
629
+	protected $parameters=['output'];
630
+	protected $optional=['directory', 'soap', 'overwrite', 'prefix', 'postfix'];
631
+	protected $description="Generate Active Record skeleton for all Tables to <output> file using application.xml in [directory]. May also generate [soap] properties.\nGenerated Classes are named like the Table with optional [Prefix] and/or [Postfix]. [Overwrite] is used to overwrite existing Files.";
632
+	private $_soap=false;
633
+	private $_prefix='';
634
+	private $_postfix='';
635
+	private $_overwrite=false;
636 636
 
637 637
 	public function performAction($args) {
638
-		$app_dir = count($args) > 2 ? $this->getAppDir($args[2]) : $this->getAppDir();
639
-		$this->_soap = count($args) > 3 ? ($args[3] == "soap" || $args[3] == "true" ? true : false) : false;
640
-		$this->_overwrite = count($args) > 4 ? ($args[4] == "overwrite" || $args[4] == "true" ? true : false) : false;
641
-		$this->_prefix = count($args) > 5 ? $args[5] : '';
642
-		$this->_postfix = count($args) > 6 ? $args[6] : '';
638
+		$app_dir=count($args) > 2 ? $this->getAppDir($args[2]) : $this->getAppDir();
639
+		$this->_soap=count($args) > 3 ? ($args[3]=="soap" || $args[3]=="true" ? true : false) : false;
640
+		$this->_overwrite=count($args) > 4 ? ($args[4]=="overwrite" || $args[4]=="true" ? true : false) : false;
641
+		$this->_prefix=count($args) > 5 ? $args[5] : '';
642
+		$this->_postfix=count($args) > 6 ? $args[6] : '';
643 643
 
644
-		if ($app_dir !== false) {
645
-			$config = $this->getActiveRecordConfig($app_dir);
644
+		if($app_dir!==false) {
645
+			$config=$this->getActiveRecordConfig($app_dir);
646 646
 
647
-			$manager = TActiveRecordManager::getInstance();
648
-			$con = $manager->getDbConnection();
649
-			$con->Active = true;
647
+			$manager=TActiveRecordManager::getInstance();
648
+			$con=$manager->getDbConnection();
649
+			$con->Active=true;
650 650
 
651 651
 			switch($con->getDriverName())
652 652
 			   {
653 653
 				case 'mysqli':
654 654
 				case 'mysql':
655
-					$command = $con->createCommand("SHOW TABLES");
655
+					$command=$con->createCommand("SHOW TABLES");
656 656
 					break;
657 657
 				case 'sqlite': //sqlite 3
658 658
 				case 'sqlite2': //sqlite 2
659
-					$command = $con->createCommand("SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'");
659
+					$command=$con->createCommand("SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'");
660 660
 					break;
661 661
 				case 'pgsql':
662 662
 				case 'mssql': // Mssql driver on windows hosts
@@ -665,21 +665,21 @@  discard block
 block discarded – undo
665 665
 				case 'oci':
666 666
 //				case 'ibm':
667 667
 				default:
668
-					echo "\n    Sorry, generateAll is not implemented for " . $con->getDriverName() . "\n";
668
+					echo "\n    Sorry, generateAll is not implemented for ".$con->getDriverName()."\n";
669 669
 					
670 670
 			   }
671 671
 
672
-			$dataReader = $command->query();
672
+			$dataReader=$command->query();
673 673
 			$dataReader->bindColumn(1, $table);
674
-			$tables = [];
675
-			while ($dataReader->read() !== false) {
676
-				$tables[] = $table;
674
+			$tables=[];
675
+			while($dataReader->read()!==false) {
676
+				$tables[]=$table;
677 677
 			}
678
-			$con->Active = false;
679
-			foreach ($tables as $key => $table) {
680
-				$output = $args[1] . "." . $this->_prefix . ucfirst($table) . $this->_postfix;
681
-				if ($config !== false && $output !== false) {
682
-					$this->generate("generate " . $table . " " . $output . " " . $this->_soap . " " . $this->_overwrite);
678
+			$con->Active=false;
679
+			foreach($tables as $key => $table) {
680
+				$output=$args[1].".".$this->_prefix.ucfirst($table).$this->_postfix;
681
+				if($config!==false && $output!==false) {
682
+					$this->generate("generate ".$table." ".$output." ".$this->_soap." ".$this->_overwrite);
683 683
 				}
684 684
 			}
685 685
 		}
@@ -688,16 +688,16 @@  discard block
 block discarded – undo
688 688
 
689 689
 	public function generate($l)
690 690
 	{
691
-		$input = explode(" ", trim($l));
691
+		$input=explode(" ", trim($l));
692 692
 		if(count($input) > 2)
693 693
 		{
694
-			$app_dir = '.';
695
-			if(Prado::getApplication() !== null)
696
-				$app_dir = dirname(Prado::getApplication()->getBasePath());
697
-			$args = [$input[0],$input[1], $input[2],$app_dir];
694
+			$app_dir='.';
695
+			if(Prado::getApplication()!==null)
696
+				$app_dir=dirname(Prado::getApplication()->getBasePath());
697
+			$args=[$input[0], $input[1], $input[2], $app_dir];
698 698
 			if(count($input) > 3)
699
-				$args = [$input[0],$input[1], $input[2],$app_dir,'soap'];
700
-			$cmd = new PradoCommandLineActiveRecordGen;
699
+				$args=[$input[0], $input[1], $input[2], $app_dir, 'soap'];
700
+			$cmd=new PradoCommandLineActiveRecordGen;
701 701
 			$cmd->performAction($args);
702 702
 		}
703 703
 		else
@@ -706,46 +706,46 @@  discard block
 block discarded – undo
706 706
 		}
707 707
 	}
708 708
 
709
-	protected function getAppDir($dir = ".") {
710
-		if (is_dir($dir))
709
+	protected function getAppDir($dir=".") {
710
+		if(is_dir($dir))
711 711
 			return realpath($dir);
712
-		if (false !== ($app_dir = realpath($dir . '/protected/')) && is_dir($app_dir))
712
+		if(false!==($app_dir=realpath($dir.'/protected/')) && is_dir($app_dir))
713 713
 			return $app_dir;
714
-		echo '** Unable to find directory "' . $dir . "\".\n";
714
+		echo '** Unable to find directory "'.$dir."\".\n";
715 715
 		return false;
716 716
 	}
717 717
 
718 718
 	protected function getXmlFile($app_dir) {
719
-		if (false !== ($xml = realpath($app_dir . '/application.xml')) && is_file($xml))
719
+		if(false!==($xml=realpath($app_dir.'/application.xml')) && is_file($xml))
720 720
 			return $xml;
721
-		if (false !== ($xml = realpath($app_dir . '/protected/application.xml')) && is_file($xml))
721
+		if(false!==($xml=realpath($app_dir.'/protected/application.xml')) && is_file($xml))
722 722
 			return $xml;
723
-		echo '** Unable to find application.xml in ' . $app_dir . "\n";
723
+		echo '** Unable to find application.xml in '.$app_dir."\n";
724 724
 		return false;
725 725
 	}
726 726
 
727 727
 	protected function getActiveRecordConfig($app_dir) {
728
-		if (false === ($xml = $this->getXmlFile($app_dir)))
728
+		if(false===($xml=$this->getXmlFile($app_dir)))
729 729
 			return false;
730
-		if (false !== ($app = $this->initializePradoApplication($app_dir))) {
730
+		if(false!==($app=$this->initializePradoApplication($app_dir))) {
731 731
 			Prado::using('System.Data.ActiveRecord.TActiveRecordConfig');
732
-			foreach ($app->getModules() as $module)
733
-				if ($module instanceof TActiveRecordConfig)
732
+			foreach($app->getModules() as $module)
733
+				if($module instanceof TActiveRecordConfig)
734 734
 					return $module;
735
-			echo '** Unable to find TActiveRecordConfig module in ' . $xml . "\n";
735
+			echo '** Unable to find TActiveRecordConfig module in '.$xml."\n";
736 736
 		}
737 737
 		return false;
738 738
 	}
739 739
 
740 740
 	protected function getOutputFile($app_dir, $namespace) {
741
-		if (is_file($namespace) && strpos($namespace, $app_dir) === 0)
741
+		if(is_file($namespace) && strpos($namespace, $app_dir)===0)
742 742
 			return $namespace;
743
-		$file = Prado::getPathOfNamespace($namespace, "");
744
-		if ($file !== null && false !== ($path = realpath(dirname($file))) && is_dir($path)) {
745
-			if (strpos($path, $app_dir) === 0)
743
+		$file=Prado::getPathOfNamespace($namespace, "");
744
+		if($file!==null && false!==($path=realpath(dirname($file))) && is_dir($path)) {
745
+			if(strpos($path, $app_dir)===0)
746 746
 				return $file;
747 747
 		}
748
-		echo '** Output file ' . $file . ' must be within directory ' . $app_dir . "\n";
748
+		echo '** Output file '.$file.' must be within directory '.$app_dir."\n";
749 749
 		return false;
750 750
 	}
751 751
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -103,8 +103,7 @@  discard block
 block discarded – undo
103 103
 			{
104 104
 				$valid |= $action->performAction($args);
105 105
 				break;
106
-			}
107
-			else
106
+			} else
108 107
 			{
109 108
 				$valid = false;
110 109
 			}
@@ -205,8 +204,7 @@  discard block
 block discarded – undo
205 204
 			}
206 205
 
207 206
 			return Prado::getApplication();
208
-		}
209
-		else
207
+		} else
210 208
 		{
211 209
 			PradoCommandLineInterpreter::printGreeting();
212 210
 			echo '+' . str_repeat('-', 77) . "+\n";
@@ -554,8 +552,7 @@  discard block
 block discarded – undo
554 552
 			{
555 553
 				echo '** Unable to find table or view "' . $tablename . '" in "' . $manager->getDbConnection()->getConnectionString() . "\".\n";
556 554
 				return false;
557
-			}
558
-			else
555
+			} else
559 556
 			{
560 557
 				$properties = [];
561 558
 				foreach($tableInfo->getColumns() as $field => $column)
@@ -699,8 +696,7 @@  discard block
 block discarded – undo
699 696
 				$args = [$input[0],$input[1], $input[2],$app_dir,'soap'];
700 697
 			$cmd = new PradoCommandLineActiveRecordGen;
701 698
 			$cmd->performAction($args);
702
-		}
703
-		else
699
+		} else
704 700
 		{
705 701
 			echo "\n    Usage: generate table_name Application.pages.RecordClassName\n";
706 702
 		}
Please login to merge, or discard this patch.
framework/Caching/ICache.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -47,6 +47,7 @@
 block discarded – undo
47 47
 	 * @param mixed the value to be cached
48 48
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
49 49
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid.
50
+	 * @param string $id
50 51
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
51 52
 	 */
52 53
 	public function add($id, $value, $expire = 0, $dependency = null);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid.
40 40
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
41 41
 	 */
42
-	public function set($id, $value, $expire = 0, $dependency = null);
42
+	public function set($id, $value, $expire=0, $dependency=null);
43 43
 	/**
44 44
 	 * Stores a value identified by a key into cache if the cache does not contain this key.
45 45
 	 * Nothing will be done if the cache already contains the key.
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid.
50 50
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
51 51
 	 */
52
-	public function add($id, $value, $expire = 0, $dependency = null);
52
+	public function add($id, $value, $expire=0, $dependency=null);
53 53
 	/**
54 54
 	 * Deletes a value with the specified key from cache
55 55
 	 * @param string the key of the value to be deleted
Please login to merge, or discard this patch.
framework/Caching/TCache.php 2 patches
Doc Comments   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 	/**
112 112
 	 * @param string a key identifying a value to be cached
113
-	 * @return sring a key generated from the provided key which ensures the uniqueness across applications
113
+	 * @return string a key generated from the provided key which ensures the uniqueness across applications
114 114
 	 */
115 115
 	protected function generateUniqueKey($key)
116 116
 	{
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param mixed the value to be cached
145 145
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
146 146
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labeled invalid.
147
-	 * @return boolean true if the value is successfully stored into cache, false otherwise
147
+	 * @return null|boolean true if the value is successfully stored into cache, false otherwise
148 148
 	 */
149 149
 	public function set($id, $value, $expire = 0, $dependency = null)
150 150
 	{
@@ -202,6 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * in {@link get()} already. So only the implementation of data retrieval
203 203
 	 * is needed.
204 204
 	 * @param string a unique key identifying the cached value
205
+	 * @param string $key
205 206
 	 * @return string the value stored in cache, false if the value is not in the cache or expired.
206 207
 	 */
207 208
 	abstract protected function getValue($key);
@@ -216,6 +217,8 @@  discard block
 block discarded – undo
216 217
 	 * @param string the key identifying the value to be cached
217 218
 	 * @param string the value to be cached
218 219
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
220
+	 * @param string $key
221
+	 * @param integer $expire
219 222
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
220 223
 	 */
221 224
 	abstract protected function setValue($key, $value, $expire);
@@ -230,6 +233,8 @@  discard block
 block discarded – undo
230 233
 	 * @param string the key identifying the value to be cached
231 234
 	 * @param string the value to be cached
232 235
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
236
+	 * @param string $key
237
+	 * @param integer $expire
233 238
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
234 239
 	 */
235 240
 	abstract protected function addValue($key, $value, $expire);
@@ -238,6 +243,7 @@  discard block
 block discarded – undo
238 243
 	 * Deletes a value with the specified key from cache
239 244
 	 * This method should be implemented by child classes to delete the data from actual cache storage.
240 245
 	 * @param string the key of the value to be deleted
246
+	 * @param string $key
241 247
 	 * @return boolean if no error happens during deletion
242 248
 	 */
243 249
 	abstract protected function deleteValue($key);
@@ -281,7 +287,7 @@  discard block
 block discarded – undo
281 287
 	 * Deletes the value with the specified key from cache
282 288
 	 * This method is required by the interface \ArrayAccess.
283 289
 	 * @param string the key of the value to be deleted
284
-	 * @return boolean if no error happens during deletion
290
+	 * @return boolean|null if no error happens during deletion
285 291
 	 */
286 292
 	public function offsetUnset($id)
287 293
 	{
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 abstract class TCache extends \Prado\TModule implements ICache, \ArrayAccess
52 52
 {
53 53
 	private $_prefix;
54
-	private $_primary = true;
54
+	private $_primary=true;
55 55
 
56 56
 	/**
57 57
 	 * Initializes the cache module.
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function init($config)
63 63
 	{
64
-		if($this->_prefix === null)
65
-			$this->_prefix = $this->getApplication()->getUniqueID();
64
+		if($this->_prefix===null)
65
+			$this->_prefix=$this->getApplication()->getUniqueID();
66 66
 		if($this->_primary)
67 67
 		{
68
-			if($this->getApplication()->getCache() === null)
68
+			if($this->getApplication()->getCache()===null)
69 69
 				$this->getApplication()->setCache($this);
70 70
 			else
71 71
 				throw new TConfigurationException('cache_primary_duplicated', get_class($this));
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function setPrimaryCache($value)
90 90
 	{
91
-		$this->_primary = TPropertyValue::ensureBoolean($value);
91
+		$this->_primary=TPropertyValue::ensureBoolean($value);
92 92
 	}
93 93
 
94 94
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function setKeyPrefix($value)
107 107
 	{
108
-		$this->_prefix = $value;
108
+		$this->_prefix=$value;
109 109
 	}
110 110
 
111 111
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	protected function generateUniqueKey($key)
116 116
 	{
117
-		return md5($this->_prefix . $key);
117
+		return md5($this->_prefix.$key);
118 118
 	}
119 119
 
120 120
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function get($id)
126 126
 	{
127
-		if(($data = $this->getValue($this->generateUniqueKey($id))) !== false)
127
+		if(($data=$this->getValue($this->generateUniqueKey($id)))!==false)
128 128
 		{
129 129
 			if(!is_array($data))
130 130
 				return false;
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labeled invalid.
147 147
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
148 148
 	 */
149
-	public function set($id, $value, $expire = 0, $dependency = null)
149
+	public function set($id, $value, $expire=0, $dependency=null)
150 150
 	{
151
-		if(empty($value) && $expire === 0)
151
+		if(empty($value) && $expire===0)
152 152
 			$this->delete($id);
153 153
 		else
154 154
 		{
155
-			$data = [$value,$dependency];
155
+			$data=[$value, $dependency];
156 156
 			return $this->setValue($this->generateUniqueKey($id), $data, $expire);
157 157
 		}
158 158
 	}
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labeled invalid.
167 167
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
168 168
 	 */
169
-	public function add($id, $value, $expire = 0, $dependency = null)
169
+	public function add($id, $value, $expire=0, $dependency=null)
170 170
 	{
171
-		if(empty($value) && $expire === 0)
171
+		if(empty($value) && $expire===0)
172 172
 			return false;
173
-		$data = [$value,$dependency];
173
+		$data=[$value, $dependency];
174 174
 		return $this->addValue($this->generateUniqueKey($id), $data, $expire);
175 175
 	}
176 176
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function offsetExists($id)
252 252
 	{
253
-		return $this->get($id) !== false;
253
+		return $this->get($id)!==false;
254 254
 	}
255 255
 
256 256
 	/**
Please login to merge, or discard this patch.
framework/Caching/TDirectoryCacheDependency.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -124,6 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * By default, it always returns true, meaning the file should be checked.
125 125
 	 * You may override this method to check only certain files.
126 126
 	 * @param string the name of the file that may be checked for dependency.
127
+	 * @param string $fileName
127 128
 	 * @return boolean whether this file should be checked.
128 129
 	 */
129 130
 	protected function validateFile($fileName)
@@ -137,6 +138,7 @@  discard block
 block discarded – undo
137 138
 	 * By default, it always returns true, meaning the subdirectory should be checked.
138 139
 	 * You may override this method to check only certain subdirectories.
139 140
 	 * @param string the name of the subdirectory that may be checked for dependency.
141
+	 * @param string $directory
140 142
 	 * @return boolean whether this subdirectory should be checked.
141 143
 	 */
142 144
 	protected function validateDirectory($directory)
@@ -150,6 +152,7 @@  discard block
 block discarded – undo
150 152
 	 * {@link setRecursiveCheck RecursiveCheck} is set true.
151 153
 	 * @param string the directory name
152 154
 	 * @param int level of the recursion
155
+	 * @param string $directory
153 156
 	 * @return array list of file modification time indexed by the file path
154 157
 	 */
155 158
 	protected function generateTimestamps($directory, $level = 0)
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class TDirectoryCacheDependency extends TCacheDependency
37 37
 {
38
-	private $_recursiveCheck = true;
39
-	private $_recursiveLevel = -1;
38
+	private $_recursiveCheck=true;
39
+	private $_recursiveLevel=-1;
40 40
 	private $_timestamps;
41 41
 	private $_directory;
42 42
 
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function setDirectory($directory)
65 65
 	{
66
-		if(($path = realpath($directory)) === false || !is_dir($path))
66
+		if(($path=realpath($directory))===false || !is_dir($path))
67 67
 			throw new TInvalidDataValueException('directorycachedependency_directory_invalid', $directory);
68
-		$this->_directory = $path;
69
-		$this->_timestamps = $this->generateTimestamps($path);
68
+		$this->_directory=$path;
69
+		$this->_timestamps=$this->generateTimestamps($path);
70 70
 	}
71 71
 
72 72
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function setRecursiveCheck($value)
85 85
 	{
86
-		$this->_recursiveCheck = TPropertyValue::ensureBoolean($value);
86
+		$this->_recursiveCheck=TPropertyValue::ensureBoolean($value);
87 87
 	}
88 88
 
89 89
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function setRecursiveLevel($value)
107 107
 	{
108
-		$this->_recursiveLevel = TPropertyValue::ensureInteger($value);
108
+		$this->_recursiveLevel=TPropertyValue::ensureInteger($value);
109 109
 	}
110 110
 
111 111
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function getHasChanged()
117 117
 	{
118
-		return $this->generateTimestamps($this->_directory) != $this->_timestamps;
118
+		return $this->generateTimestamps($this->_directory)!=$this->_timestamps;
119 119
 	}
120 120
 
121 121
 	/**
@@ -152,23 +152,23 @@  discard block
 block discarded – undo
152 152
 	 * @param int level of the recursion
153 153
 	 * @return array list of file modification time indexed by the file path
154 154
 	 */
155
-	protected function generateTimestamps($directory, $level = 0)
155
+	protected function generateTimestamps($directory, $level=0)
156 156
 	{
157
-		if(($dir = opendir($directory)) === false)
157
+		if(($dir=opendir($directory))===false)
158 158
 			throw new TIOException('directorycachedependency_directory_invalid', $directory);
159
-		$timestamps = [];
160
-		while(($file = readdir($dir)) !== false)
159
+		$timestamps=[];
160
+		while(($file=readdir($dir))!==false)
161 161
 		{
162
-			$path = $directory . DIRECTORY_SEPARATOR . $file;
163
-			if($file === '.' || $file === '..')
162
+			$path=$directory.DIRECTORY_SEPARATOR.$file;
163
+			if($file==='.' || $file==='..')
164 164
 				continue;
165 165
 			elseif(is_dir($path))
166 166
 			{
167 167
 				if(($this->_recursiveLevel < 0 || $level < $this->_recursiveLevel) && $this->validateDirectory($path))
168
-					$timestamps = array_merge($this->generateTimestamps($path, $level + 1));
168
+					$timestamps=array_merge($this->generateTimestamps($path, $level + 1));
169 169
 			}
170 170
 			elseif($this->validateFile($path))
171
-				$timestamps[$path] = filemtime($path);
171
+				$timestamps[$path]=filemtime($path);
172 172
 		}
173 173
 		closedir($dir);
174 174
 		return $timestamps;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,8 +166,7 @@
 block discarded – undo
166 166
 			{
167 167
 				if(($this->_recursiveLevel < 0 || $level < $this->_recursiveLevel) && $this->validateDirectory($path))
168 168
 					$timestamps = array_merge($this->generateTimestamps($path, $level + 1));
169
-			}
170
-			elseif($this->validateFile($path))
169
+			} elseif($this->validateFile($path))
171 170
 				$timestamps[$path] = filemtime($path);
172 171
 		}
173 172
 		closedir($dir);
Please login to merge, or discard this patch.
framework/Caching/TEtcdCache.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -206,6 +206,8 @@
 block discarded – undo
206 206
    * @param string the HTTP method for the request (GET,PUT,DELETE)
207 207
    * @param string the the key to perform the action on (includes the directory)
208 208
    * @param array the additional post data to send with the request
209
+   * @param string $method
210
+   * @param string $key
209 211
    * @return \stdClass the response from the etcd instance
210 212
    */
211 213
   protected function request($method, $key, $value = []) {
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
   /**
60 60
    * @var string the etcd host
61 61
    */
62
-  protected $_host = 'localhost';
62
+  protected $_host='localhost';
63 63
   
64 64
   /**
65 65
    * @var integer the etcd port
66 66
    */
67
-  protected $_port = 2379;
67
+  protected $_port=2379;
68 68
   
69 69
   /**
70 70
    * @var string the directory to store values in
71 71
    */
72
-  protected $_dir = 'pradocache';
72
+  protected $_dir='pradocache';
73 73
 
74 74
    /**
75 75
     * Initializes this module.
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     */
80 80
 	public function init($config)
81 81
 	{
82
-		if (!function_exists('curl_version')) throw new TConfigurationException('curl_extension_required');
82
+		if(!function_exists('curl_version')) throw new TConfigurationException('curl_extension_required');
83 83
 		parent::init($config);
84 84
 	}
85 85
   
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @param string $value the etcd host
97 97
 	 */
98 98
 	public function setHost($value) {
99
-	$this->_host = TPropertyValue::ensureString($value);
99
+	$this->_host=TPropertyValue::ensureString($value);
100 100
 	}
101 101
 	
102 102
   /**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @param integer $value the etcd port
113 113
 	 */
114 114
 	public function setPort($value) {
115
-	$this->_port = TPropertyValue::ensureInteger($value);
115
+	$this->_port=TPropertyValue::ensureInteger($value);
116 116
 	}
117 117
 	 
118 118
   /**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @param string $value the directory to store values in
129 129
 	 */
130 130
 	public function setDir($value) {
131
-	$this->_dir = TPropertyValue::ensureString($value);
131
+	$this->_dir=TPropertyValue::ensureString($value);
132 132
 	}
133 133
 
134 134
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function getValue($key)
141 141
 	{
142
-		$result = $this->request('GET', $this->_dir . '/' . $key);
142
+		$result=$this->request('GET', $this->_dir.'/'.$key);
143 143
 	return property_exists($result, 'errorCode') ? false : unserialize($result->node->value);
144 144
 	}
145 145
 
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	protected function setValue($key, $value, $expire)
156 156
 	{
157
-	$value = ['value' => serialize($value)];
158
-	if ($expire > 0) $value['ttl'] = $expire;
159
-		$result = $this->request('PUT', $this->_dir . '/' . $key, $value);
157
+	$value=['value' => serialize($value)];
158
+	if($expire > 0) $value['ttl']=$expire;
159
+		$result=$this->request('PUT', $this->_dir.'/'.$key, $value);
160 160
 	return !property_exists($result, 'errorCode');
161 161
 	}
162 162
 
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	protected function addValue($key, $value, $expire)
173 173
 	{
174
-	$value = ['value' => serialize($value), 'prevExist' => 'false'];
175
-	if ($expire > 0) $value['ttl'] = $expire;
176
-		$result = $this->request('PUT', $this->_dir . '/' . $key, $value);
174
+	$value=['value' => serialize($value), 'prevExist' => 'false'];
175
+	if($expire > 0) $value['ttl']=$expire;
176
+		$result=$this->request('PUT', $this->_dir.'/'.$key, $value);
177 177
 	return !property_exists($result, 'errorCode');
178 178
 	}
179 179
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	protected function deleteValue($key)
187 187
 	{
188
-		$this->request('DELETE', $this->_dir . '/' . $key);
188
+		$this->request('DELETE', $this->_dir.'/'.$key);
189 189
 	return true;
190 190
 	}
191 191
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function flush()
197 197
 	{
198
-	 $this->request('DELETE', $this->_dir . '?recursive=true');
198
+	 $this->request('DELETE', $this->_dir.'?recursive=true');
199 199
 	}
200 200
   
201 201
   /**
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
    * @param array the additional post data to send with the request
209 209
    * @return \stdClass the response from the etcd instance
210 210
    */
211
-  protected function request($method, $key, $value = []) {
212
-	$curl = curl_init("http://{$this->_host}:{$this->_port}/v2/keys/{$key}");
211
+  protected function request($method, $key, $value=[]) {
212
+	$curl=curl_init("http://{$this->_host}:{$this->_port}/v2/keys/{$key}");
213 213
 	curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
214 214
 	curl_setopt($curl, CURLOPT_HEADER, false);
215 215
 	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
216 216
 	curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
217 217
 	curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
218 218
 	curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($value));
219
-	$response = curl_exec($curl);
219
+	$response=curl_exec($curl);
220 220
 	curl_close($curl);
221 221
 	return json_decode($response);
222 222
   }
Please login to merge, or discard this patch.
framework/Collections/TPriorityMap.php 3 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,6 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	/**
121 121
 	 * @param boolean whether this list is read-only or not
122
+	 * @param boolean $value
122 123
 	 */
123 124
 	protected function setReadOnly($value)
124 125
 	{
@@ -136,6 +137,7 @@  discard block
 block discarded – undo
136 137
 	/**
137 138
 	 * This must be called internally or when instantiated.
138 139
 	 * @param numeric sets the default priority of inserted items without a specified priority
140
+	 * @param integer $value
139 141
 	 */
140 142
 	protected function setDefaultPriority($value)
141 143
 	{
@@ -153,6 +155,7 @@  discard block
 block discarded – undo
153 155
 	/**
154 156
 	 * This must be called internally or when instantiated.
155 157
 	 * @param integer The precision of numeric priorities.
158
+	 * @param integer $value
156 159
 	 */
157 160
 	protected function setPrecision($value)
158 161
 	{
@@ -162,7 +165,7 @@  discard block
 block discarded – undo
162 165
 	/**
163 166
 	 * Returns an iterator for traversing the items in the map.
164 167
 	 * This method is required by the interface \IteratorAggregate.
165
-	 * @return Iterator an iterator for traversing the items in the map.
168
+	 * @return \ArrayIterator an iterator for traversing the items in the map.
166 169
 	 */
167 170
 	public function getIterator()
168 171
 	{
@@ -343,7 +346,7 @@  discard block
 block discarded – undo
343 346
 	 * @param mixed key
344 347
 	 * @param mixed value
345 348
 	 * @param numeric|null priority, default: null, filled in with default priority
346
-	 * @return numeric priority at which the pair was added
349
+	 * @return string priority at which the pair was added
347 350
 	 * @throws TInvalidOperationException if the map is read-only
348 351
 	 */
349 352
 	public function add($key, $value, $priority = null)
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 	/**
66 66
 	 * @var array internal data storage
67 67
 	 */
68
-	private $_d = [];
68
+	private $_d=[];
69 69
 	/**
70 70
 	 * @var boolean whether this list is read-only
71 71
 	 */
72
-	private $_r = false;
72
+	private $_r=false;
73 73
 	/**
74 74
 	 * @var boolean indicates if the _d is currently ordered.
75 75
 	 */
76
-	private $_o = false;
76
+	private $_o=false;
77 77
 	/**
78 78
 	 * @var array cached flattened internal data storage
79 79
 	 */
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
 	/**
82 82
 	 * @var integer number of items contain within the map
83 83
 	 */
84
-	private $_c = 0;
84
+	private $_c=0;
85 85
 	/**
86 86
 	 * @var numeric the default priority of items without specified priorities
87 87
 	 */
88
-	private $_dp = 10;
88
+	private $_dp=10;
89 89
 	/**
90 90
 	 * @var integer the precision of the numeric priorities within this priority list.
91 91
 	 */
92
-	private $_p = 8;
92
+	private $_p=8;
93 93
 
94 94
 	/**
95 95
 	 * Constructor.
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	 * @param integer the precision of the numeric priorities
101 101
 	 * @throws TInvalidDataTypeException If data is not null and neither an array nor an iterator.
102 102
 	 */
103
-	public function __construct($data = null, $readOnly = false, $defaultPriority = 10, $precision = 8)
103
+	public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8)
104 104
 	{
105
-		if($data !== null)
105
+		if($data!==null)
106 106
 			$this->copyFrom($data);
107 107
 		$this->setReadOnly($readOnly);
108 108
 		$this->setPrecision($precision);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	protected function setReadOnly($value)
124 124
 	{
125
-		$this->_r = TPropertyValue::ensureBoolean($value);
125
+		$this->_r=TPropertyValue::ensureBoolean($value);
126 126
 	}
127 127
 
128 128
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function setDefaultPriority($value)
141 141
 	{
142
-		$this->_dp = (string)round(TPropertyValue::ensureFloat($value), $this->_p);
142
+		$this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p);
143 143
 	}
144 144
 
145 145
 	/**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	protected function setPrecision($value)
158 158
 	{
159
-		$this->_p = TPropertyValue::ensureInteger($value);
159
+		$this->_p=TPropertyValue::ensureInteger($value);
160 160
 	}
161 161
 
162 162
 	/**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	protected function sortPriorities() {
177 177
 		if(!$this->_o) {
178 178
 			ksort($this->_d, SORT_NUMERIC);
179
-			$this->_o = true;
179
+			$this->_o=true;
180 180
 		}
181 181
 	}
182 182
 
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
 			return $this->_fd;
190 190
 
191 191
 		$this->sortPriorities();
192
-		$this->_fd = [];
192
+		$this->_fd=[];
193 193
 		foreach($this->_d as $priority => $itemsatpriority)
194
-			$this->_fd = array_merge($this->_fd, $itemsatpriority);
194
+			$this->_fd=array_merge($this->_fd, $itemsatpriority);
195 195
 		return $this->_fd;
196 196
 	}
197 197
 
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 	 * it will be set to the default {@link getDefaultPriority}
220 220
 	 * @return integer the number of items in the map at the specified priority
221 221
 	 */
222
-	public function getPriorityCount($priority = null)
222
+	public function getPriorityCount($priority=null)
223 223
 	{
224
-		if($priority === null)
225
-			$priority = $this->getDefaultPriority();
226
-		$priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p);
224
+		if($priority===null)
225
+			$priority=$this->getDefaultPriority();
226
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
227 227
 
228 228
 		if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority]))
229 229
 			return false;
@@ -257,16 +257,16 @@  discard block
 block discarded – undo
257 257
 	 * and numeric is a specific priority.  default: false, any priority.
258 258
 	 * @return mixed the element at the offset, null if no element is found at the offset
259 259
 	 */
260
-	public function itemAt($key, $priority = false)
260
+	public function itemAt($key, $priority=false)
261 261
 	{
262
-		if($priority === false){
263
-			$map = $this->flattenPriorities();
264
-			return isset($map[$key])?$map[$key]:null;
262
+		if($priority===false) {
263
+			$map=$this->flattenPriorities();
264
+			return isset($map[$key]) ? $map[$key] : null;
265 265
 		} else {
266
-			if($priority === null)
267
-				$priority = $this->getDefaultPriority();
268
-			$priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p);
269
-			return (isset($this->_d[$priority]) && isset($this->_d[$priority][$key]))?$this->_d[$priority][$key]:null;
266
+			if($priority===null)
267
+				$priority=$this->getDefaultPriority();
268
+			$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
269
+			return (isset($this->_d[$priority]) && isset($this->_d[$priority][$key])) ? $this->_d[$priority][$key] : null;
270 270
 		}
271 271
 	}
272 272
 
@@ -277,15 +277,15 @@  discard block
 block discarded – undo
277 277
 	 * @param numeric|null the priority.  default: null, filled in with the default priority numeric.
278 278
 	 * @return numeric old priority of the item
279 279
 	 */
280
-	public function setPriorityAt($key, $priority = null)
280
+	public function setPriorityAt($key, $priority=null)
281 281
 	{
282
-		if($priority === null)
283
-			$priority = $this->getDefaultPriority();
284
-		$priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p);
282
+		if($priority===null)
283
+			$priority=$this->getDefaultPriority();
284
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
285 285
 
286
-		$oldpriority = $this->priorityAt($key);
287
-		if($oldpriority !== false && $oldpriority != $priority) {
288
-			$value = $this->remove($key, $oldpriority);
286
+		$oldpriority=$this->priorityAt($key);
287
+		if($oldpriority!==false && $oldpriority!=$priority) {
288
+			$value=$this->remove($key, $oldpriority);
289 289
 			$this->add($key, $value, $priority);
290 290
 		}
291 291
 		return $oldpriority;
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
 	 * @param numeric priority of the items to get.  Defaults to null, filled in with the default priority, if left blank.
297 297
 	 * @return array all items at priority in index order, null if there are no items at that priority
298 298
 	 */
299
-	public function itemsAtPriority($priority = null)
299
+	public function itemsAtPriority($priority=null)
300 300
 	{
301
-		if($priority === null)
302
-			$priority = $this->getDefaultPriority();
303
-		$priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p);
301
+		if($priority===null)
302
+			$priority=$this->getDefaultPriority();
303
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
304 304
 
305
-		return isset($this->_d[$priority])?$this->_d[$priority]:null;
305
+		return isset($this->_d[$priority]) ? $this->_d[$priority] : null;
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	{
315 315
 		$this->sortPriorities();
316 316
 		foreach($this->_d as $priority => $items)
317
-			if(($index = array_search($item, $items, true)) !== false)
317
+			if(($index=array_search($item, $items, true))!==false)
318 318
 				return $priority;
319 319
 		return false;
320 320
 	}
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
 	 * @return numeric priority at which the pair was added
347 347
 	 * @throws TInvalidOperationException if the map is read-only
348 348
 	 */
349
-	public function add($key, $value, $priority = null)
349
+	public function add($key, $value, $priority=null)
350 350
 	{
351
-		if($priority === null)
352
-			$priority = $this->getDefaultPriority();
353
-		$priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p);
351
+		if($priority===null)
352
+			$priority=$this->getDefaultPriority();
353
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
354 354
 
355 355
 		if(!$this->_r)
356 356
 		{
@@ -359,17 +359,17 @@  discard block
 block discarded – undo
359 359
 				{
360 360
 					unset($this->_d[$innerpriority][$key]);
361 361
 					$this->_c--;
362
-					if(count($this->_d[$innerpriority]) === 0)
362
+					if(count($this->_d[$innerpriority])===0)
363 363
 						unset($this->_d[$innerpriority]);
364 364
 				}
365 365
 			if(!isset($this->_d[$priority])) {
366
-				$this->_d[$priority] = [$key => $value];
367
-				$this->_o = false;
366
+				$this->_d[$priority]=[$key => $value];
367
+				$this->_o=false;
368 368
 			}
369 369
 			else
370
-				$this->_d[$priority][$key] = $value;
370
+				$this->_d[$priority][$key]=$value;
371 371
 			$this->_c++;
372
-			$this->_fd = null;
372
+			$this->_fd=null;
373 373
 		}
374 374
 		else
375 375
 			throw new TInvalidOperationException('map_readonly', get_class($this));
@@ -388,45 +388,45 @@  discard block
 block discarded – undo
388 388
 	 * @return mixed the removed value, null if no such key exists.
389 389
 	 * @throws TInvalidOperationException if the map is read-only
390 390
 	 */
391
-	public function remove($key, $priority = false)
391
+	public function remove($key, $priority=false)
392 392
 	{
393 393
 		if(!$this->_r)
394 394
 		{
395
-			if($priority === null)
396
-				$priority = $this->getDefaultPriority();
395
+			if($priority===null)
396
+				$priority=$this->getDefaultPriority();
397 397
 
398
-			if($priority === false)
398
+			if($priority===false)
399 399
 			{
400 400
 				$this->sortPriorities();
401 401
 				foreach($this->_d as $priority => $items)
402 402
 					if(array_key_exists($key, $items))
403 403
 					{
404
-						$value = $this->_d[$priority][$key];
404
+						$value=$this->_d[$priority][$key];
405 405
 						unset($this->_d[$priority][$key]);
406 406
 						$this->_c--;
407
-						if(count($this->_d[$priority]) === 0)
407
+						if(count($this->_d[$priority])===0)
408 408
 						{
409 409
 							unset($this->_d[$priority]);
410
-							$this->_o = false;
410
+							$this->_o=false;
411 411
 						}
412
-						$this->_fd = null;
412
+						$this->_fd=null;
413 413
 						return $value;
414 414
 					}
415 415
 				return null;
416 416
 			}
417 417
 			else
418 418
 			{
419
-				$priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p);
419
+				$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
420 420
 				if(isset($this->_d[$priority]) && (isset($this->_d[$priority][$key]) || array_key_exists($key, $this->_d[$priority])))
421 421
 				{
422
-					$value = $this->_d[$priority][$key];
422
+					$value=$this->_d[$priority][$key];
423 423
 					unset($this->_d[$priority][$key]);
424 424
 					$this->_c--;
425
-					if(count($this->_d[$priority]) === 0) {
425
+					if(count($this->_d[$priority])===0) {
426 426
 						unset($this->_d[$priority]);
427
-						$this->_o = false;
427
+						$this->_o=false;
428 428
 					}
429
-					$this->_fd = null;
429
+					$this->_fd=null;
430 430
 					return $value;
431 431
 				}
432 432
 				else
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 */
454 454
 	public function contains($key)
455 455
 	{
456
-		$map = $this->flattenPriorities();
456
+		$map=$this->flattenPriorities();
457 457
 		return isset($map[$key]) || array_key_exists($key, $map);
458 458
 	}
459 459
 
@@ -475,15 +475,15 @@  discard block
 block discarded – undo
475 475
 	 * @return array the array of priorities keys with values of arrays of items that are below a specified priority.
476 476
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
477 477
 	 */
478
-	public function toArrayBelowPriority($priority, $inclusive = false)
478
+	public function toArrayBelowPriority($priority, $inclusive=false)
479 479
 	{
480 480
 		$this->sortPriorities();
481
-		$items = [];
481
+		$items=[];
482 482
 		foreach($this->_d as $itemspriority => $itemsatpriority)
483 483
 		{
484 484
 			if((!$inclusive && $itemspriority >= $priority) || $itemspriority > $priority)
485 485
 				break;
486
-			$items = array_merge($items, $itemsatpriority);
486
+			$items=array_merge($items, $itemsatpriority);
487 487
 		}
488 488
 		return $items;
489 489
 	}
@@ -495,15 +495,15 @@  discard block
 block discarded – undo
495 495
 	 * @return array the array of priorities keys with values of arrays of items that are above a specified priority.
496 496
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
497 497
 	 */
498
-	public function toArrayAbovePriority($priority, $inclusive = true)
498
+	public function toArrayAbovePriority($priority, $inclusive=true)
499 499
 	{
500 500
 		$this->sortPriorities();
501
-		$items = [];
501
+		$items=[];
502 502
 		foreach($this->_d as $itemspriority => $itemsatpriority)
503 503
 		{
504 504
 			if((!$inclusive && $itemspriority <= $priority) || $itemspriority < $priority)
505 505
 				continue;
506
-			$items = array_merge($items, $itemsatpriority);
506
+			$items=array_merge($items, $itemsatpriority);
507 507
 		}
508 508
 		return $items;
509 509
 	}
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 			foreach($data as $key => $value)
535 535
 				$this->add($key, $value);
536 536
 		}
537
-		elseif($data !== null)
537
+		elseif($data!==null)
538 538
 			throw new TInvalidDataTypeException('map_data_not_iterable');
539 539
 	}
540 540
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 			foreach($data as $key => $value)
561 561
 				$this->add($key, $value);
562 562
 		}
563
-		elseif($data !== null)
563
+		elseif($data!==null)
564 564
 			throw new TInvalidDataTypeException('map_data_not_iterable');
565 565
 	}
566 566
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -365,13 +365,11 @@  discard block
 block discarded – undo
365 365
 			if(!isset($this->_d[$priority])) {
366 366
 				$this->_d[$priority] = [$key => $value];
367 367
 				$this->_o = false;
368
-			}
369
-			else
368
+			} else
370 369
 				$this->_d[$priority][$key] = $value;
371 370
 			$this->_c++;
372 371
 			$this->_fd = null;
373
-		}
374
-		else
372
+		} else
375 373
 			throw new TInvalidOperationException('map_readonly', get_class($this));
376 374
 		return $priority;
377 375
 	}
@@ -413,8 +411,7 @@  discard block
 block discarded – undo
413 411
 						return $value;
414 412
 					}
415 413
 				return null;
416
-			}
417
-			else
414
+			} else
418 415
 			{
419 416
 				$priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p);
420 417
 				if(isset($this->_d[$priority]) && (isset($this->_d[$priority][$key]) || array_key_exists($key, $this->_d[$priority])))
@@ -428,12 +425,10 @@  discard block
 block discarded – undo
428 425
 					}
429 426
 					$this->_fd = null;
430 427
 					return $value;
431
-				}
432
-				else
428
+				} else
433 429
 					return null;
434 430
 			}
435
-		}
436
-		else
431
+		} else
437 432
 			throw new TInvalidOperationException('map_readonly', get_class($this));
438 433
 	}
439 434
 
@@ -526,15 +521,13 @@  discard block
 block discarded – undo
526 521
 					$this->add($key, $value, $priority);
527 522
 				}
528 523
 			}
529
-		}
530
-		elseif(is_array($data) || $data instanceof \Traversable)
524
+		} elseif(is_array($data) || $data instanceof \Traversable)
531 525
 		{
532 526
 			if($this->getCount() > 0)
533 527
 				$this->clear();
534 528
 			foreach($data as $key => $value)
535 529
 				$this->add($key, $value);
536
-		}
537
-		elseif($data !== null)
530
+		} elseif($data !== null)
538 531
 			throw new TInvalidDataTypeException('map_data_not_iterable');
539 532
 	}
540 533
 
@@ -554,13 +547,11 @@  discard block
 block discarded – undo
554 547
 				foreach($data->itemsAtPriority($priority) as $key => $value)
555 548
 					$this->add($key, $value, $priority);
556 549
 			}
557
-		}
558
-		elseif(is_array($data) || $data instanceof \Traversable)
550
+		} elseif(is_array($data) || $data instanceof \Traversable)
559 551
 		{
560 552
 			foreach($data as $key => $value)
561 553
 				$this->add($key, $value);
562
-		}
563
-		elseif($data !== null)
554
+		} elseif($data !== null)
564 555
 			throw new TInvalidDataTypeException('map_data_not_iterable');
565 556
 	}
566 557
 
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php 2 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,6 +36,9 @@  discard block
 block discarded – undo
36 36
 	private $_relation; //data from an entry of TActiveRecord::$RELATION
37 37
 	private $_fkeys;
38 38
 
39
+	/**
40
+	 * @param TActiveRecord $record
41
+	 */
39 42
 	public function __construct($record, $property = null, $relation = null)
40 43
 	{
41 44
 		$this->_record = $record;
@@ -169,6 +172,7 @@  discard block
 block discarded – undo
169 172
 	 * An instance of TActiveRecordHasOne, TActiveRecordBelongsTo, TActiveRecordHasMany,
170 173
 	 * or TActiveRecordHasManyAssocation will be returned.
171 174
 	 * @param TActiveRecordCriteria search criteria
175
+	 * @param \Prado\Data\DataGateway\TSqlCriteria $criteria
172 176
 	 * @return TActiveRecordRelation record relationship handler instnace.
173 177
 	 * @throws TActiveRecordException if property is not defined or missing.
174 178
 	 */
@@ -197,7 +201,7 @@  discard block
 block discarded – undo
197 201
 	}
198 202
 
199 203
 	/**
200
-	 * @return TActiveRecordRelationCommand
204
+	 * @return boolean
201 205
 	 */
202 206
 	public function updateAssociatedRecords($updateBelongsTo = false)
203 207
 	{
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	private $_relation; //data from an entry of TActiveRecord::$RELATION
37 37
 	private $_fkeys;
38 38
 
39
-	public function __construct($record, $property = null, $relation = null)
39
+	public function __construct($record, $property=null, $relation=null)
40 40
 	{
41
-		$this->_record = $record;
42
-		$this->_property = $property;
43
-		$this->_relation = $relation;
41
+		$this->_record=$record;
42
+		$this->_property=$property;
43
+		$this->_relation=$relation;
44 44
 	}
45 45
 
46 46
 	/**
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function hasRecordRelation()
51 51
 	{
52
-		return $this->_relation !== null;
52
+		return $this->_relation!==null;
53 53
 	}
54 54
 
55 55
 	public function getPropertyValue()
56 56
 	{
57
-		$obj = $this->getSourceRecord();
57
+		$obj=$this->getSourceRecord();
58 58
 		return $obj->getColumnValue($this->getProperty());
59 59
 	}
60 60
 
@@ -81,8 +81,8 @@  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
 		return $this->_fkeys;
87 87
 	}
88 88
 
@@ -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
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function hasFkField()
137 137
 	{
138
-		$notManyToMany = $this->getRelationType() !== TActiveRecord::MANY_TO_MANY;
138
+		$notManyToMany=$this->getRelationType()!==TActiveRecord::MANY_TO_MANY;
139 139
 		return $notManyToMany && isset($this->_relation[2]) && !empty($this->_relation[2]);
140 140
 	}
141 141
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function hasAssociationTable()
154 154
 	{
155
-		$isManyToMany = $this->getRelationType() === TActiveRecord::MANY_TO_MANY;
155
+		$isManyToMany=$this->getRelationType()===TActiveRecord::MANY_TO_MANY;
156 156
 		return $isManyToMany && isset($this->_relation[2]) && !empty($this->_relation[2]);
157 157
 	}
158 158
 
@@ -172,15 +172,15 @@  discard block
 block discarded – undo
172 172
 	 * @return TActiveRecordRelation record relationship handler instnace.
173 173
 	 * @throws TActiveRecordException if property is not defined or missing.
174 174
 	 */
175
-	public function getRelationHandler($criteria = null)
175
+	public function getRelationHandler($criteria=null)
176 176
 	{
177 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)
183
-			$criteria = new TActiveRecordCriteria($this->getCondition(), $this->getParameters());
182
+		if($criteria===null)
183
+			$criteria=new TActiveRecordCriteria($this->getCondition(), $this->getParameters());
184 184
 		switch($this->getRelationType())
185 185
 		{
186 186
 			case TActiveRecord::HAS_MANY:
@@ -199,20 +199,20 @@  discard block
 block discarded – undo
199 199
 	/**
200 200
 	 * @return TActiveRecordRelationCommand
201 201
 	 */
202
-	public function updateAssociatedRecords($updateBelongsTo = false)
202
+	public function updateAssociatedRecords($updateBelongsTo=false)
203 203
 	{
204
-		$success = true;
204
+		$success=true;
205 205
 		foreach($this->_record->getRecordRelations() as $data)
206 206
 		{
207
-			list($property, $relation) = $data;
208
-			$belongsTo = $relation[0] == TActiveRecord::BELONGS_TO;
207
+			list($property, $relation)=$data;
208
+			$belongsTo=$relation[0]==TActiveRecord::BELONGS_TO;
209 209
 			if(($updateBelongsTo && $belongsTo) || (!$updateBelongsTo && !$belongsTo))
210 210
 			{
211
-				$obj = $this->getSourceRecord();
211
+				$obj=$this->getSourceRecord();
212 212
 				if(!$this->isEmptyFkObject($obj->getColumnValue($property)))
213 213
 				{
214
-					$context = new TActiveRecordRelationContext($this->getSourceRecord(), $property, $relation);
215
-					$success = $context->getRelationHandler()->updateAssociatedRecords() && $success;
214
+					$context=new TActiveRecordRelationContext($this->getSourceRecord(), $property, $relation);
215
+					$success=$context->getRelationHandler()->updateAssociatedRecords() && $success;
216 216
 				}
217 217
 			}
218 218
 		}
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 	protected function isEmptyFkObject($obj)
223 223
 	{
224 224
 		if(is_object($obj))
225
-			return $obj instanceof TList ? $obj->count() === 0 : false;
225
+			return $obj instanceof TList ? $obj->count()===0 : false;
226 226
 		elseif(is_array($obj))
227
-			return count($obj) === 0;
227
+			return count($obj)===0;
228 228
 		else
229 229
 			return empty($obj);
230 230
 	}
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -52,6 +52,10 @@  discard block
 block discarded – undo
52 52
 		}
53 53
 	}
54 54
 
55
+	/**
56
+	 * @param \Prado\Data\ActiveRecord\Scaffold\TScaffoldEditView $parent
57
+	 * @param \Prado\Data\ActiveRecord\TActiveRecord $record
58
+	 */
55 59
 	public function createScaffoldInput($parent, $item, $column, $record)
56 60
 	{
57 61
 		$this->_parent = $parent;
@@ -68,6 +72,10 @@  discard block
 block discarded – undo
68 72
 		$label->setForControl(self::DEFAULT_ID);
69 73
 	}
70 74
 
75
+	/**
76
+	 * @param \Prado\Data\ActiveRecord\Scaffold\TScaffoldEditView $parent
77
+	 * @param \Prado\Data\ActiveRecord\TActiveRecord $record
78
+	 */
71 79
 	public function loadScaffoldInput($parent, $item, $column, $record)
72 80
 	{
73 81
 		$this->_parent = $parent;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 class TScaffoldInputBase
17 17
 {
18
-	const DEFAULT_ID = 'scaffold_input';
18
+	const DEFAULT_ID='scaffold_input';
19 19
 	private $_parent;
20 20
 
21 21
 	protected function getParent()
@@ -26,25 +26,25 @@  discard block
 block discarded – undo
26 26
 	public static function createInputBuilder($record)
27 27
 	{
28 28
 		$record->getDbConnection()->setActive(true); //must be connected before retrieving driver name!
29
-		$driver = $record->getDbConnection()->getDriverName();
29
+		$driver=$record->getDbConnection()->getDriverName();
30 30
 		switch(strtolower($driver))
31 31
 		{
32 32
 			case 'sqlite': //sqlite 3
33 33
 			case 'sqlite2': //sqlite 2
34
-				require_once(dirname(__FILE__) . '/TSqliteScaffoldInput.php');
34
+				require_once(dirname(__FILE__).'/TSqliteScaffoldInput.php');
35 35
 				return new TSqliteScaffoldInput($conn);
36 36
 			case 'mysqli':
37 37
 			case 'mysql':
38
-				require_once(dirname(__FILE__) . '/TMysqlScaffoldInput.php');
38
+				require_once(dirname(__FILE__).'/TMysqlScaffoldInput.php');
39 39
 				return new TMysqlScaffoldInput($conn);
40 40
 			case 'pgsql':
41
-				require_once(dirname(__FILE__) . '/TPgsqlScaffoldInput.php');
41
+				require_once(dirname(__FILE__).'/TPgsqlScaffoldInput.php');
42 42
 				return new TPgsqlScaffoldInput($conn);
43 43
 			case 'mssql':
44
-				require_once(dirname(__FILE__) . '/TMssqlScaffoldInput.php');
44
+				require_once(dirname(__FILE__).'/TMssqlScaffoldInput.php');
45 45
 				return new TMssqlScaffoldInput($conn);
46 46
 			case 'ibm':
47
-				require_once(dirname(__FILE__) . '/TIbmScaffoldInput.php');
47
+				require_once(dirname(__FILE__).'/TIbmScaffoldInput.php');
48 48
 				return new TIbmScaffoldInput($conn);
49 49
 			default:
50 50
 				throw new TConfigurationException(
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	public function createScaffoldInput($parent, $item, $column, $record)
56 56
 	{
57
-		$this->_parent = $parent;
57
+		$this->_parent=$parent;
58 58
 		$item->setCustomData($column->getColumnId());
59 59
 		$this->createControl($item->_input, $column, $record);
60 60
 		if($item->_input->findControl(self::DEFAULT_ID))
@@ -63,31 +63,31 @@  discard block
 block discarded – undo
63 63
 
64 64
 	protected function createControlLabel($label, $column, $record)
65 65
 	{
66
-		$fieldname = ucwords(str_replace('_', ' ', $column->getColumnId())) . ':';
66
+		$fieldname=ucwords(str_replace('_', ' ', $column->getColumnId())).':';
67 67
 		$label->setText($fieldname);
68 68
 		$label->setForControl(self::DEFAULT_ID);
69 69
 	}
70 70
 
71 71
 	public function loadScaffoldInput($parent, $item, $column, $record)
72 72
 	{
73
-		$this->_parent = $parent;
73
+		$this->_parent=$parent;
74 74
 		if($this->getIsEnabled($column, $record))
75 75
 		{
76
-			$prop = $column->getColumnId();
76
+			$prop=$column->getColumnId();
77 77
 			$record->setColumnValue($prop, $this->getControlValue($item->_input, $column, $record));
78 78
 		}
79 79
 	}
80 80
 
81 81
 	protected function getIsEnabled($column, $record)
82 82
 	{
83
-		return !($this->getParent()->getRecordPk() !== null
83
+		return !($this->getParent()->getRecordPk()!==null
84 84
 				&& $column->getIsPrimaryKey() || $column->hasSequence());
85 85
 	}
86 86
 
87 87
 	protected function getRecordPropertyValue($column, $record)
88 88
 	{
89
-		$value = $record->getColumnValue($column->getColumnId());
90
-		if($column->getDefaultValue() !== TDbTableColumn::UNDEFINED_VALUE && $value === null)
89
+		$value=$record->getColumnValue($column->getColumnId());
90
+		if($column->getDefaultValue()!==TDbTableColumn::UNDEFINED_VALUE && $value===null)
91 91
 			return $column->getDefaultValue();
92 92
 		else
93 93
 			return $value;
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecord.php 3 patches
Doc Comments   +10 added lines, -2 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	/**
325 325
 	 * Gets the current Db connection, the connection object is obtained from
326 326
 	 * the TActiveRecordManager if connection is currently null.
327
-	 * @return TDbConnection current db connection for this object.
327
+	 * @return \Prado\Data\TDbConnection current db connection for this object.
328 328
 	 */
329 329
 	public function getDbConnection()
330 330
 	{
@@ -511,6 +511,7 @@  discard block
 block discarded – undo
511 511
 	 * Delete multiple records using a criteria.
512 512
 	 * @param string|TActiveRecordCriteria SQL condition or criteria object.
513 513
 	 * @param mixed parameter values.
514
+	 * @param TSqlCriteria $criteria
514 515
 	 * @return int number of records deleted.
515 516
 	 */
516 517
 	public function deleteAll($criteria = null, $parameters = [])
@@ -577,6 +578,7 @@  discard block
 block discarded – undo
577 578
 	 *
578 579
 	 * @param string|TActiveRecordCriteria SQL condition or criteria object.
579 580
 	 * @param mixed parameter values.
581
+	 * @param TSqlCriteria $criteria
580 582
 	 * @return TActiveRecord matching record object. Null if no result is found.
581 583
 	 */
582 584
 	public function find($criteria, $parameters = [])
@@ -593,6 +595,7 @@  discard block
 block discarded – undo
593 595
 	 *
594 596
 	 * @param string|TActiveRecordCriteria SQL condition or criteria object.
595 597
 	 * @param mixed parameter values.
598
+	 * @param TSqlCriteria $criteria
596 599
 	 * @return array matching record objects. Empty array if no result is found.
597 600
 	 */
598 601
 	public function findAll($criteria = null, $parameters = [])
@@ -706,6 +709,7 @@  discard block
 block discarded – undo
706 709
 	 * Find the number of records.
707 710
 	 * @param string|TActiveRecordCriteria SQL condition or criteria object.
708 711
 	 * @param mixed parameter values.
712
+	 * @param TActiveRecordCriteria $criteria
709 713
 	 * @return int number of records.
710 714
 	 */
711 715
 	public function count($criteria = null, $parameters = [])
@@ -721,6 +725,7 @@  discard block
 block discarded – undo
721 725
 	 * value equal to the $property value.
722 726
 	 * @param string relationship/property name corresponding to keys in $RELATION array.
723 727
 	 * @param array method call arguments.
728
+	 * @param string $name
724 729
 	 * @return TActiveRecordRelation, null if the context or the handler doesn't exist
725 730
 	 */
726 731
 	protected function getRelationHandler($name, $args = [])
@@ -945,6 +950,7 @@  discard block
 block discarded – undo
945 950
 	 * Raised before the record attempt to insert its data into the database.
946 951
 	 * To prevent the insert operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.
947 952
 	 * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers
953
+	 * @param TActiveRecordChangeEventParameter $param
948 954
 	 */
949 955
 	public function onInsert($param)
950 956
 	{
@@ -955,6 +961,7 @@  discard block
 block discarded – undo
955 961
 	 * Raised before the record attempt to delete its data from the database.
956 962
 	 * To prevent the delete operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.
957 963
 	 * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers
964
+	 * @param TActiveRecordChangeEventParameter $param
958 965
 	 */
959 966
 	public function onDelete($param)
960 967
 	{
@@ -965,6 +972,7 @@  discard block
 block discarded – undo
965 972
 	 * Raised before the record attempt to update its data in the database.
966 973
 	 * To prevent the update operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.
967 974
 	 * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers
975
+	 * @param TActiveRecordChangeEventParameter $param
968 976
 	 */
969 977
 	public function onUpdate($param)
970 978
 	{
@@ -1048,7 +1056,7 @@  discard block
 block discarded – undo
1048 1056
 	
1049 1057
 		/**
1050 1058
 		 * Return record data as JSON
1051
-		 * @return JSON
1059
+		 * @return string
1052 1060
 		 * @since 3.2.4
1053 1061
 		 */
1054 1062
 		public function toJSON(){
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
  */
153 153
 abstract class TActiveRecord extends \Prado\TComponent
154 154
 {
155
-	const BELONGS_TO = 'BELONGS_TO';
156
-	const HAS_ONE = 'HAS_ONE';
157
-	const HAS_MANY = 'HAS_MANY';
158
-	const MANY_TO_MANY = 'MANY_TO_MANY';
155
+	const BELONGS_TO='BELONGS_TO';
156
+	const HAS_ONE='HAS_ONE';
157
+	const HAS_MANY='HAS_MANY';
158
+	const MANY_TO_MANY='MANY_TO_MANY';
159 159
 
160
-	const STATE_NEW = 0;
161
-	const STATE_LOADED = 1;
162
-	const STATE_DELETED = 2;
160
+	const STATE_NEW=0;
161
+	const STATE_LOADED=1;
162
+	const STATE_DELETED=2;
163 163
 
164 164
 	/**
165 165
 	 * @var integer record state: 0 = new, 1 = loaded, 2 = deleted.
166 166
 	 * @since 3.1.2
167 167
 	 */
168
-	protected $_recordState = 0; // use protected so that serialization is fine
168
+	protected $_recordState=0; // use protected so that serialization is fine
169 169
 
170 170
 	/**
171 171
 	 * This static variable defines the column mapping.
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @var array column mapping. Keys: physical column names, values: logical column names.
176 176
 	 * @since 3.1.1
177 177
 	 */
178
-	public static $COLUMN_MAPPING = [];
179
-	private static $_columnMapping = [];
178
+	public static $COLUMN_MAPPING=[];
179
+	private static $_columnMapping=[];
180 180
 
181 181
 	/**
182 182
 	 * This static variable defines the relationships.
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @var array relationship.
186 186
 	 * @since 3.1.1
187 187
 	 */
188
-	public static $RELATIONS = [];
189
-	private static $_relations = [];
188
+	public static $RELATIONS=[];
189
+	private static $_relations=[];
190 190
 
191 191
 	/**
192 192
 	 * @var TDbConnection database connection object.
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 	 * @param array optional name value pair record data.
227 227
 	 * @param TDbConnection optional database connection this object record use.
228 228
 	 */
229
-	public function __construct($data = [], $connection = null)
229
+	public function __construct($data=[], $connection=null)
230 230
 	{
231
-		if($connection !== null)
231
+		if($connection!==null)
232 232
 			$this->setDbConnection($connection);
233 233
 		$this->setupColumnMapping();
234 234
 		$this->setupRelations();
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	public function __set($name, $value)
266 266
 	{
267 267
 		if($this->hasRecordRelation($name) && !$this->canSetProperty($name))
268
-			$this->$name = $value;
268
+			$this->$name=$value;
269 269
 		else
270 270
 			parent::__set($name, $value);
271 271
 	}
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	private function setupColumnMapping()
277 277
 	{
278
-		$className = get_class($this);
278
+		$className=get_class($this);
279 279
 		if(!isset(self::$_columnMapping[$className]))
280 280
 		{
281
-			$class = new ReflectionClass($className);
282
-			self::$_columnMapping[$className] = $class->getStaticPropertyValue('COLUMN_MAPPING');
281
+			$class=new ReflectionClass($className);
282
+			self::$_columnMapping[$className]=$class->getStaticPropertyValue('COLUMN_MAPPING');
283 283
 		}
284 284
 	}
285 285
 
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
 	 */
289 289
 	private function setupRelations()
290 290
 	{
291
-		$className = get_class($this);
291
+		$className=get_class($this);
292 292
 		if(!isset(self::$_relations[$className]))
293 293
 		{
294
-			$class = new ReflectionClass($className);
295
-			$relations = [];
294
+			$class=new ReflectionClass($className);
295
+			$relations=[];
296 296
 			foreach($class->getStaticPropertyValue('RELATIONS') as $key => $value)
297
-				$relations[strtolower($key)] = [$key,$value];
298
-			self::$_relations[$className] = $relations;
297
+				$relations[strtolower($key)]=[$key, $value];
298
+			self::$_relations[$className]=$relations;
299 299
 		}
300 300
 	}
301 301
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	public function copyFrom($data)
307 307
 	{
308 308
 		if(is_object($data))
309
-			$data = get_object_vars($data);
309
+			$data=get_object_vars($data);
310 310
 		if(!is_array($data))
311 311
 			throw new TActiveRecordException('ar_data_invalid', get_class($this));
312 312
 		foreach($data as $name => $value)
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
 	public static function getActiveDbConnection()
318 318
 	{
319
-		if(($db = self::getRecordManager()->getDbConnection()) !== null)
319
+		if(($db=self::getRecordManager()->getDbConnection())!==null)
320 320
 			$db->setActive(true);
321 321
 		return $db;
322 322
 	}
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 */
329 329
 	public function getDbConnection()
330 330
 	{
331
-		if($this->_connection === null)
332
-			$this->_connection = self::getActiveDbConnection();
331
+		if($this->_connection===null)
332
+			$this->_connection=self::getActiveDbConnection();
333 333
 		return $this->_connection;
334 334
 	}
335 335
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 */
339 339
 	public function setDbConnection($connection)
340 340
 	{
341
-		$this->_connection = $connection;
341
+		$this->_connection=$connection;
342 342
 	}
343 343
 
344 344
 	/**
@@ -357,20 +357,20 @@  discard block
 block discarded – undo
357 357
 	 * @param boolean true to perform strict identity comparison
358 358
 	 * @return boolean true if $record equals, false otherwise.
359 359
 	 */
360
-	public function equals(TActiveRecord $record, $strict = false)
360
+	public function equals(TActiveRecord $record, $strict=false)
361 361
 	{
362
-		if($record === null || get_class($this) !== get_class($record))
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();
367
-		$equals = true;
364
+		$tableInfo=$this->getRecordTableInfo();
365
+		$pks=$tableInfo->getPrimaryKeys();
366
+		$properties=count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys();
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
 		}
@@ -386,13 +386,13 @@  discard block
 block discarded – undo
386 386
 	 * @param string active record class name.
387 387
 	 * @return TActiveRecord active record finder instance.
388 388
 	 */
389
-	public static function finder($className = __CLASS__)
389
+	public static function finder($className=__CLASS__)
390 390
 	{
391
-		static $finders = [];
391
+		static $finders=[];
392 392
 		if(!isset($finders[$className]))
393 393
 		{
394
-			$f = Prado::createComponent($className);
395
-			$finders[$className] = $f;
394
+			$f=Prado::createComponent($className);
395
+			$finders[$className]=$f;
396 396
 		}
397 397
 		return $finders[$className];
398 398
 	}
@@ -421,18 +421,18 @@  discard block
 block discarded – undo
421 421
 	 */
422 422
 	public function save()
423 423
 	{
424
-		$gateway = $this->getRecordGateway();
425
-		$param = new TActiveRecordChangeEventParameter();
426
-		if($this->_recordState === self::STATE_NEW)
424
+		$gateway=$this->getRecordGateway();
425
+		$param=new TActiveRecordChangeEventParameter();
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
 		}
435
-		elseif($this->_recordState === self::STATE_LOADED)
435
+		elseif($this->_recordState===self::STATE_LOADED)
436 436
 		{
437 437
 			$this->onUpdate($param);
438 438
 			if($param->getIsValid() && $gateway->update($this))
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	public function delete()
453 453
 	{
454
-		if($this->_recordState === self::STATE_LOADED)
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
 			{
461
-				$this->_recordState = self::STATE_DELETED;
461
+				$this->_recordState=self::STATE_DELETED;
462 462
 				return true;
463 463
 			}
464 464
 		}
@@ -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
 	/**
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
 	 * @param mixed parameter values.
514 514
 	 * @return int number of records deleted.
515 515
 	 */
516
-	public function deleteAll($criteria = null, $parameters = [])
516
+	public function deleteAll($criteria=null, $parameters=[])
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
 
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	protected function populateObjects($reader)
540 540
 	{
541
-		$result = [];
541
+		$result=[];
542 542
 		foreach($reader as $data)
543
-			$result[] = $this->populateObject($data);
543
+			$result[]=$this->populateObject($data);
544 544
 		return $result;
545 545
 	}
546 546
 
@@ -557,8 +557,8 @@  discard block
 block discarded – undo
557 557
 	{
558 558
 		if(empty($data))
559 559
 			return null;
560
-		$record = new $type($data);
561
-		$record->_recordState = self::STATE_LOADED;
560
+		$record=new $type($data);
561
+		$record->_recordState=self::STATE_LOADED;
562 562
 		return $record;
563 563
 	}
564 564
 
@@ -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 = [])
582
+	public function find($criteria, $parameters=[])
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 = [])
598
+	public function findAll($criteria=null, $parameters=[])
599 599
 	{
600
-		$args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
601
-		if($criteria !== null)
602
-			$criteria = $this->getRecordCriteria($criteria, $parameters, $args);
603
-		$result = $this->getRecordGateway()->findRecordsByCriteria($this, $criteria, true);
600
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
601
+		if($criteria!==null)
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 = [])
662
+	public function findBySql($sql, $parameters=[])
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 = [])
679
+	public function findAllBySql($sql, $parameters=[])
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
 
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 	 */
699 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,11 +708,11 @@  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 = [])
711
+	public function count($criteria=null, $parameters=[])
712 712
 	{
713
-		$args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
714
-		if($criteria !== null)
715
-			$criteria = $this->getRecordCriteria($criteria, $parameters, $args);
713
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
714
+		if($criteria!==null)
715
+			$criteria=$this->getRecordCriteria($criteria, $parameters, $args);
716 716
 		return $this->getRecordGateway()->countRecords($this, $criteria);
717 717
 	}
718 718
 
@@ -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 = [])
726
+	protected function getRelationHandler($name, $args=[])
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
@@ -745,9 +745,9 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	protected function createRelationContext($name)
747 747
 	{
748
-		if(($definition = $this->getRecordRelation($name)) !== null)
748
+		if(($definition=$this->getRecordRelation($name))!==null)
749 749
 		{
750
-			list($property, $relation) = $definition;
750
+			list($property, $relation)=$definition;
751 751
 			return new TActiveRecordRelationContext($this, $property, $relation);
752 752
 		}
753 753
 		else
@@ -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;
@@ -828,29 +828,29 @@  discard block
 block discarded – undo
828 828
 	 */
829 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
-		elseif($findOne = strncasecmp($method, 'findby', 6) === 0)
838
-			$condition = $method[6] === '_' ? substr($method, 7) : substr($method, 6);
839
-		elseif(strncasecmp($method, 'findallby', 9) === 0)
840
-			$condition = $method[9] === '_' ? substr($method, 10) : substr($method, 9);
841
-		elseif($delete = strncasecmp($method, 'deleteby', 8) === 0)
842
-			$condition = $method[8] === '_' ? substr($method, 9) : substr($method, 8);
843
-		elseif($delete = strncasecmp($method, 'deleteallby', 11) === 0)
844
-			$condition = $method[11] === '_' ? substr($method, 12) : substr($method, 11);
837
+		elseif($findOne=strncasecmp($method, 'findby', 6)===0)
838
+			$condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6);
839
+		elseif(strncasecmp($method, 'findallby', 9)===0)
840
+			$condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9);
841
+		elseif($delete=strncasecmp($method, 'deleteby', 8)===0)
842
+			$condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8);
843
+		elseif($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)
847
+			if($this->getInvalidFinderResult()==TActiveRecordInvalidFinderResult::Exception)
848 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
 	/**
@@ -894,11 +894,11 @@  discard block
 block discarded – undo
894 894
 	 * @param array additional parameters obtained from function_get_args().
895 895
 	 * @return TSqlCriteria criteria object.
896 896
 	 */
897
-	protected function getRecordCriteria($criteria, $parameters, $args = [])
897
+	protected function getRecordCriteria($criteria, $parameters, $args=[])
898 898
 	{
899 899
 		if(is_string($criteria))
900 900
 		{
901
-			$useArgs = !is_array($parameters) && is_array($args);
901
+			$useArgs=!is_array($parameters) && is_array($args);
902 902
 			return new TActiveRecordCriteria($criteria, $useArgs ? $args : $parameters);
903 903
 		}
904 904
 		elseif($criteria instanceof TSqlCriteria)
@@ -980,9 +980,9 @@  discard block
 block discarded – undo
980 980
 	 */
981 981
 	public function getColumnValue($columnName)
982 982
 	{
983
-		$className = get_class($this);
983
+		$className=get_class($this);
984 984
 		if(isset(self::$_columnMapping[$className][$columnName]))
985
-			$columnName = self::$_columnMapping[$className][$columnName];
985
+			$columnName=self::$_columnMapping[$className][$columnName];
986 986
 		return $this->$columnName;
987 987
 	}
988 988
 
@@ -995,10 +995,10 @@  discard block
 block discarded – undo
995 995
 	 */
996 996
 	public function setColumnValue($columnName, $value)
997 997
 	{
998
-		$className = get_class($this);
998
+		$className=get_class($this);
999 999
 		if(isset(self::$_columnMapping[$className][$columnName]))
1000
-			$columnName = self::$_columnMapping[$className][$columnName];
1001
-		$this->$columnName = $value;
1000
+			$columnName=self::$_columnMapping[$className][$columnName];
1001
+		$this->$columnName=$value;
1002 1002
 	}
1003 1003
 
1004 1004
 	/**
@@ -1008,9 +1008,9 @@  discard block
 block discarded – undo
1008 1008
 	 */
1009 1009
 	public function getRecordRelation($property)
1010 1010
 	{
1011
-		$className = get_class($this);
1012
-		$property = strtolower($property);
1013
-		return isset(self::$_relations[$className][$property])?self::$_relations[$className][$property]:null;
1011
+		$className=get_class($this);
1012
+		$property=strtolower($property);
1013
+		return isset(self::$_relations[$className][$property]) ?self::$_relations[$className][$property] : null;
1014 1014
 	}
1015 1015
 
1016 1016
 	/**
@@ -1037,10 +1037,10 @@  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(){
1041
-			$result = [];
1042
-			foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){
1043
-					$result[$columnName] = $this->getColumnValue($columnName);
1040
+		public function toArray() {
1041
+			$result=[];
1042
+			foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName) {
1043
+					$result[$columnName]=$this->getColumnValue($columnName);
1044 1044
 			   }
1045 1045
 		
1046 1046
 			return $result;
@@ -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.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -431,14 +431,12 @@  discard block
 block discarded – undo
431 431
 				$this->_recordState = self::STATE_LOADED;
432 432
 				return true;
433 433
 			}
434
-		}
435
-		elseif($this->_recordState === self::STATE_LOADED)
434
+		} elseif($this->_recordState === self::STATE_LOADED)
436 435
 		{
437 436
 			$this->onUpdate($param);
438 437
 			if($param->getIsValid() && $gateway->update($this))
439 438
 				return true;
440
-		}
441
-		else
439
+		} else
442 440
 			throw new TActiveRecordException('ar_save_invalid', get_class($this));
443 441
 
444 442
 		return false;
@@ -461,8 +459,7 @@  discard block
 block discarded – undo
461 459
 				$this->_recordState = self::STATE_DELETED;
462 460
 				return true;
463 461
 			}
464
-		}
465
-		else
462
+		} else
466 463
 			throw new TActiveRecordException('ar_delete_invalid', get_class($this));
467 464
 
468 465
 		return false;
@@ -729,8 +726,7 @@  discard block
 block discarded – undo
729 726
 		{
730 727
 			$criteria = $this->getRecordCriteria(count($args) > 0 ? $args[0] : null, array_slice($args, 1));
731 728
 			return $context->getRelationHandler($criteria);
732
-		}
733
-		else
729
+		} else
734 730
 			return null;
735 731
 	}
736 732
 
@@ -749,8 +745,7 @@  discard block
 block discarded – undo
749 745
 		{
750 746
 			list($property, $relation) = $definition;
751 747
 			return new TActiveRecordRelationContext($this, $property, $relation);
752
-		}
753
-		else
748
+		} else
754 749
 			return null;
755 750
 	}
756 751
 
@@ -833,8 +828,7 @@  discard block
 block discarded – undo
833 828
 		{
834 829
 			$property = $method[4] === '_' ? substr($method, 5) : substr($method, 4);
835 830
 			return $this->getRelationHandler($property, $args);
836
-		}
837
-		elseif($findOne = strncasecmp($method, 'findby', 6) === 0)
831
+		} elseif($findOne = strncasecmp($method, 'findby', 6) === 0)
838 832
 			$condition = $method[6] === '_' ? substr($method, 7) : substr($method, 6);
839 833
 		elseif(strncasecmp($method, 'findallby', 9) === 0)
840 834
 			$condition = $method[9] === '_' ? substr($method, 10) : substr($method, 9);
@@ -900,8 +894,7 @@  discard block
 block discarded – undo
900 894
 		{
901 895
 			$useArgs = !is_array($parameters) && is_array($args);
902 896
 			return new TActiveRecordCriteria($criteria, $useArgs ? $args : $parameters);
903
-		}
904
-		elseif($criteria instanceof TSqlCriteria)
897
+		} elseif($criteria instanceof TSqlCriteria)
905 898
 			return $criteria;
906 899
 		else
907 900
 			return new TActiveRecordCriteria();
Please login to merge, or discard this patch.