Completed
Push — namespace2 ( fc6e2b...8a6673 )
by Fabio
08:49
created
framework/PradoBase.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
 if(!defined('PRADO_DIR'))
19 19
 	define('PRADO_DIR',dirname(__FILE__));
20 20
 /**
21
- * Defines the default permission for writable directories and files
22
- */
21
+	 * Defines the default permission for writable directories and files
22
+	 */
23 23
 if(!defined('PRADO_CHMOD'))
24 24
 	define('PRADO_CHMOD',0777);
25 25
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * module of the Prado application to handle the exception.
211 211
 	 * If the application or the module does not exist, it simply echoes the
212 212
 	 * exception.
213
-	 * @param Exception exception that is not caught
213
+	 * @param Exception TPhpErrorException that is not caught
214 214
 	 */
215 215
 	public static function exceptionHandler($exception)
216 216
 	{
@@ -232,6 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * will cause the throw of an exception.
233 233
 	 * This method should only be used by framework developers.
234 234
 	 * @param TApplication the application instance
235
+	 * @param TApplication $application
235 236
 	 * @throws TInvalidOperationException if this method is invoked twice or more.
236 237
 	 */
237 238
 	public static function setApplication($application)
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  * Defines the default permission for writable directories and files
30 30
  */
31 31
 if(!defined('PRADO_CHMOD'))
32
-	define('PRADO_CHMOD',0777);
32
+	define('PRADO_CHMOD', 0777);
33 33
 
34 34
 /**
35 35
  * PradoBase class.
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * @var array list of class exists checks
75 75
 	 */
76
-	protected static $classExists = array();
76
+	protected static $classExists=array();
77 77
 	/**
78 78
 	 * @var Autoloader instance
79 79
 	 */
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public static function initAutoloader()
99 99
 	{
100
-		$autoloadPaths = array(
101
-			__DIR__ . '/../../../autoload.php', // prado as dependency
102
-			__DIR__ . '/../vendor/autoload.php', // prado itself
100
+		$autoloadPaths=array(
101
+			__DIR__.'/../../../autoload.php', // prado as dependency
102
+			__DIR__.'/../vendor/autoload.php', // prado itself
103 103
 		);
104 104
 		foreach($autoloadPaths as $autoloadPath)
105 105
 			if(file_exists($autoloadPath)) {
106
-				self::$_loader = $autoloadPath;
106
+				self::$_loader=$autoloadPath;
107 107
 				break;
108 108
 			}
109 109
 
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
 		/**
121 121
 		 * Sets error handler to be Prado::phpErrorHandler
122 122
 		 */
123
-		set_error_handler(array('\Prado\PradoBase','phpErrorHandler'));
123
+		set_error_handler(array('\Prado\PradoBase', 'phpErrorHandler'));
124 124
 		/**
125 125
 		 * Sets shutdown function to be Prado::phpFatalErrorHandler
126 126
 		 */
127
-		register_shutdown_function(array('PradoBase','phpFatalErrorHandler'));
127
+		register_shutdown_function(array('PradoBase', 'phpFatalErrorHandler'));
128 128
 		/**
129 129
 		 * Sets exception handler to be Prado::exceptionHandler
130 130
 		 */
131
-		set_exception_handler(array('\Prado\PradoBase','exceptionHandler'));
131
+		set_exception_handler(array('\Prado\PradoBase', 'exceptionHandler'));
132 132
 		/**
133 133
 		 * Disable php's builtin error reporting to avoid duplicated reports
134 134
 		 */
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public static function poweredByPrado($logoType=0)
161 161
 	{
162
-		$logoName=$logoType==1?'powered2':'powered';
162
+		$logoName=$logoType==1 ? 'powered2' : 'powered';
163 163
 		if(self::$_application!==null)
164 164
 		{
165 165
 			$am=self::$_application->getAssetManager();
166
-			$url=$am->publishFilePath(self::getPathOfNamespace('Prado\\'.$logoName,'.gif'));
166
+			$url=$am->publishFilePath(self::getPathOfNamespace('Prado\\'.$logoName, '.gif'));
167 167
 		}
168 168
 		else
169 169
 			$url='http://pradosoft.github.io/docs/'.$logoName.'.gif';
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 	 * @param string the filename that the error was raised in
181 181
 	 * @param integer the line number the error was raised at
182 182
 	 */
183
-	public static function phpErrorHandler($errno,$errstr,$errfile,$errline)
183
+	public static function phpErrorHandler($errno, $errstr, $errfile, $errline)
184 184
 	{
185 185
 		if(error_reporting() & $errno)
186
-			throw new TPhpErrorException($errno,$errstr,$errfile,$errline);
186
+			throw new TPhpErrorException($errno, $errstr, $errfile, $errline);
187 187
 	}
188 188
 
189 189
 	/**
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	public static function phpFatalErrorHandler()
196 196
 	{
197
-		$error = error_get_last();
197
+		$error=error_get_last();
198 198
 		if($error && 
199 199
 			TPhpErrorException::isFatalError($error) &&
200 200
 			error_reporting() & $error['type'])
201 201
 		{
202
-			self::exceptionHandler(new TPhpErrorException($error['type'],$error['message'],$error['file'],$error['line']));
202
+			self::exceptionHandler(new TPhpErrorException($error['type'], $error['message'], $error['file'], $error['line']));
203 203
 		}
204 204
 	}
205 205
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	{
217 217
 		if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null)
218 218
 		{
219
-			$errorHandler->handleError(null,$exception);
219
+			$errorHandler->handleError(null, $exception);
220 220
 		}
221 221
 		else
222 222
 		{
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 
266 266
 	protected static function prado3NamespaceToPhpNamespace($type)
267 267
 	{
268
-		if(substr($type, 0, 6) === 'System')
268
+		if(substr($type, 0, 6)==='System')
269 269
 			$type='Prado'.substr($type, 6);
270 270
 
271 271
 		return str_replace('.', '\\', $type);
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	public static function createComponent($requestedType)
288 288
 	{
289
-		$type = static::prado3NamespaceToPhpNamespace($requestedType);
289
+		$type=static::prado3NamespaceToPhpNamespace($requestedType);
290 290
 
291 291
 		if(!isset(self::$classExists[$type]))
292
-			self::$classExists[$type] = class_exists($type, false);
292
+			self::$classExists[$type]=class_exists($type, false);
293 293
 
294
-		if( !isset(self::$_usings[$type]) && !self::$classExists[$type]) {
294
+		if(!isset(self::$_usings[$type]) && !self::$classExists[$type]) {
295 295
 			static::using($type);
296
-			self::$classExists[$type] = class_exists($type, false);
296
+			self::$classExists[$type]=class_exists($type, false);
297 297
 		}
298 298
 
299 299
 		/*
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
 		 * code expects the class not to be php5.3-namespaced (eg: MyDataModule instead of
303 303
 		 * \Application\Common\MyDataModule)
304 304
 		 */
305
-		if( ($pos = strrpos($type, '\\')) !== false & ($requestedType != $type))
306
-			$type = substr($type,$pos+1);
305
+		if(($pos=strrpos($type, '\\'))!==false & ($requestedType!=$type))
306
+			$type=substr($type, $pos + 1);
307 307
 
308
-		if(($n=func_num_args())>1)
308
+		if(($n=func_num_args()) > 1)
309 309
 		{
310
-			$args = func_get_args();
310
+			$args=func_get_args();
311 311
 			switch($n) {
312 312
 				case 2:
313 313
 					return new $type($args[1]);
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 				break;
324 324
 				default:
325 325
 					$s='$args[1]';
326
-					for($i=2;$i<$n;++$i)
326
+					for($i=2; $i < $n; ++$i)
327 327
 						$s.=",\$args[$i]";
328 328
 					eval("\$component=new $type($s);");
329 329
 					return $component;
@@ -343,21 +343,21 @@  discard block
 block discarded – undo
343 343
 	 * @param boolean whether to check the existence of the class after the class file is included
344 344
 	 * @throws TInvalidDataValueException if the namespace is invalid
345 345
 	 */
346
-	public static function using($namespace,$checkClassExistence=true)
346
+	public static function using($namespace, $checkClassExistence=true)
347 347
 	{
348
-		$namespace = static::prado3NamespaceToPhpNamespace($namespace);
348
+		$namespace=static::prado3NamespaceToPhpNamespace($namespace);
349 349
 
350
-		if(isset(self::$_usings[$namespace]) || class_exists($namespace,false))
350
+		if(isset(self::$_usings[$namespace]) || class_exists($namespace, false))
351 351
 			return;
352
-		if(($pos=strrpos($namespace,'\\'))===false)
352
+		if(($pos=strrpos($namespace, '\\'))===false)
353 353
 		{
354 354
 			// trying to autoload an old class name
355 355
 			foreach(self::$_usings as $k => $v)
356 356
 			{
357
-				$path = $v . DIRECTORY_SEPARATOR . $namespace . self::CLASS_FILE_EXT;
357
+				$path=$v.DIRECTORY_SEPARATOR.$namespace.self::CLASS_FILE_EXT;
358 358
 				if(file_exists($path))
359 359
 				{
360
-					$phpNamespace = '\\'. $k.'\\'.$namespace;
360
+					$phpNamespace='\\'.$k.'\\'.$namespace;
361 361
 					if(class_exists($phpNamespace, true) || interface_exists($phpNamespace, true))
362 362
 					{
363 363
 						if(!class_exists($namespace) && !interface_exists($namespace))
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 				}
368 368
 			}
369 369
 
370
-			if($checkClassExistence && !class_exists($namespace,false) && !interface_exists($namespace,false))
371
-				throw new TInvalidOperationException('prado_component_unknown',$namespace,'');
370
+			if($checkClassExistence && !class_exists($namespace, false) && !interface_exists($namespace, false))
371
+				throw new TInvalidOperationException('prado_component_unknown', $namespace, '');
372 372
 		}
373
-		else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null)
373
+		else if(($path=self::getPathOfNamespace($namespace, self::CLASS_FILE_EXT))!==null)
374 374
 		{
375
-			$className=substr($namespace,$pos+1);
375
+			$className=substr($namespace, $pos + 1);
376 376
 			if($className==='*')  // a directory
377 377
 			{
378 378
 				self::$_usings[substr($namespace, 0, $pos)]=$path;
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 			else  // a file
381 381
 			{
382 382
 				//self::$_usings[$namespace]=$path;
383
-				if(!$checkClassExistence || (!class_exists($className,false) && !interface_exists($className, false)))
383
+				if(!$checkClassExistence || (!class_exists($className, false) && !interface_exists($className, false)))
384 384
 				{
385 385
 					try
386 386
 					{
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 					}
391 391
 					catch(\Exception $e)
392 392
 					{
393
-						if($checkClassExistence && !class_exists($className,false))
394
-							throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage());
393
+						if($checkClassExistence && !class_exists($className, false))
394
+							throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage());
395 395
 						else
396 396
 							throw $e;
397 397
 					}
@@ -414,9 +414,9 @@  discard block
 block discarded – undo
414 414
 	 */
415 415
 	public static function getPathOfNamespace($namespace, $ext='')
416 416
 	{
417
-		$namespace = static::prado3NamespaceToPhpNamespace($namespace);
417
+		$namespace=static::prado3NamespaceToPhpNamespace($namespace);
418 418
 
419
-		if(self::CLASS_FILE_EXT === $ext || empty($ext))
419
+		if(self::CLASS_FILE_EXT===$ext || empty($ext))
420 420
 		{
421 421
 			if(isset(self::$_usings[$namespace]))
422 422
 				return self::$_usings[$namespace];
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
 				return self::$_aliases[$namespace];
426 426
 		}
427 427
 
428
-		$segs = explode('\\',$namespace);
429
-		$alias = array_shift($segs);
428
+		$segs=explode('\\', $namespace);
429
+		$alias=array_shift($segs);
430 430
 
431
-		if(null !== ($file = array_pop($segs)) && null !== ($root = self::getPathOfAlias($alias)))
432
-			return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR ,$segs),'/\\').(($file === '*') ? '' : DIRECTORY_SEPARATOR.$file.$ext);
431
+		if(null!==($file=array_pop($segs)) && null!==($root=self::getPathOfAlias($alias)))
432
+			return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $segs), '/\\').(($file==='*') ? '' : DIRECTORY_SEPARATOR.$file.$ext);
433 433
 
434 434
 		return null;
435 435
 	}
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 */
441 441
 	public static function getPathOfAlias($alias)
442 442
 	{
443
-		return isset(self::$_aliases[$alias])?self::$_aliases[$alias]:null;
443
+		return isset(self::$_aliases[$alias]) ? self::$_aliases[$alias] : null;
444 444
 	}
445 445
 
446 446
 	protected static function getPathAliases()
@@ -454,19 +454,19 @@  discard block
 block discarded – undo
454 454
 	 * @throws TInvalidOperationException if the alias is already defined
455 455
 	 * @throws TInvalidDataValueException if the path is not a valid file path
456 456
 	 */
457
-	public static function setPathOfAlias($alias,$path)
457
+	public static function setPathOfAlias($alias, $path)
458 458
 	{
459 459
 		if(isset(self::$_aliases[$alias]) && !defined('PRADO_TEST_RUN'))
460
-			throw new TInvalidOperationException('prado_alias_redefined',$alias);
460
+			throw new TInvalidOperationException('prado_alias_redefined', $alias);
461 461
 		else if(($rp=realpath($path))!==false && is_dir($rp))
462 462
 		{
463
-			if(strpos($alias,'.')===false)
463
+			if(strpos($alias, '.')===false)
464 464
 				self::$_aliases[$alias]=$rp;
465 465
 			else
466
-				throw new TInvalidDataValueException('prado_aliasname_invalid',$alias);
466
+				throw new TInvalidDataValueException('prado_aliasname_invalid', $alias);
467 467
 		}
468 468
 		else
469
-			throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path);
469
+			throw new TInvalidDataValueException('prado_alias_invalid', $alias, $path);
470 470
 	}
471 471
 
472 472
 	/**
@@ -491,13 +491,13 @@  discard block
 block discarded – undo
491 491
 				continue;
492 492
 			echo '#'.$index.' ';
493 493
 			if(isset($t['file']))
494
-				echo basename($t['file']) . ':' . $t['line'];
494
+				echo basename($t['file']).':'.$t['line'];
495 495
 			else
496 496
 				 echo '<PHP inner-code>';
497 497
 			echo ' -- ';
498 498
 			if(isset($t['class']))
499
-				echo $t['class'] . $t['type'];
500
-			echo $t['function'] . '(';
499
+				echo $t['class'].$t['type'];
500
+			echo $t['function'].'(';
501 501
 			if(isset($t['args']) && sizeof($t['args']) > 0)
502 502
 			{
503 503
 				$count=0;
@@ -506,25 +506,25 @@  discard block
 block discarded – undo
506 506
 					if(is_string($item))
507 507
 					{
508 508
 						$str=htmlentities(str_replace("\r\n", "", $item), ENT_QUOTES);
509
-						if (strlen($item) > 70)
510
-							echo "'". substr($str, 0, 70) . "...'";
509
+						if(strlen($item) > 70)
510
+							echo "'".substr($str, 0, 70)."...'";
511 511
 						else
512
-							echo "'" . $str . "'";
512
+							echo "'".$str."'";
513 513
 					}
514
-					else if (is_int($item) || is_float($item))
514
+					else if(is_int($item) || is_float($item))
515 515
 						echo $item;
516
-					else if (is_object($item))
516
+					else if(is_object($item))
517 517
 						echo get_class($item);
518
-					else if (is_array($item))
519
-						echo 'array(' . count($item) . ')';
520
-					else if (is_bool($item))
518
+					else if(is_array($item))
519
+						echo 'array('.count($item).')';
520
+					else if(is_bool($item))
521 521
 						echo $item ? 'true' : 'false';
522
-					else if ($item === null)
522
+					else if($item===null)
523 523
 						echo 'NULL';
524
-					else if (is_resource($item))
524
+					else if(is_resource($item))
525 525
 						echo get_resource_type($item);
526 526
 					$count++;
527
-					if (count($t['args']) > $count)
527
+					if(count($t['args']) > $count)
528 528
 						echo ', ';
529 529
 				}
530 530
 			}
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
 			else
552 552
 			{
553 553
 				$languages=array();
554
-				foreach(explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language)
554
+				foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language)
555 555
 				{
556
-					$array=explode(';q=',trim($language));
557
-					$languages[trim($array[0])]=isset($array[1])?(float)$array[1]:1.0;
556
+					$array=explode(';q=', trim($language));
557
+					$languages[trim($array[0])]=isset($array[1]) ? (float) $array[1] : 1.0;
558 558
 				}
559 559
 				arsort($languages);
560 560
 				$languages=array_keys($languages);
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		if($language===null)
576 576
 		{
577 577
 			$langs=Prado::getUserLanguages();
578
-			$lang=explode('-',$langs[0]);
578
+			$lang=explode('-', $langs[0]);
579 579
 			if(empty($lang[0]) || !ctype_alpha($lang[0]))
580 580
 				$language='en';
581 581
 			else
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	 * @param (string|TControl) control of the message
597 597
 	 * @see log, getLogger
598 598
 	 */
599
-	public static function trace($msg,$category='Uncategorized',$ctl=null)
599
+	public static function trace($msg, $category='Uncategorized', $ctl=null)
600 600
 	{
601 601
 		if(self::$_application && self::$_application->getMode()===TApplicationMode::Performance)
602 602
 			return;
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 		}
610 610
 		else
611 611
 			$level=TLogger::INFO;
612
-		self::log($msg,$level,$category,$ctl);
612
+		self::log($msg, $level, $category, $ctl);
613 613
 	}
614 614
 
615 615
 	/**
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
 	 * @param string category of the message
625 625
 	 * @param (string|TControl) control of the message
626 626
 	 */
627
-	public static function log($msg,$level=TLogger::INFO,$category='Uncategorized',$ctl=null)
627
+	public static function log($msg, $level=TLogger::INFO, $category='Uncategorized', $ctl=null)
628 628
 	{
629 629
 		if(self::$_logger===null)
630 630
 			self::$_logger=new TLogger;
631
-		self::$_logger->log($msg,$level,$category,$ctl);
631
+		self::$_logger->log($msg, $level, $category, $ctl);
632 632
 	}
633 633
 
634 634
 	/**
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 	 * @param boolean whether to syntax highlight the output. Defaults to false.
651 651
 	 * @return string the string representation of the variable
652 652
 	 */
653
-	public static function varDump($var,$depth=10,$highlight=false)
653
+	public static function varDump($var, $depth=10, $highlight=false)
654 654
 	{
655
-		return TVarDumper::dump($var,$depth,$highlight);
655
+		return TVarDumper::dump($var, $depth, $highlight);
656 656
 	}
657 657
 
658 658
 	/**
@@ -667,31 +667,31 @@  discard block
 block discarded – undo
667 667
 	 */
668 668
 	public static function localize($text, $parameters=array(), $catalogue=null, $charset=null)
669 669
 	{
670
-		$app = Prado::getApplication()->getGlobalization(false);
670
+		$app=Prado::getApplication()->getGlobalization(false);
671 671
 
672
-		$params = array();
672
+		$params=array();
673 673
 		foreach($parameters as $key => $value)
674
-			$params['{'.$key.'}'] = $value;
674
+			$params['{'.$key.'}']=$value;
675 675
 
676 676
 		//no translation handler provided
677
-		if($app===null || ($config = $app->getTranslationConfiguration())===null)
677
+		if($app===null || ($config=$app->getTranslationConfiguration())===null)
678 678
 			return strtr($text, $params);
679 679
 
680
-		if ($catalogue===null)
681
-			$catalogue=isset($config['catalogue'])?$config['catalogue']:'messages';
680
+		if($catalogue===null)
681
+			$catalogue=isset($config['catalogue']) ? $config['catalogue'] : 'messages';
682 682
 
683 683
 		Translation::init($catalogue);
684 684
 
685 685
 		//globalization charset
686
-		$appCharset = $app===null ? '' : $app->getCharset();
686
+		$appCharset=$app===null ? '' : $app->getCharset();
687 687
 
688 688
 		//default charset
689
-		$defaultCharset = ($app===null) ? 'UTF-8' : $app->getDefaultCharset();
689
+		$defaultCharset=($app===null) ? 'UTF-8' : $app->getDefaultCharset();
690 690
 
691 691
 		//fall back
692
-		if(empty($charset)) $charset = $appCharset;
693
-		if(empty($charset)) $charset = $defaultCharset;
692
+		if(empty($charset)) $charset=$appCharset;
693
+		if(empty($charset)) $charset=$defaultCharset;
694 694
 
695
-		return Translation::formatter($catalogue)->format($text,$params,$catalogue,$charset);
695
+		return Translation::formatter($catalogue)->format($text, $params, $catalogue, $charset);
696 696
 	}
697 697
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -164,8 +164,7 @@  discard block
 block discarded – undo
164 164
 		{
165 165
 			$am=self::$_application->getAssetManager();
166 166
 			$url=$am->publishFilePath(self::getPathOfNamespace('Prado\\'.$logoName,'.gif'));
167
-		}
168
-		else
167
+		} else
169 168
 			$url='http://pradosoft.github.io/docs/'.$logoName.'.gif';
170 169
 		return '<a title="Powered by PRADO" href="https://github.com/pradosoft/prado" target="_blank"><img src="'.$url.'" style="border-width:0px;" alt="Powered by PRADO" /></a>';
171 170
 	}
@@ -217,8 +216,7 @@  discard block
 block discarded – undo
217 216
 		if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null)
218 217
 		{
219 218
 			$errorHandler->handleError(null,$exception);
220
-		}
221
-		else
219
+		} else
222 220
 		{
223 221
 			echo $exception;
224 222
 		}
@@ -329,8 +327,7 @@  discard block
 block discarded – undo
329 327
 					return $component;
330 328
 				break;
331 329
 			}
332
-		}
333
-		else
330
+		} else
334 331
 			return new $type;
335 332
 	}
336 333
 
@@ -369,15 +366,13 @@  discard block
 block discarded – undo
369 366
 
370 367
 			if($checkClassExistence && !class_exists($namespace,false) && !interface_exists($namespace,false))
371 368
 				throw new TInvalidOperationException('prado_component_unknown',$namespace,'');
372
-		}
373
-		else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null)
369
+		} else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null)
374 370
 		{
375 371
 			$className=substr($namespace,$pos+1);
376 372
 			if($className==='*')  // a directory
377 373
 			{
378 374
 				self::$_usings[substr($namespace, 0, $pos)]=$path;
379
-			}
380
-			else  // a file
375
+			} else  // a file
381 376
 			{
382 377
 				//self::$_usings[$namespace]=$path;
383 378
 				if(!$checkClassExistence || (!class_exists($className,false) && !interface_exists($className, false)))
@@ -387,8 +382,7 @@  discard block
 block discarded – undo
387 382
 						include_once($path);
388 383
 						if(class_exists($namespace, false) || interface_exists($namespace, false))
389 384
 							class_alias($namespace, $className, true);
390
-					}
391
-					catch(\Exception $e)
385
+					} catch(\Exception $e)
392 386
 					{
393 387
 						if($checkClassExistence && !class_exists($className,false))
394 388
 							throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage());
@@ -464,8 +458,7 @@  discard block
 block discarded – undo
464 458
 				self::$_aliases[$alias]=$rp;
465 459
 			else
466 460
 				throw new TInvalidDataValueException('prado_aliasname_invalid',$alias);
467
-		}
468
-		else
461
+		} else
469 462
 			throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path);
470 463
 	}
471 464
 
@@ -510,8 +503,7 @@  discard block
 block discarded – undo
510 503
 							echo "'". substr($str, 0, 70) . "...'";
511 504
 						else
512 505
 							echo "'" . $str . "'";
513
-					}
514
-					else if (is_int($item) || is_float($item))
506
+					} else if (is_int($item) || is_float($item))
515 507
 						echo $item;
516 508
 					else if (is_object($item))
517 509
 						echo get_class($item);
@@ -606,8 +598,7 @@  discard block
 block discarded – undo
606 598
 			if(isset($trace[0]['file']) && isset($trace[0]['line']))
607 599
 				$msg.=" (line {$trace[0]['line']}, {$trace[0]['file']})";
608 600
 			$level=TLogger::DEBUG;
609
-		}
610
-		else
601
+		} else
611 602
 			$level=TLogger::INFO;
612 603
 		self::log($msg,$level,$category,$ctl);
613 604
 	}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveDataGrid.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 
70 70
 	/**
71
-	* Creates a new callback control, sets the adapter to
72
-	* TActiveControlAdapter.
73
-	*/
71
+	 * Creates a new callback control, sets the adapter to
72
+	 * TActiveControlAdapter.
73
+	 */
74 74
 	public function __construct() {
75 75
 		parent::__construct();
76 76
 		$this->setAdapter(new TActiveControlAdapter($this));
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @param string $value container tag
112 112
 	 */
113 113
 	public function setSurroundingTag($value) {
114
-    $this->_surroundingTag=TPropertyValue::ensureString($value);
114
+	$this->_surroundingTag=TPropertyValue::ensureString($value);
115 115
 	}
116 116
 
117 117
 	/**
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		parent::setDataSource($value);
90 90
 		if($this->getActiveControl()->canUpdateClientSide()) {
91 91
 			$this->renderPager();
92
-			$this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter());
92
+			$this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter());
93 93
 		}
94 94
 	}
95 95
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @param string CommandParameter corresponding to the OnCommand event of the button
132 132
 	 * @return mixed the button instance
133 133
 	 */
134
-	protected function createPagerButton($pager,$buttonType,$enabled,$text,$commandName,$commandParameter) {
134
+	protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter) {
135 135
 		if($buttonType===TDataGridPagerButtonType::LinkButton) {
136 136
 			if($enabled)
137 137
 				$button=new TActiveLinkButton;
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	public function render($writer) {
175 175
 		if($this->getHasPreRendered()) {
176 176
 			$this->renderDataGrid($writer);
177
-			if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer);
177
+			if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer);
178 178
 		}
179 179
 		else {
180
-			$this->getPage()->getAdapter()->registerControlToRender($this,$writer);
180
+			$this->getPage()->getAdapter()->registerControlToRender($this, $writer);
181 181
 		}
182 182
 	}
183 183
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		foreach($pager as $item) {
192 192
 			if($item->ControlToPaginate==$this->ID) {
193 193
 				$writer=$this->getResponse()->createHtmlWriter();
194
-				$this->getPage()->getAdapter()->registerControlToRender($item,$writer);
194
+				$this->getPage()->getAdapter()->registerControlToRender($item, $writer);
195 195
 			}
196 196
 		}
197 197
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @param THtmlWriter writer for the rendering purpose
204 204
 	 */
205 205
 	private function renderDataGrid($writer) {
206
-	  $writer->addAttribute('id',$this->getSurroundingTagID());
206
+	  $writer->addAttribute('id', $this->getSurroundingTagID());
207 207
 	  $writer->renderBeginTag($this->getSurroundingTag());
208 208
 		parent::render($writer);
209 209
 		$writer->renderEndTag();
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -140,8 +140,7 @@  discard block
 block discarded – undo
140 140
 				$button->setText($text);
141 141
 				return $button;
142 142
 			}
143
-		}
144
-		else {
143
+		} else {
145 144
 			$button=new TActiveButton;
146 145
 			if(!$enabled)
147 146
 				$button->setEnabled(false);
@@ -175,8 +174,7 @@  discard block
 block discarded – undo
175 174
 		if($this->getHasPreRendered()) {
176 175
 			$this->renderDataGrid($writer);
177 176
 			if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer);
178
-		}
179
-		else {
177
+		} else {
180 178
 			$this->getPage()->getAdapter()->registerControlToRender($this,$writer);
181 179
 		}
182 180
 	}
Please login to merge, or discard this patch.
framework/Collections/TAttributeCollection.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -93,6 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 	/**
95 95
 	 * @param boolean whether the keys are case-sensitive.
96
+	 * @param boolean $value
96 97
 	 */
97 98
 	public function setCaseSensitive($value)
98 99
 	{
@@ -126,6 +127,7 @@  discard block
 block discarded – undo
126 127
 	 * Removes an item from the map by its key.
127 128
 	 * This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false.
128 129
 	 * @param mixed the key of the item to be removed
130
+	 * @param string $key
129 131
 	 * @return mixed the removed value, null if no such key exists.
130 132
 	 */
131 133
 	public function remove($key)
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	protected function __getZappableSleepProps(&$exprops)
54 54
 	{
55 55
 		parent::__getZappableSleepProps($exprops);
56
-		if ($this->_caseSensitive===false)
57
-			$exprops[] = "\0TAttributeCollection\0_caseSensitive";
56
+		if($this->_caseSensitive===false)
57
+			$exprops[]="\0TAttributeCollection\0_caseSensitive";
58 58
 	}
59 59
 
60 60
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function __get($name)
69 69
 	{
70
-		return $this->contains($name)?$this->itemAt($name):parent::__get($name);
70
+		return $this->contains($name) ? $this->itemAt($name) : parent::__get($name);
71 71
 	}
72 72
 
73 73
 	/**
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * @param mixed the property value or event handler
79 79
 	 * @throws TInvalidOperationException If the property is not defined or read-only.
80 80
 	 */
81
-	public function __set($name,$value)
81
+	public function __set($name, $value)
82 82
 	{
83
-		$this->add($name,$value);
83
+		$this->add($name, $value);
84 84
 	}
85 85
 
86 86
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function itemAt($key)
109 109
 	{
110
-		return parent::itemAt($this->_caseSensitive?$key:strtolower($key));
110
+		return parent::itemAt($this->_caseSensitive ? $key : strtolower($key));
111 111
 	}
112 112
 
113 113
 
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 	 * @param mixed key
118 118
 	 * @param mixed value
119 119
 	 */
120
-	public function add($key,$value)
120
+	public function add($key, $value)
121 121
 	{
122
-		parent::add($this->_caseSensitive?$key:strtolower($key),$value);
122
+		parent::add($this->_caseSensitive ? $key : strtolower($key), $value);
123 123
 	}
124 124
 
125 125
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function remove($key)
132 132
 	{
133
-		return parent::remove($this->_caseSensitive?$key:strtolower($key));
133
+		return parent::remove($this->_caseSensitive ? $key : strtolower($key));
134 134
 	}
135 135
 
136 136
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function contains($key)
143 143
 	{
144
-		return parent::contains($this->_caseSensitive?$key:strtolower($key));
144
+		return parent::contains($this->_caseSensitive ? $key : strtolower($key));
145 145
 	}
146 146
 
147 147
 	/**
Please login to merge, or discard this patch.
framework/I18N/TGlobalization.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	/**
93
-	 * @return string default culture
93
+	 * @return boolean default culture
94 94
 	 */
95 95
 	public function getTranslateDefaultCulture()
96 96
 	{
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 	 * Default character set is 'UTF-8'.
30 30
 	 * @var string
31 31
 	 */
32
-	private $_defaultCharset = 'UTF-8';
32
+	private $_defaultCharset='UTF-8';
33 33
 
34 34
 	/**
35 35
 	 * Default culture is 'en'.
36 36
 	 * @var string
37 37
 	 */
38
-	private $_defaultCulture = 'en';
38
+	private $_defaultCulture='en';
39 39
 
40 40
 	/**
41 41
 	 * The current charset.
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 		if($config!==null)
78 78
 		{
79 79
 			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
80
-				$translation = isset($config['translate'])?$config['translate']:null;
80
+				$translation=isset($config['translate']) ? $config['translate'] : null;
81 81
 			else
82 82
 			{
83
-				$t = $config->getElementByTagName('translation');
84
-				$translation = ($t)?$t->getAttributes():null;
83
+				$t=$config->getElementByTagName('translation');
84
+				$translation=($t) ? $t->getAttributes() : null;
85 85
 			}
86 86
 			if($translation)
87 87
 				$this->setTranslationConfiguration($translation);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function setTranslateDefaultCulture($value)
104 104
 	{
105
-		$this->_translateDefaultCulture = TPropertyValue::ensureBoolean($value);
105
+		$this->_translateDefaultCulture=TPropertyValue::ensureBoolean($value);
106 106
 	}
107 107
 
108 108
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	public function setDefaultCulture($culture)
120 120
 	{
121
-		$this->_defaultCulture = str_replace('-','_',$culture);
121
+		$this->_defaultCulture=str_replace('-', '_', $culture);
122 122
 	}
123 123
 
124 124
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function setDefaultCharset($charset)
136 136
 	{
137
-		$this->_defaultCharset = $charset;
137
+		$this->_defaultCharset=$charset;
138 138
 	}
139 139
 
140 140
 	/**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	public function setCulture($culture)
152 152
 	{
153
-		$this->_culture = str_replace('-','_',$culture);
153
+		$this->_culture=str_replace('-', '_', $culture);
154 154
 	}
155 155
 
156 156
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public function setCharset($charset)
168 168
 	{
169
-		$this->_charset = $charset;
169
+		$this->_charset=$charset;
170 170
 	}
171 171
 
172 172
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function getTranslationConfiguration()
176 176
 	{
177
-		return (!$this->_translateDefaultCulture && ($this->getDefaultCulture() == $this->getCulture()))
177
+		return (!$this->_translateDefaultCulture && ($this->getDefaultCulture()==$this->getCulture()))
178 178
 			? null
179 179
 			: $this->_translation;
180 180
 	}
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	protected function setTranslationConfiguration($config)
198 198
 	{
199
-		if($config['type'] == 'XLIFF' || $config['type'] == 'gettext')
199
+		if($config['type']=='XLIFF' || $config['type']=='gettext')
200 200
 		{
201 201
 			if($config['source'])
202 202
 			{
203
-				$config['source'] = Prado::getPathOfNamespace($config['source']);
203
+				$config['source']=Prado::getPathOfNamespace($config['source']);
204 204
 				if(!is_dir($config['source']))
205 205
 				{
206 206
 					if(@mkdir($config['source'])===false)
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		}
217 217
 		if($config['cache'])
218 218
 		{
219
-			$config['cache'] = $this->getApplication()->getRunTimePath().'/i18n';
219
+			$config['cache']=$this->getApplication()->getRunTimePath().'/i18n';
220 220
 			if(!is_dir($config['cache']))
221 221
 			{
222 222
 				if(@mkdir($config['cache'])===false)
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 				chmod($config['cache'], PRADO_CHMOD); //make it deletable
226 226
 			}
227 227
 		}
228
-		$this->_translation = $config;
228
+		$this->_translation=$config;
229 229
 	}
230 230
 
231 231
 	/**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function setTranslationCatalogue($value)
243 243
 	{
244
-		$this->_translation['catalogue'] = $value;
244
+		$this->_translation['catalogue']=$value;
245 245
 	}
246 246
 
247 247
 	/**
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function getCultureVariants($culture=null)
254 254
 	{
255
-		if($culture===null) $culture = $this->getCulture();
256
-		$variants = explode('_', $culture);
257
-		$result = array();
255
+		if($culture===null) $culture=$this->getCulture();
256
+		$variants=explode('_', $culture);
257
+		$result=array();
258 258
 		for(; count($variants) > 0; array_pop($variants))
259
-			$result[] = implode('_', $variants);
259
+			$result[]=implode('_', $variants);
260 260
 		return $result;
261 261
 	}
262 262
 
@@ -279,17 +279,17 @@  discard block
 block discarded – undo
279 279
 	 * @param string culture string, null to use current culture
280 280
 	 * @return array list of possible localized resource files.
281 281
 	 */
282
-	public function getLocalizedResource($file,$culture=null)
282
+	public function getLocalizedResource($file, $culture=null)
283 283
 	{
284
-		$files = array();
285
-		$variants = $this->getCultureVariants($culture);
286
-		$path = pathinfo($file);
284
+		$files=array();
285
+		$variants=$this->getCultureVariants($culture);
286
+		$path=pathinfo($file);
287 287
 		foreach($variants as $variant)
288
-			$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename'];
289
-		$filename = substr($path['basename'],0,strrpos($path['basename'],'.'));
288
+			$files[]=$path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename'];
289
+		$filename=substr($path['basename'], 0, strrpos($path['basename'], '.'));
290 290
 		foreach($variants as $variant)
291
-			$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension'];
292
-		$files[] = $file;
291
+			$files[]=$path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension'];
292
+		$files[]=$file;
293 293
 		return $files;
294 294
 	}
295 295
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -233,8 +233,7 @@  discard block
 block discarded – undo
233 233
 				$newid=substr($id,$pos+1);
234 234
 				if ($control!==null)
235 235
 					$control=$control->$newid;
236
-			}
237
-			else
236
+			} else
238 237
 			{
239 238
 				// TCheckBoxList overrides findControl() with a fake implementation
240 239
 				// but accepts a second parameter to use the standard one
@@ -296,8 +295,7 @@  discard block
 block discarded – undo
296 295
 		{
297 296
 			$group=$this->getValidationGroup();
298 297
 			return $this->getPage()->getValidators($group)->getCount()>0;
299
-		}
300
-		else
298
+		} else
301 299
 			return false;
302 300
 	}
303 301
 
Please login to merge, or discard this patch.
framework/Security/TSecurityManager.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	}
183 183
 
184 184
 	/**
185
-	 * @return mixed the algorithm used to encrypt/decrypt data. Defaults to the string 'rijndael-256'.
185
+	 * @return string the algorithm used to encrypt/decrypt data. Defaults to the string 'rijndael-256'.
186 186
 	 */
187 187
 	public function getCryptAlgorithm()
188 188
 	{
@@ -201,6 +201,7 @@  discard block
 block discarded – undo
201 201
 	/**
202 202
 	 * Encrypts data with {@link getEncryptionKey EncryptionKey}.
203 203
 	 * @param string data to be encrypted.
204
+	 * @param string $data
204 205
 	 * @return string the encrypted data
205 206
 	 * @throws TNotSupportedException if PHP Mcrypt extension is not loaded
206 207
 	 */
@@ -220,6 +221,7 @@  discard block
 block discarded – undo
220 221
 	/**
221 222
 	 * Decrypts data with {@link getEncryptionKey EncryptionKey}.
222 223
 	 * @param string data to be decrypted.
224
+	 * @param string $data
223 225
 	 * @return string the decrypted data
224 226
 	 * @throws TNotSupportedException if PHP Mcrypt extension is not loaded
225 227
 	 */
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  */
45 45
 class TSecurityManager extends \Prado\TModule
46 46
 {
47
-	const STATE_VALIDATION_KEY = 'prado:securitymanager:validationkey';
48
-	const STATE_ENCRYPTION_KEY = 'prado:securitymanager:encryptionkey';
47
+	const STATE_VALIDATION_KEY='prado:securitymanager:validationkey';
48
+	const STATE_ENCRYPTION_KEY='prado:securitymanager:encryptionkey';
49 49
 
50
-	private $_validationKey = null;
51
-	private $_encryptionKey = null;
52
-	private $_hashAlgorithm = 'sha1';
53
-	private $_cryptAlgorithm = 'rijndael-256';
50
+	private $_validationKey=null;
51
+	private $_encryptionKey=null;
52
+	private $_hashAlgorithm='sha1';
53
+	private $_cryptAlgorithm='rijndael-256';
54 54
 	private $_mbstring;
55 55
 
56 56
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	protected function generateRandomKey()
71 71
 	{
72
-		return sprintf('%08x%08x%08x%08x',mt_rand(),mt_rand(),mt_rand(),mt_rand());
72
+		return sprintf('%08x%08x%08x%08x', mt_rand(), mt_rand(), mt_rand(), mt_rand());
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function getValidationKey()
80 80
 	{
81
-		if(null === $this->_validationKey) {
82
-			if(null === ($this->_validationKey = $this->getApplication()->getGlobalState(self::STATE_VALIDATION_KEY))) {
83
-				$this->_validationKey = $this->generateRandomKey();
81
+		if(null===$this->_validationKey) {
82
+			if(null===($this->_validationKey=$this->getApplication()->getGlobalState(self::STATE_VALIDATION_KEY))) {
83
+				$this->_validationKey=$this->generateRandomKey();
84 84
 				$this->getApplication()->setGlobalState(self::STATE_VALIDATION_KEY, $this->_validationKey, null, true);
85 85
 			}
86 86
 		}
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function setValidationKey($value)
95 95
 	{
96
-		if('' === $value)
96
+		if(''===$value)
97 97
 			throw new TInvalidDataValueException('securitymanager_validationkey_invalid');
98 98
 
99
-		$this->_validationKey = $value;
99
+		$this->_validationKey=$value;
100 100
 	}
101 101
 
102 102
 	/**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function getEncryptionKey()
107 107
 	{
108
-		if(null === $this->_encryptionKey) {
109
-			if(null === ($this->_encryptionKey = $this->getApplication()->getGlobalState(self::STATE_ENCRYPTION_KEY))) {
110
-				$this->_encryptionKey = $this->generateRandomKey();
108
+		if(null===$this->_encryptionKey) {
109
+			if(null===($this->_encryptionKey=$this->getApplication()->getGlobalState(self::STATE_ENCRYPTION_KEY))) {
110
+				$this->_encryptionKey=$this->generateRandomKey();
111 111
 				$this->getApplication()->setGlobalState(self::STATE_ENCRYPTION_KEY, $this->_encryptionKey, null, true);
112 112
 			}
113 113
 		}
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function setEncryptionKey($value)
122 122
 	{
123
-		if('' === $value)
123
+		if(''===$value)
124 124
 			throw new TInvalidDataValueException('securitymanager_encryptionkey_invalid');
125 125
 
126
-		$this->_encryptionKey = $value;
126
+		$this->_encryptionKey=$value;
127 127
 	}
128 128
 
129 129
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function setValidation($value)
153 153
 	{
154
-		$this->_hashAlgorithm = TPropertyValue::ensureEnum($value, 'Prado\\Security\\TSecurityManagerValidationMode');
154
+		$this->_hashAlgorithm=TPropertyValue::ensureEnum($value, 'Prado\\Security\\TSecurityManagerValidationMode');
155 155
 	}
156 156
 
157 157
 	/**
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function setHashAlgorithm($value)
161 161
 	{
162
-		$this->_hashAlgorithm = TPropertyValue::ensureString($value);
162
+		$this->_hashAlgorithm=TPropertyValue::ensureString($value);
163 163
 	}
164 164
 
165 165
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public function setEncryption($value)
184 184
 	{
185
-		$this->_cryptAlgorithm = $value;
185
+		$this->_cryptAlgorithm=$value;
186 186
 	}
187 187
 
188 188
 	/**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function setCryptAlgorithm($value)
201 201
 	{
202
-		$this->_cryptAlgorithm = $value;
202
+		$this->_cryptAlgorithm=$value;
203 203
 	}
204 204
 
205 205
 	/**
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	public function encrypt($data)
212 212
 	{
213 213
 		$module=$this->openCryptModule();
214
-		$key = $this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
214
+		$key=$this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
215 215
 		srand();
216
-		$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($module), MCRYPT_RAND);
216
+		$iv=mcrypt_create_iv(mcrypt_enc_get_iv_size($module), MCRYPT_RAND);
217 217
 		mcrypt_generic_init($module, $key, $iv);
218
-		$encrypted = $iv.mcrypt_generic($module, $data);
218
+		$encrypted=$iv.mcrypt_generic($module, $data);
219 219
 		mcrypt_generic_deinit($module);
220 220
 		mcrypt_module_close($module);
221 221
 		return $encrypted;
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	public function decrypt($data)
231 231
 	{
232 232
 		$module=$this->openCryptModule();
233
-		$key = $this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
234
-		$ivSize = mcrypt_enc_get_iv_size($module);
235
-		$iv = $this->substr($data, 0, $ivSize);
233
+		$key=$this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
234
+		$ivSize=mcrypt_enc_get_iv_size($module);
235
+		$iv=$this->substr($data, 0, $ivSize);
236 236
 		mcrypt_generic_init($module, $key, $iv);
237
-		$decrypted = mdecrypt_generic($module, $this->substr($data, $ivSize, $this->strlen($data)));
237
+		$decrypted=mdecrypt_generic($module, $this->substr($data, $ivSize, $this->strlen($data)));
238 238
 		mcrypt_generic_deinit($module);
239 239
 		mcrypt_module_close($module);
240 240
 		return $decrypted;
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 		if(extension_loaded('mcrypt'))
251 251
 		{
252 252
 			if(is_array($this->_cryptAlgorithm))
253
-				$module=@call_user_func_array('mcrypt_module_open',$this->_cryptAlgorithm);
253
+				$module=@call_user_func_array('mcrypt_module_open', $this->_cryptAlgorithm);
254 254
 			else
255
-				$module=@mcrypt_module_open($this->_cryptAlgorithm,'', MCRYPT_MODE_CBC,'');
255
+				$module=@mcrypt_module_open($this->_cryptAlgorithm, '', MCRYPT_MODE_CBC, '');
256 256
 
257 257
 			if($module===false)
258 258
 				throw new TNotSupportedException('securitymanager_mcryptextension_initfailed');
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	public function hashData($data)
272 272
 	{
273
-		$hmac = $this->computeHMAC($data);
273
+		$hmac=$this->computeHMAC($data);
274 274
 		return $hmac.$data;
275 275
 	}
276 276
 
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
 		if($this->strlen($data) < $len)
289 289
 			return false;
290 290
 
291
-		$hmac = $this->substr($data, 0, $len);
291
+		$hmac=$this->substr($data, 0, $len);
292 292
 		$data2=$this->substr($data, $len, $this->strlen($data));
293
-		return $hmac === $this->computeHMAC($data2) ? $data2 : false;
293
+		return $hmac===$this->computeHMAC($data2) ? $data2 : false;
294 294
 	}
295 295
 
296 296
 	/**
@@ -300,22 +300,22 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	protected function computeHMAC($data)
302 302
 	{
303
-		$key = $this->getValidationKey();
303
+		$key=$this->getValidationKey();
304 304
 
305 305
 		if(function_exists('hash_hmac'))
306 306
 			return hash_hmac($this->_hashAlgorithm, $data, $key);
307 307
 
308
-		if(!strcasecmp($this->_hashAlgorithm,'sha1'))
308
+		if(!strcasecmp($this->_hashAlgorithm, 'sha1'))
309 309
 		{
310
-			$pack = 'H40';
311
-			$func = 'sha1';
310
+			$pack='H40';
311
+			$func='sha1';
312 312
 		} else {
313
-			$pack = 'H32';
314
-			$func = 'md5';
313
+			$pack='H32';
314
+			$func='md5';
315 315
 		}
316 316
 
317
-		$key = str_pad($func($key), 64, chr(0));
318
-		return $func((str_repeat(chr(0x5C), 64) ^ substr($key, 0, 64)) . pack($pack, $func((str_repeat(chr(0x36), 64) ^ substr($key, 0, 64)) . $data)));
317
+		$key=str_pad($func($key), 64, chr(0));
318
+		return $func((str_repeat(chr(0x5C), 64) ^ substr($key, 0, 64)).pack($pack, $func((str_repeat(chr(0x36), 64) ^ substr($key, 0, 64)).$data)));
319 319
 	}
320 320
 
321 321
 	/**
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	private function strlen($string)
328 328
 	{
329
-		return $this->_mbstring ? mb_strlen($string,'8bit') : strlen($string);
329
+		return $this->_mbstring ? mb_strlen($string, '8bit') : strlen($string);
330 330
 	}
331 331
 
332 332
 	/**
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 	 * @param int $length the desired portion length
338 338
 	 * @return string the extracted part of string, or FALSE on failure or an empty string.
339 339
 	 */
340
-	private function substr($string,$start,$length)
340
+	private function substr($string, $start, $length)
341 341
 	{
342
-		return $this->_mbstring ? mb_substr($string,$start,$length,'8bit') : substr($string,$start,$length);
342
+		return $this->_mbstring ? mb_substr($string, $start, $length, '8bit') : substr($string, $start, $length);
343 343
 	}
344 344
 }
345 345
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Security/TUser.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -73,6 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
 	/**
75 75
 	 * @param string username
76
+	 * @param string $value
76 77
 	 */
77 78
 	public function setName($value)
78 79
 	{
@@ -89,6 +90,7 @@  discard block
 block discarded – undo
89 90
 
90 91
 	/**
91 92
 	 * @param boolean if the user is a guest
93
+	 * @param boolean $value
92 94
 	 */
93 95
 	public function setIsGuest($value)
94 96
 	{
@@ -170,6 +172,7 @@  discard block
 block discarded – undo
170 172
 	 *
171 173
 	 * @param string variable name
172 174
 	 * @param mixed default value
175
+	 * @param string $key
173 176
 	 * @return mixed the value of the variable. If it doesn't exist, the provided default value will be returned
174 177
 	 * @see setState
175 178
 	 */
@@ -190,6 +193,7 @@  discard block
 block discarded – undo
190 193
 	 * @param string variable name
191 194
 	 * @param mixed variable value
192 195
 	 * @param mixed default value. If $value===$defaultValue, the variable will be removed from persistent storage.
196
+	 * @param string $key
193 197
 	 * @see getState
194 198
 	 */
195 199
 	protected function setState($key,$value,$defaultValue=null)
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function getName()
70 70
 	{
71
-		return $this->getState('Name','');
71
+		return $this->getState('Name', '');
72 72
 	}
73 73
 
74 74
 	/**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function setName($value)
78 78
 	{
79
-		$this->setState('Name',$value,'');
79
+		$this->setState('Name', $value, '');
80 80
 	}
81 81
 
82 82
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function getIsGuest()
86 86
 	{
87
-		return $this->getState('IsGuest',true);
87
+		return $this->getState('IsGuest', true);
88 88
 	}
89 89
 
90 90
 	/**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			$this->setName($this->_manager->getGuestName());
98 98
 			$this->setRoles(array());
99 99
 		}
100
-		$this->setState('IsGuest',$isGuest);
100
+		$this->setState('IsGuest', $isGuest);
101 101
 	}
102 102
 
103 103
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function getRoles()
107 107
 	{
108
-		return $this->getState('Roles',array());
108
+		return $this->getState('Roles', array());
109 109
 	}
110 110
 
111 111
 	/**
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
 	public function setRoles($value)
115 115
 	{
116 116
 		if(is_array($value))
117
-			$this->setState('Roles',$value,array());
117
+			$this->setState('Roles', $value, array());
118 118
 		else
119 119
 		{
120 120
 			$roles=array();
121
-			foreach(explode(',',$value) as $role)
121
+			foreach(explode(',', $value) as $role)
122 122
 			{
123 123
 				if(($role=trim($role))!=='')
124 124
 					$roles[]=$role;
125 125
 			}
126
-			$this->setState('Roles',$roles,array());
126
+			$this->setState('Roles', $roles, array());
127 127
 		}
128 128
 	}
129 129
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	public function isInRole($role)
135 135
 	{
136 136
 		foreach($this->getRoles() as $r)
137
-			if(strcasecmp($role,$r)===0)
137
+			if(strcasecmp($role, $r)===0)
138 138
 				return true;
139 139
 		return false;
140 140
 	}
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 	 * @return mixed the value of the variable. If it doesn't exist, the provided default value will be returned
174 174
 	 * @see setState
175 175
 	 */
176
-	protected function getState($key,$defaultValue=null)
176
+	protected function getState($key, $defaultValue=null)
177 177
 	{
178
-		return isset($this->_state[$key])?$this->_state[$key]:$defaultValue;
178
+		return isset($this->_state[$key]) ? $this->_state[$key] : $defaultValue;
179 179
 	}
180 180
 
181 181
 	/**
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param mixed default value. If $value===$defaultValue, the variable will be removed from persistent storage.
193 193
 	 * @see getState
194 194
 	 */
195
-	protected function setState($key,$value,$defaultValue=null)
195
+	protected function setState($key, $value, $defaultValue=null)
196 196
 	{
197 197
 		if($value===$defaultValue)
198 198
 			unset($this->_state[$key]);
Please login to merge, or discard this patch.
framework/Util/TSimpleDateFormatter.php 3 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -93,6 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 	/**
95 95
 	 * @param string formatting charset.
96
+	 * @param string $charset
96 97
 	 */
97 98
 	public function setCharset($charset)
98 99
 	{
@@ -313,6 +314,7 @@  discard block
 block discarded – undo
313 314
 
314 315
 	/**
315 316
 	 * Calculate the length of a string, may be consider iconv_strlen?
317
+	 * @param string $string
316 318
 	 */
317 319
 	private function length($string)
318 320
 	{
@@ -338,6 +340,9 @@  discard block
 block discarded – undo
338 340
 
339 341
 	/**
340 342
 	 * Returns true if char at position equals a particular char.
343
+	 * @param string $string
344
+	 * @param integer $pos
345
+	 * @param string $char
341 346
 	 */
342 347
 	private function charEqual($string, $pos, $char)
343 348
 	{
@@ -350,6 +355,10 @@  discard block
 block discarded – undo
350 355
 	 * @param int starting position
351 356
 	 * @param int minimum integer length
352 357
 	 * @param int maximum integer length
358
+	 * @param string $str
359
+	 * @param integer $i
360
+	 * @param integer|null $minlength
361
+	 * @param integer|null $maxlength
353 362
 	 * @return string integer portion of the string, null otherwise
354 363
 	 */
355 364
 	private function getInteger($str,$i,$minlength,$maxlength)
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -225,8 +225,7 @@  discard block
 block discarded – undo
225 225
 			$year = "{$date['year']}";
226 226
 			$month = $date['mon'];
227 227
 			$day = $date['mday'];
228
-		}
229
-		else
228
+		} else
230 229
 		{
231 230
 			$year = null;
232 231
 			$month = null;
@@ -262,8 +261,7 @@  discard block
 block discarded – undo
262 261
 						$year = $iYear + 2000;
263 262
 				}
264 263
 				$year = (int)$year;
265
-			}
266
-			elseif($token=='MM' || $token=='M')
264
+			} elseif($token=='MM' || $token=='M')
267 265
 			{
268 266
 				$month=$this->getInteger($value,$i_val,
269 267
 									$this->length($token),2);
@@ -273,8 +271,7 @@  discard block
 block discarded – undo
273 271
 					//throw new TInvalidDataValueException('Invalid month', $value);
274 272
 				$i_val += strlen($month);
275 273
 				$month = $iMonth;
276
-			}
277
-			elseif ($token=='dd' || $token=='d')
274
+			} elseif ($token=='dd' || $token=='d')
278 275
 			{
279 276
 				$day = $this->getInteger($value,$i_val,
280 277
 									$this->length($token), 2);
@@ -284,8 +281,7 @@  discard block
 block discarded – undo
284 281
 					//throw new TInvalidDataValueException('Invalid day', $value);
285 282
 				$i_val += strlen($day);
286 283
 				$day = $iDay;
287
-			}
288
-			else
284
+			} else
289 285
 			{
290 286
 				if($this->substring($value, $i_val, $this->length($token)) != $token)
291 287
 					return null;
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * Charset, default is 'UTF-8'
55 55
 	 * @var string
56 56
 	 */
57
-	private $charset = 'UTF-8';
57
+	private $charset='UTF-8';
58 58
 
59 59
 	/**
60 60
 	 * Constructor, create a new date time formatter.
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function setPattern($pattern)
82 82
 	{
83
-		$this->pattern = $pattern;
83
+		$this->pattern=$pattern;
84 84
 	}
85 85
 
86 86
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function setCharset($charset)
98 98
 	{
99
-		$this->charset = $charset;
99
+		$this->charset=$charset;
100 100
 	}
101 101
 
102 102
 	/**
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function format($value)
108 108
 	{
109
-		$date = $this->getDate($value);
110
-		$bits['yyyy'] = $date['year'];
111
-		$bits['yy'] = substr("{$date['year']}", -2);
109
+		$date=$this->getDate($value);
110
+		$bits['yyyy']=$date['year'];
111
+		$bits['yy']=substr("{$date['year']}", -2);
112 112
 
113
-		$bits['MM'] = str_pad("{$date['mon']}", 2, '0', STR_PAD_LEFT);
114
-		$bits['M'] = $date['mon'];
113
+		$bits['MM']=str_pad("{$date['mon']}", 2, '0', STR_PAD_LEFT);
114
+		$bits['M']=$date['mon'];
115 115
 
116
-		$bits['dd'] = str_pad("{$date['mday']}", 2, '0', STR_PAD_LEFT);
117
-		$bits['d'] = $date['mday'];
116
+		$bits['dd']=str_pad("{$date['mday']}", 2, '0', STR_PAD_LEFT);
117
+		$bits['d']=$date['mday'];
118 118
 
119
-		$pattern = preg_replace('/M{3,4}/', 'MM', $this->pattern);
119
+		$pattern=preg_replace('/M{3,4}/', 'MM', $this->pattern);
120 120
 		return str_replace(array_keys($bits), $bits, $pattern);
121 121
 	}
122 122
 
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 
154 154
 	public function getDayMonthYearOrdering()
155 155
 	{
156
-		$ordering = array();
157
-		if(is_int($day= strpos($this->pattern, 'd')))
158
-			$ordering['day'] = $day;
159
-		if(is_int($month= strpos($this->pattern, 'M')))
160
-			$ordering['month'] = $month;
161
-		if(is_int($year= strpos($this->pattern, 'yy')))
162
-			$ordering['year'] = $year;
156
+		$ordering=array();
157
+		if(is_int($day=strpos($this->pattern, 'd')))
158
+			$ordering['day']=$day;
159
+		if(is_int($month=strpos($this->pattern, 'M')))
160
+			$ordering['month']=$month;
161
+		if(is_int($year=strpos($this->pattern, 'yy')))
162
+			$ordering['year']=$year;
163 163
 		asort($ordering);
164 164
 		return array_keys($ordering);
165 165
 	}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	private function getDate($value)
173 173
 	{
174
-		$s = Prado::createComponent('System.Util.TDateTimeStamp');
174
+		$s=Prado::createComponent('System.Util.TDateTimeStamp');
175 175
 		if(is_numeric($value))
176 176
 			return $s->getDate($value);
177 177
 		else
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function isValidDate($value)
185 185
 	{
186
-		if($value === null) {
186
+		if($value===null) {
187 187
 			return false;
188 188
 		} else {
189
-			return $this->parse($value, false) !== null;
189
+			return $this->parse($value, false)!==null;
190 190
 		}
191 191
 	}
192 192
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * @return int date time stamp
197 197
 	 * @throws TInvalidDataValueException if date string is malformed.
198 198
 	 */
199
-	public function parse($value,$defaultToCurrentTime=true)
199
+	public function parse($value, $defaultToCurrentTime=true)
200 200
 	{
201 201
 		if(is_int($value) || is_float($value))
202 202
 			return $value;
@@ -205,108 +205,108 @@  discard block
 block discarded – undo
205 205
 
206 206
 		if(empty($this->pattern)) return time();
207 207
 
208
-		$date = time();
208
+		$date=time();
209 209
 
210 210
 		if($this->length(trim($value)) < 1)
211 211
 			return $defaultToCurrentTime ? $date : null;
212 212
 
213
-		$pattern = $this->pattern;
213
+		$pattern=$this->pattern;
214 214
 
215
-		$i_val = 0;
216
-		$i_format = 0;
217
-		$pattern_length = $this->length($pattern);
218
-		$c = '';
215
+		$i_val=0;
216
+		$i_format=0;
217
+		$pattern_length=$this->length($pattern);
218
+		$c='';
219 219
 		$token='';
220 220
 		$x=null; $y=null;
221 221
 
222 222
 
223 223
 		if($defaultToCurrentTime)
224 224
 		{
225
-			$year = "{$date['year']}";
226
-			$month = $date['mon'];
227
-			$day = $date['mday'];
225
+			$year="{$date['year']}";
226
+			$month=$date['mon'];
227
+			$day=$date['mday'];
228 228
 		}
229 229
 		else
230 230
 		{
231
-			$year = null;
232
-			$month = null;
233
-			$day = null;
231
+			$year=null;
232
+			$month=null;
233
+			$day=null;
234 234
 		}
235 235
 
236
-		while ($i_format < $pattern_length)
236
+		while($i_format < $pattern_length)
237 237
 		{
238
-			$c = $this->charAt($pattern,$i_format);
238
+			$c=$this->charAt($pattern, $i_format);
239 239
 			$token='';
240
-			while ($this->charEqual($pattern, $i_format, $c)
240
+			while($this->charEqual($pattern, $i_format, $c)
241 241
 						&& ($i_format < $pattern_length))
242 242
 			{
243
-				$token .= $this->charAt($pattern, $i_format++);
243
+				$token.=$this->charAt($pattern, $i_format++);
244 244
 			}
245 245
 
246
-			if ($token=='yyyy' || $token=='yy' || $token=='y')
246
+			if($token=='yyyy' || $token=='yy' || $token=='y')
247 247
 			{
248
-				if ($token=='yyyy') { $x=4;$y=4; }
249
-				if ($token=='yy')   { $x=2;$y=2; }
250
-				if ($token=='y')    { $x=2;$y=4; }
251
-				$year = $this->getInteger($value,$i_val,$x,$y);
252
-				if($year === null)
248
+				if($token=='yyyy') { $x=4; $y=4; }
249
+				if($token=='yy') { $x=2; $y=2; }
250
+				if($token=='y') { $x=2; $y=4; }
251
+				$year=$this->getInteger($value, $i_val, $x, $y);
252
+				if($year===null)
253 253
 					return null;
254 254
 					//throw new TInvalidDataValueException('Invalid year', $value);
255
-				$i_val += strlen($year);
256
-				if(strlen($year) == 2)
255
+				$i_val+=strlen($year);
256
+				if(strlen($year)==2)
257 257
 				{
258
-					$iYear = (int)$year;
258
+					$iYear=(int) $year;
259 259
 					if($iYear > 70)
260
-						$year = $iYear + 1900;
260
+						$year=$iYear + 1900;
261 261
 					else
262
-						$year = $iYear + 2000;
262
+						$year=$iYear + 2000;
263 263
 				}
264
-				$year = (int)$year;
264
+				$year=(int) $year;
265 265
 			}
266 266
 			elseif($token=='MM' || $token=='M')
267 267
 			{
268
-				$month=$this->getInteger($value,$i_val,
269
-									$this->length($token),2);
270
-				$iMonth = (int)$month;
271
-				if($month === null || $iMonth < 1 || $iMonth > 12 )
268
+				$month=$this->getInteger($value, $i_val,
269
+									$this->length($token), 2);
270
+				$iMonth=(int) $month;
271
+				if($month===null || $iMonth < 1 || $iMonth > 12)
272 272
 					return null;
273 273
 					//throw new TInvalidDataValueException('Invalid month', $value);
274
-				$i_val += strlen($month);
275
-				$month = $iMonth;
274
+				$i_val+=strlen($month);
275
+				$month=$iMonth;
276 276
 			}
277
-			elseif ($token=='dd' || $token=='d')
277
+			elseif($token=='dd' || $token=='d')
278 278
 			{
279
-				$day = $this->getInteger($value,$i_val,
279
+				$day=$this->getInteger($value, $i_val,
280 280
 									$this->length($token), 2);
281
-				$iDay = (int)$day;
282
-				if($day === null || $iDay < 1 || $iDay >31)
281
+				$iDay=(int) $day;
282
+				if($day===null || $iDay < 1 || $iDay > 31)
283 283
 					return null;
284 284
 					//throw new TInvalidDataValueException('Invalid day', $value);
285
-				$i_val += strlen($day);
286
-				$day = $iDay;
285
+				$i_val+=strlen($day);
286
+				$day=$iDay;
287 287
 			}
288 288
 			else
289 289
 			{
290
-				if($this->substring($value, $i_val, $this->length($token)) != $token)
290
+				if($this->substring($value, $i_val, $this->length($token))!=$token)
291 291
 					return null;
292 292
 					//throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value);
293 293
 				else
294
-					$i_val += $this->length($token);
294
+					$i_val+=$this->length($token);
295 295
 			}
296 296
 		}
297
-		if ($i_val != $this->length($value))
297
+		if($i_val!=$this->length($value))
298 298
 			return null;
299 299
 			//throw new TInvalidDataValueException("Pattern '{$this->pattern}' mismatch", $value);
300
-		if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null))
300
+		if(!$defaultToCurrentTime && ($month===null || $day===null || $year===null))
301 301
 			return null;
302 302
 		else
303 303
 		{
304 304
 			if(empty($year)) {
305
-				$year = date('Y');
305
+				$year=date('Y');
306 306
 			}
307
-			$day = (int)$day <= 0 ? 1 : (int)$day;
308
-			$month = (int)$month <= 0 ? 1 : (int)$month;
309
-			$s = Prado::createComponent('System.Util.TDateTimeStamp');
307
+			$day=(int) $day <= 0 ? 1 : (int) $day;
308
+			$month=(int) $month <= 0 ? 1 : (int) $month;
309
+			$s=Prado::createComponent('System.Util.TDateTimeStamp');
310 310
 			return $s->getTimeStamp(0, 0, 0, $month, $day, $year);
311 311
 		}
312 312
 	}
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 */
342 342
 	private function charEqual($string, $pos, $char)
343 343
 	{
344
-		return $this->charAt($string, $pos) == $char;
344
+		return $this->charAt($string, $pos)==$char;
345 345
 	}
346 346
 
347 347
 	/**
@@ -352,15 +352,15 @@  discard block
 block discarded – undo
352 352
 	 * @param int maximum integer length
353 353
 	 * @return string integer portion of the string, null otherwise
354 354
 	 */
355
-	private function getInteger($str,$i,$minlength,$maxlength)
355
+	private function getInteger($str, $i, $minlength, $maxlength)
356 356
 	{
357 357
 		//match for digits backwards
358
-		for ($x = $maxlength; $x >= $minlength; $x--)
358
+		for($x=$maxlength; $x >= $minlength; $x--)
359 359
 		{
360
-			$token= $this->substring($str, $i,$x);
361
-			if ($this->length($token) < $minlength)
360
+			$token=$this->substring($str, $i, $x);
361
+			if($this->length($token) < $minlength)
362 362
 				return null;
363
-			if (preg_match('/^\d+$/', $token))
363
+			if(preg_match('/^\d+$/', $token))
364 364
 				return $token;
365 365
 		}
366 366
 		return null;
Please login to merge, or discard this patch.
framework/Web/TAssetManager.php 3 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -215,6 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * This method does not perform any publishing. It merely tells you
216 216
 	 * if the file path is published, what the URL will be to access it.
217 217
 	 * @param string directory or file path being published
218
+	 * @param string $path
218 219
 	 * @return string the published URL for the file path
219 220
 	 */
220 221
 	public function getPublishedUrl($path)
@@ -230,6 +231,7 @@  discard block
 block discarded – undo
230 231
 	 * Generate a CRC32 hash for the directory path. Collisions are higher
231 232
 	 * than MD5 but generates a much smaller hash string.
232 233
 	 * @param string string to be hashed.
234
+	 * @param string $dir
233 235
 	 * @return string hashed string.
234 236
 	 */
235 237
 	protected function hash($dir)
@@ -243,6 +245,8 @@  discard block
 block discarded – undo
243 245
 	 * or has an older file modification time.
244 246
 	 * @param string source file path
245 247
 	 * @param string destination directory (if not exists, it will be created)
248
+	 * @param string $src
249
+	 * @param string $dst
246 250
 	 */
247 251
 	protected function copyFile($src,$dst)
248 252
 	{
@@ -265,6 +269,8 @@  discard block
 block discarded – undo
265 269
 	 * File modification time is used to ensure the copied files are latest.
266 270
 	 * @param string the source directory
267 271
 	 * @param string the destination directory
272
+	 * @param string $src
273
+	 * @param string $dst
268 274
 	 * @todo a generic solution to ignore certain directories and files
269 275
 	 */
270 276
 	public function copyDirectory($src,$dst)
@@ -306,6 +312,8 @@  discard block
 block discarded – undo
306 312
 	 * @param string tar filename
307 313
 	 * @param string MD5 checksum for the corresponding tar file.
308 314
 	 * @param boolean Wether or not to check the time stamp of the file for publishing. Defaults to false.
315
+	 * @param string $tarfile
316
+	 * @param string $md5sum
309 317
 	 * @return string URL path to the directory where the tar file was extracted.
310 318
 	 */
311 319
 	public function publishTarFile($tarfile, $md5sum, $checkTimestamp=false)
@@ -336,6 +344,7 @@  discard block
 block discarded – undo
336 344
 	 * N.B Tar file must not be compressed.
337 345
 	 * @param string tar file
338 346
 	 * @param string path where the contents of tar file are to be extracted
347
+	 * @param string $destination
339 348
 	 * @return boolean true if extract successful, false otherwise.
340 349
 	 */
341 350
 	protected function deployTarFile($path,$destination)
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -163,8 +163,7 @@  discard block
 block discarded – undo
163 163
 			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
164 164
 				$this->copyFile($fullpath,$dst);
165 165
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName;
166
-		}
167
-		else
166
+		} else
168 167
 		{
169 168
 			$dir=$this->hash($fullpath);
170 169
 			if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
@@ -287,8 +286,7 @@  discard block
 block discarded – undo
287 286
 						@copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
288 287
 						@chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD);
289 288
 					}
290
-				}
291
-				else
289
+				} else
292 290
 					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
293 291
 			}
294 292
 			closedir($folder);
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 		if($this->_basePath===null)
83 83
 			$this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
84 84
 		if(!is_writable($this->_basePath) || !is_dir($this->_basePath))
85
-			throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath);
85
+			throw new TConfigurationException('assetmanager_basepath_invalid', $this->_basePath);
86 86
 		if($this->_baseUrl===null)
87
-			$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()),'/\\').'/'.self::DEFAULT_BASEPATH;
87
+			$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()), '/\\').'/'.self::DEFAULT_BASEPATH;
88 88
 		$application->setAssetManager($this);
89 89
 		$this->_initialized=true;
90 90
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		{
112 112
 			$this->_basePath=Prado::getPathOfNamespace($value);
113 113
 			if($this->_basePath===null || !is_dir($this->_basePath) || !is_writable($this->_basePath))
114
-				throw new TInvalidDataValueException('assetmanager_basepath_invalid',$value);
114
+				throw new TInvalidDataValueException('assetmanager_basepath_invalid', $value);
115 115
 		}
116 116
 	}
117 117
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		if($this->_initialized)
133 133
 			throw new TInvalidOperationException('assetmanager_baseurl_unchangeable');
134 134
 		else
135
-			$this->_baseUrl=rtrim($value,'/');
135
+			$this->_baseUrl=rtrim($value, '/');
136 136
 	}
137 137
 
138 138
 	/**
@@ -149,19 +149,19 @@  discard block
 block discarded – undo
149 149
 	 * @throws TInvalidDataValueException if the file path to be published is
150 150
 	 * invalid
151 151
 	 */
152
-	public function publishFilePath($path,$checkTimestamp=false)
152
+	public function publishFilePath($path, $checkTimestamp=false)
153 153
 	{
154 154
 		if(isset($this->_published[$path]))
155 155
 			return $this->_published[$path];
156 156
 		else if(empty($path) || ($fullpath=realpath($path))===false)
157
-			throw new TInvalidDataValueException('assetmanager_filepath_invalid',$path);
157
+			throw new TInvalidDataValueException('assetmanager_filepath_invalid', $path);
158 158
 		else if(is_file($fullpath))
159 159
 		{
160 160
 			$dir=$this->hash(dirname($fullpath));
161 161
 			$fileName=basename($fullpath);
162 162
 			$dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir;
163 163
 			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
164
-				$this->copyFile($fullpath,$dst);
164
+				$this->copyFile($fullpath, $dst);
165 165
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName;
166 166
 		}
167 167
 		else
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 			$dir=$this->hash($fullpath);
170 170
 			if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
171 171
 			{
172
-				Prado::trace("Publishing directory $fullpath",'System.Web.UI.TAssetManager');
173
-				$this->copyDirectory($fullpath,$this->_basePath.DIRECTORY_SEPARATOR.$dir);
172
+				Prado::trace("Publishing directory $fullpath", 'System.Web.UI.TAssetManager');
173
+				$this->copyDirectory($fullpath, $this->_basePath.DIRECTORY_SEPARATOR.$dir);
174 174
 			}
175 175
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir;
176 176
 		}
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	protected function setPublished($values=array())
193 193
 	{
194
-		$this->_published = $values;
194
+		$this->_published=$values;
195 195
 	}
196 196
 
197 197
 	/**
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 */
235 235
 	protected function hash($dir)
236 236
 	{
237
-		return sprintf('%x',crc32($dir.Prado::getVersion()));
237
+		return sprintf('%x', crc32($dir.Prado::getVersion()));
238 238
 	}
239 239
 
240 240
 	/**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 * @param string source file path
245 245
 	 * @param string destination directory (if not exists, it will be created)
246 246
 	 */
247
-	protected function copyFile($src,$dst)
247
+	protected function copyFile($src, $dst)
248 248
 	{
249 249
 		if(!is_dir($dst))
250 250
 		{
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 			@chmod($dst, PRADO_CHMOD);
253 253
 		}
254 254
 		$dstFile=$dst.DIRECTORY_SEPARATOR.basename($src);
255
-		if(@filemtime($dstFile)<@filemtime($src))
255
+		if(@filemtime($dstFile) < @filemtime($src))
256 256
 		{
257
-			Prado::trace("Publishing file $src to $dstFile",'System.Web.TAssetManager');
258
-			@copy($src,$dstFile);
257
+			Prado::trace("Publishing file $src to $dstFile", 'System.Web.TAssetManager');
258
+			@copy($src, $dstFile);
259 259
 		}
260 260
 	}
261 261
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 * @param string the destination directory
268 268
 	 * @todo a generic solution to ignore certain directories and files
269 269
 	 */
270
-	public function copyDirectory($src,$dst)
270
+	public function copyDirectory($src, $dst)
271 271
 	{
272 272
 		if(!is_dir($dst))
273 273
 		{
@@ -282,14 +282,14 @@  discard block
 block discarded – undo
282 282
 					continue;
283 283
 				else if(is_file($src.DIRECTORY_SEPARATOR.$file))
284 284
 				{
285
-					if(@filemtime($dst.DIRECTORY_SEPARATOR.$file)<@filemtime($src.DIRECTORY_SEPARATOR.$file))
285
+					if(@filemtime($dst.DIRECTORY_SEPARATOR.$file) < @filemtime($src.DIRECTORY_SEPARATOR.$file))
286 286
 					{
287
-						@copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
287
+						@copy($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file);
288 288
 						@chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD);
289 289
 					}
290 290
 				}
291 291
 				else
292
-					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
292
+					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file);
293 293
 			}
294 294
 			closedir($folder);
295 295
 		} else {
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		if(isset($this->_published[$md5sum]))
314 314
 			return $this->_published[$md5sum];
315 315
 		else if(($fullpath=realpath($md5sum))===false || !is_file($fullpath))
316
-			throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid',$md5sum);
316
+			throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid', $md5sum);
317 317
 		else
318 318
 		{
319 319
 			$dir=$this->hash(dirname($fullpath));
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 			$dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir;
322 322
 			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
323 323
 			{
324
-				if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName)<@filemtime($fullpath))
324
+				if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName) < @filemtime($fullpath))
325 325
 				{
326
-					$this->copyFile($fullpath,$dst);
327
-					$this->deployTarFile($tarfile,$dst);
326
+					$this->copyFile($fullpath, $dst);
327
+					$this->deployTarFile($tarfile, $dst);
328 328
 				}
329 329
 			}
330 330
 			return $this->_published[$md5sum]=$this->_baseUrl.'/'.$dir;
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
 	 * @param string path where the contents of tar file are to be extracted
339 339
 	 * @return boolean true if extract successful, false otherwise.
340 340
 	 */
341
-	protected function deployTarFile($path,$destination)
341
+	protected function deployTarFile($path, $destination)
342 342
 	{
343 343
 		if(($fullpath=realpath($path))===false || !is_file($fullpath))
344
-			throw new TIOException('assetmanager_tarfile_invalid',$path);
344
+			throw new TIOException('assetmanager_tarfile_invalid', $path);
345 345
 		else
346 346
 		{
347 347
 			Prado::using('System.IO.TTarFileExtractor');
348
-			$tar = new TTarFileExtractor($fullpath);
348
+			$tar=new TTarFileExtractor($fullpath);
349 349
 			return $tar->extract($destination);
350 350
 		}
351 351
 	}
Please login to merge, or discard this patch.
framework/Data/DataGateway/TTableGateway.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -416,8 +416,7 @@
 block discarded – undo
416 416
 		{
417 417
 			$useArgs = !is_array($parameters) && is_array($args);
418 418
 			return new TSqlCriteria($criteria,$useArgs ? $args : $parameters);
419
-		}
420
-		else if($criteria instanceof TSqlCriteria)
419
+		} else if($criteria instanceof TSqlCriteria)
421 420
 			return $criteria;
422 421
 		else
423 422
 			throw new TDbException('dbtablegateway_invalid_criteria');
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param string|TDbTableInfo table or view name or table information.
88 88
 	 * @param TDbConnection database connection.
89 89
 	 */
90
-	public function __construct($table,$connection)
90
+	public function __construct($table, $connection)
91 91
 	{
92 92
 		$this->_connection=$connection;
93 93
 		if(is_string($table))
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function setTableInfo($tableInfo)
105 105
 	{
106
-		$builder = $tableInfo->createCommandBuilder($this->getDbConnection());
106
+		$builder=$tableInfo->createCommandBuilder($this->getDbConnection());
107 107
 		$this->initCommandBuilder($builder);
108 108
 	}
109 109
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	protected function setTableName($tableName)
115 115
 	{
116 116
 		Prado::using('System.Data.Common.TDbMetaData');
117
-		$meta = TDbMetaData::getInstance($this->getDbConnection());
117
+		$meta=TDbMetaData::getInstance($this->getDbConnection());
118 118
 		$this->initCommandBuilder($meta->createCommandBuilder($tableName));
119 119
 	}
120 120
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	protected function initCommandBuilder($builder)
135 135
 	{
136
-		$this->_command = new TDataGatewayCommand($builder);
137
-		$this->_command->OnCreateCommand[] = array($this, 'onCreateCommand');
138
-		$this->_command->OnExecuteCommand[] = array($this, 'onExecuteCommand');
136
+		$this->_command=new TDataGatewayCommand($builder);
137
+		$this->_command->OnCreateCommand[]=array($this, 'onCreateCommand');
138
+		$this->_command->OnExecuteCommand[]=array($this, 'onExecuteCommand');
139 139
 	}
140 140
 
141 141
 	/**
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function findBySql($sql, $parameters=array())
191 191
 	{
192
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
193
-		$criteria = $this->getCriteria($sql,$parameters, $args);
192
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
193
+		$criteria=$this->getCriteria($sql, $parameters, $args);
194 194
 		return $this->getCommand()->findBySql($criteria);
195 195
 	}
196 196
 
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function findAllBySql($sql, $parameters=array())
204 204
 	{
205
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
206
-		$criteria = $this->getCriteria($sql,$parameters, $args);
205
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
206
+		$criteria=$this->getCriteria($sql, $parameters, $args);
207 207
 		return $this->getCommand()->findAllBySql($criteria);
208 208
 	}
209 209
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function find($criteria, $parameters=array())
228 228
 	{
229
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
230
-		$criteria = $this->getCriteria($criteria,$parameters, $args);
229
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
230
+		$criteria=$this->getCriteria($criteria, $parameters, $args);
231 231
 		return $this->getCommand()->find($criteria);
232 232
 	}
233 233
 
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function findAll($criteria=null, $parameters=array())
241 241
 	{
242
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
242
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
243 243
 		if($criteria!==null)
244
-			$criteria = $this->getCriteria($criteria,$parameters, $args);
244
+			$criteria=$this->getCriteria($criteria, $parameters, $args);
245 245
 		return $this->getCommand()->findAll($criteria);
246 246
 	}
247 247
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	public function findByPk($keys)
261 261
 	{
262 262
 		if(func_num_args() > 1)
263
-			$keys = func_get_args();
263
+			$keys=func_get_args();
264 264
 		return $this->getCommand()->findByPk($keys);
265 265
 	}
266 266
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	public function findAllByPks($keys)
285 285
 	{
286 286
 		if(func_num_args() > 1)
287
-			$keys = func_get_args();
287
+			$keys=func_get_args();
288 288
 		return $this->getCommand()->findAllByPk($keys);
289 289
 	}
290 290
 
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function deleteAll($criteria, $parameters=array())
303 303
 	{
304
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
305
-		$criteria = $this->getCriteria($criteria,$parameters, $args);
304
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
305
+		$criteria=$this->getCriteria($criteria, $parameters, $args);
306 306
 		return $this->getCommand()->delete($criteria);
307 307
 	}
308 308
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	public function deleteByPk($keys)
333 333
 	{
334 334
 		if(func_num_args() > 1)
335
-			$keys = func_get_args();
335
+			$keys=func_get_args();
336 336
 		return $this->getCommand()->deleteByPk($keys);
337 337
 	}
338 338
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	public function deleteAllByPks($keys)
343 343
 	{
344 344
 		if(func_num_args() > 1)
345
-			$keys = func_get_args();
345
+			$keys=func_get_args();
346 346
 		return $this->deleteByPk($keys);
347 347
 	}
348 348
 
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
 	 * @param mixed parameter values.
353 353
 	 * @return int number of records.
354 354
 	 */
355
-	public function count($criteria=null,$parameters=array())
355
+	public function count($criteria=null, $parameters=array())
356 356
 	{
357
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
357
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
358 358
 		if($criteria!==null)
359
-			$criteria = $this->getCriteria($criteria,$parameters, $args);
359
+			$criteria=$this->getCriteria($criteria, $parameters, $args);
360 360
 		return $this->getCommand()->count($criteria);
361 361
 	}
362 362
 
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public function update($data, $criteria, $parameters=array())
378 378
 	{
379
-		$args = func_num_args() > 2 ? array_slice(func_get_args(),2) : null;
380
-		$criteria = $this->getCriteria($criteria,$parameters, $args);
379
+		$args=func_num_args() > 2 ? array_slice(func_get_args(), 2) : null;
380
+		$criteria=$this->getCriteria($criteria, $parameters, $args);
381 381
 		return $this->getCommand()->update($data, $criteria);
382 382
 	}
383 383
 
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 	{
415 415
 		if(is_string($criteria))
416 416
 		{
417
-			$useArgs = !is_array($parameters) && is_array($args);
418
-			return new TSqlCriteria($criteria,$useArgs ? $args : $parameters);
417
+			$useArgs=!is_array($parameters) && is_array($args);
418
+			return new TSqlCriteria($criteria, $useArgs ? $args : $parameters);
419 419
 		}
420 420
 		else if($criteria instanceof TSqlCriteria)
421 421
 			return $criteria;
@@ -452,21 +452,21 @@  discard block
 block discarded – undo
452 452
 	 * @return mixed single record if method name starts with "findBy", 0 or more records
453 453
 	 * if method name starts with "findAllBy"
454 454
 	 */
455
-	public function __call($method,$args)
455
+	public function __call($method, $args)
456 456
 	{
457
-		$delete =false;
458
-		if($findOne = substr(strtolower($method),0,6)==='findby')
459
-			$condition = $method[6]==='_' ? substr($method,7) : substr($method,6);
460
-		else if(substr(strtolower($method),0,9)==='findallby')
461
-			$condition = $method[9]==='_' ? substr($method,10) : substr($method,9);
462
-		else if($delete = substr(strtolower($method),0,8)==='deleteby')
463
-			$condition = $method[8]==='_' ? substr($method,9) : substr($method,8);
464
-		else if($delete = substr(strtolower($method),0,11)==='deleteallby')
465
-			$condition = $method[11]==='_' ? substr($method,12) : substr($method,11);
457
+		$delete=false;
458
+		if($findOne=substr(strtolower($method), 0, 6)==='findby')
459
+			$condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6);
460
+		else if(substr(strtolower($method), 0, 9)==='findallby')
461
+			$condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9);
462
+		else if($delete=substr(strtolower($method), 0, 8)==='deleteby')
463
+			$condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8);
464
+		else if($delete=substr(strtolower($method), 0, 11)==='deleteallby')
465
+			$condition=$method[11]==='_' ? substr($method, 12) : substr($method, 11);
466 466
 		else
467 467
 			return null;
468 468
 
469
-		$criteria = $this->getCommand()->createCriteriaFromString($method, $condition, $args);
469
+		$criteria=$this->getCommand()->createCriteriaFromString($method, $condition, $args);
470 470
 		if($delete)
471 471
 			return $this->deleteAll($criteria);
472 472
 		else
Please login to merge, or discard this patch.
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -103,6 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 	/**
105 105
 	 * @param TDbTableInfo table or view information.
106
+	 * @param TDbTableInfo $tableInfo
106 107
 	 */
107 108
 	protected function setTableInfo($tableInfo)
108 109
 	{
@@ -113,6 +114,7 @@  discard block
 block discarded – undo
113 114
 	/**
114 115
 	 * Sets up the command builder for the given table.
115 116
 	 * @param string table or view name.
117
+	 * @param string $tableName
116 118
 	 */
117 119
 	protected function setTableName($tableName)
118 120
 	{
@@ -224,6 +226,7 @@  discard block
 block discarded – undo
224 226
 	 *
225 227
 	 * @param string|TSqlCriteria SQL condition or criteria object.
226 228
 	 * @param mixed parameter values.
229
+	 * @param TSqlCriteria $criteria
227 230
 	 * @return array matching record object.
228 231
 	 */
229 232
 	public function find($criteria, $parameters=array())
@@ -237,6 +240,7 @@  discard block
 block discarded – undo
237 240
 	 * Accepts same parameters as find(), but returns TDbDataReader instead.
238 241
 	 * @param string|TSqlCriteria SQL condition or criteria object.
239 242
 	 * @param mixed parameter values.
243
+	 * @param TSqlCriteria $criteria
240 244
 	 * @return TDbDataReader matching records.
241 245
 	 */
242 246
 	public function findAll($criteria=null, $parameters=array())
@@ -299,6 +303,7 @@  discard block
 block discarded – undo
299 303
 	 * </code>
300 304
 	 * @param string delete condition.
301 305
 	 * @param array condition parameters.
306
+	 * @param TSqlCriteria $criteria
302 307
 	 * @return integer number of records deleted.
303 308
 	 */
304 309
 	public function deleteAll($criteria, $parameters=array())
Please login to merge, or discard this patch.