Completed
Push — php-cs-fixer ( b6f93e...b9836a )
by Fabio
07:15
created
framework/Caching/TDirectoryCacheDependency.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class TDirectoryCacheDependency extends TCacheDependency
37 37
 {
38
-	private $_recursiveCheck = true;
39
-	private $_recursiveLevel = -1;
38
+	private $_recursiveCheck=true;
39
+	private $_recursiveLevel=-1;
40 40
 	private $_timestamps;
41 41
 	private $_directory;
42 42
 
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function setDirectory($directory)
65 65
 	{
66
-		if(($path = realpath($directory)) === false || !is_dir($path))
66
+		if(($path=realpath($directory))===false || !is_dir($path))
67 67
 			throw new TInvalidDataValueException('directorycachedependency_directory_invalid', $directory);
68
-		$this->_directory = $path;
69
-		$this->_timestamps = $this->generateTimestamps($path);
68
+		$this->_directory=$path;
69
+		$this->_timestamps=$this->generateTimestamps($path);
70 70
 	}
71 71
 
72 72
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function setRecursiveCheck($value)
85 85
 	{
86
-		$this->_recursiveCheck = TPropertyValue::ensureBoolean($value);
86
+		$this->_recursiveCheck=TPropertyValue::ensureBoolean($value);
87 87
 	}
88 88
 
89 89
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function setRecursiveLevel($value)
107 107
 	{
108
-		$this->_recursiveLevel = TPropertyValue::ensureInteger($value);
108
+		$this->_recursiveLevel=TPropertyValue::ensureInteger($value);
109 109
 	}
110 110
 
111 111
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function getHasChanged()
117 117
 	{
118
-		return $this->generateTimestamps($this->_directory) != $this->_timestamps;
118
+		return $this->generateTimestamps($this->_directory)!=$this->_timestamps;
119 119
 	}
120 120
 
121 121
 	/**
@@ -152,23 +152,23 @@  discard block
 block discarded – undo
152 152
 	 * @param int level of the recursion
153 153
 	 * @return array list of file modification time indexed by the file path
154 154
 	 */
155
-	protected function generateTimestamps($directory, $level = 0)
155
+	protected function generateTimestamps($directory, $level=0)
156 156
 	{
157
-		if(($dir = opendir($directory)) === false)
157
+		if(($dir=opendir($directory))===false)
158 158
 			throw new TIOException('directorycachedependency_directory_invalid', $directory);
159
-		$timestamps = [];
160
-		while(($file = readdir($dir)) !== false)
159
+		$timestamps=[];
160
+		while(($file=readdir($dir))!==false)
161 161
 		{
162
-			$path = $directory . DIRECTORY_SEPARATOR . $file;
163
-			if($file === '.' || $file === '..')
162
+			$path=$directory.DIRECTORY_SEPARATOR.$file;
163
+			if($file==='.' || $file==='..')
164 164
 				continue;
165 165
 			elseif(is_dir($path))
166 166
 			{
167 167
 				if(($this->_recursiveLevel < 0 || $level < $this->_recursiveLevel) && $this->validateDirectory($path))
168
-					$timestamps = array_merge($this->generateTimestamps($path, $level + 1));
168
+					$timestamps=array_merge($this->generateTimestamps($path, $level + 1));
169 169
 			}
170 170
 			elseif($this->validateFile($path))
171
-				$timestamps[$path] = filemtime($path);
171
+				$timestamps[$path]=filemtime($path);
172 172
 		}
173 173
 		closedir($dir);
174 174
 		return $timestamps;
Please login to merge, or discard this patch.
framework/Caching/TCache.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 abstract class TCache extends \Prado\TModule implements ICache, \ArrayAccess
52 52
 {
53 53
 	private $_prefix;
54
-	private $_primary = true;
54
+	private $_primary=true;
55 55
 
56 56
 	/**
57 57
 	 * Initializes the cache module.
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function init($config)
63 63
 	{
64
-		if($this->_prefix === null)
65
-			$this->_prefix = $this->getApplication()->getUniqueID();
64
+		if($this->_prefix===null)
65
+			$this->_prefix=$this->getApplication()->getUniqueID();
66 66
 		if($this->_primary)
67 67
 		{
68
-			if($this->getApplication()->getCache() === null)
68
+			if($this->getApplication()->getCache()===null)
69 69
 				$this->getApplication()->setCache($this);
70 70
 			else
71 71
 				throw new TConfigurationException('cache_primary_duplicated', get_class($this));
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function setPrimaryCache($value)
90 90
 	{
91
-		$this->_primary = TPropertyValue::ensureBoolean($value);
91
+		$this->_primary=TPropertyValue::ensureBoolean($value);
92 92
 	}
93 93
 
94 94
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function setKeyPrefix($value)
107 107
 	{
108
-		$this->_prefix = $value;
108
+		$this->_prefix=$value;
109 109
 	}
110 110
 
111 111
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	protected function generateUniqueKey($key)
116 116
 	{
117
-		return md5($this->_prefix . $key);
117
+		return md5($this->_prefix.$key);
118 118
 	}
119 119
 
120 120
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function get($id)
126 126
 	{
127
-		if(($data = $this->getValue($this->generateUniqueKey($id))) !== false)
127
+		if(($data=$this->getValue($this->generateUniqueKey($id)))!==false)
128 128
 		{
129 129
 			if(!is_array($data))
130 130
 				return false;
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labeled invalid.
147 147
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
148 148
 	 */
149
-	public function set($id, $value, $expire = 0, $dependency = null)
149
+	public function set($id, $value, $expire=0, $dependency=null)
150 150
 	{
151
-		if(empty($value) && $expire === 0)
151
+		if(empty($value) && $expire===0)
152 152
 			$this->delete($id);
153 153
 		else
154 154
 		{
155
-			$data = [$value,$dependency];
155
+			$data=[$value, $dependency];
156 156
 			return $this->setValue($this->generateUniqueKey($id), $data, $expire);
157 157
 		}
158 158
 	}
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labeled invalid.
167 167
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
168 168
 	 */
169
-	public function add($id, $value, $expire = 0, $dependency = null)
169
+	public function add($id, $value, $expire=0, $dependency=null)
170 170
 	{
171
-		if(empty($value) && $expire === 0)
171
+		if(empty($value) && $expire===0)
172 172
 			return false;
173
-		$data = [$value,$dependency];
173
+		$data=[$value, $dependency];
174 174
 		return $this->addValue($this->generateUniqueKey($id), $data, $expire);
175 175
 	}
176 176
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function offsetExists($id)
252 252
 	{
253
-		return $this->get($id) !== false;
253
+		return $this->get($id)!==false;
254 254
 	}
255 255
 
256 256
 	/**
Please login to merge, or discard this patch.
framework/TService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * @var boolean whether the service is enabled
32 32
 	 */
33
-	private $_enabled = true;
33
+	private $_enabled=true;
34 34
 
35 35
 	/**
36 36
 	 * Initializes the service and attaches {@link run} to the RunService event of application.
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function setID($value)
56 56
 	{
57
-		$this->_id = $value;
57
+		$this->_id=$value;
58 58
 	}
59 59
 
60 60
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function setEnabled($value)
72 72
 	{
73
-		$this->_enabled = TPropertyValue::ensureBoolean($value);
73
+		$this->_enabled=TPropertyValue::ensureBoolean($value);
74 74
 	}
75 75
 
76 76
 	/**
Please login to merge, or discard this patch.
framework/PradoBase.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  */
38 38
 if(!defined('PRADO_VENDORDIR'))
39 39
 {
40
-	$reflector = new \ReflectionClass('\Composer\Autoload\ClassLoader');
40
+	$reflector=new \ReflectionClass('\Composer\Autoload\ClassLoader');
41 41
 	define('PRADO_VENDORDIR', dirname(dirname($reflector->getFileName())));
42 42
 }
43 43
 
@@ -60,36 +60,36 @@  discard block
 block discarded – undo
60 60
 	/**
61 61
 	 * File extension for Prado class files.
62 62
 	 */
63
-	const CLASS_FILE_EXT = '.php';
63
+	const CLASS_FILE_EXT='.php';
64 64
 	/**
65 65
 	 * @var array list of path aliases
66 66
 	 */
67
-	private static $_aliases = [
67
+	private static $_aliases=[
68 68
 		'Prado' => PRADO_DIR,
69 69
 		'Vendor' => PRADO_VENDORDIR
70 70
 		];
71 71
 	/**
72 72
 	 * @var array list of namespaces currently in use
73 73
 	 */
74
-	private static $_usings = [
74
+	private static $_usings=[
75 75
 		'Prado' => PRADO_DIR
76 76
 		];
77 77
 	/**
78 78
 	 * @var array list of namespaces currently in use
79 79
 	 */
80
-	public static $classMap = [];
80
+	public static $classMap=[];
81 81
 	/**
82 82
 	 * @var TApplication the application instance
83 83
 	 */
84
-	private static $_application = null;
84
+	private static $_application=null;
85 85
 	/**
86 86
 	 * @var TLogger logger instance
87 87
 	 */
88
-	private static $_logger = null;
88
+	private static $_logger=null;
89 89
 	/**
90 90
 	 * @var array list of class exists checks
91 91
 	 */
92
-	protected static $classExists = [];
92
+	protected static $classExists=[];
93 93
 	/**
94 94
 	 * @return string the version of Prado framework
95 95
 	 */
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public static function initAutoloader()
111 111
 	{
112
-		self::$classMap = require(__DIR__ . '/classes.php');
112
+		self::$classMap=require(__DIR__.'/classes.php');
113 113
 
114 114
 		spl_autoload_register([get_called_class(), 'autoload']);
115 115
 	}
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 		/**
125 125
 		 * Sets error handler to be Prado::phpErrorHandler
126 126
 		 */
127
-		set_error_handler(['\Prado\PradoBase','phpErrorHandler']);
127
+		set_error_handler(['\Prado\PradoBase', 'phpErrorHandler']);
128 128
 		/**
129 129
 		 * Sets shutdown function to be Prado::phpFatalErrorHandler
130 130
 		 */
131
-		register_shutdown_function(['PradoBase','phpFatalErrorHandler']);
131
+		register_shutdown_function(['PradoBase', 'phpFatalErrorHandler']);
132 132
 		/**
133 133
 		 * Sets exception handler to be Prado::exceptionHandler
134 134
 		 */
135
-		set_exception_handler(['\Prado\PradoBase','exceptionHandler']);
135
+		set_exception_handler(['\Prado\PradoBase', 'exceptionHandler']);
136 136
 		/**
137 137
 		 * Disable php's builtin error reporting to avoid duplicated reports
138 138
 		 */
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 	 * @param integer the type of "powered logo". Valid values include 0 and 1.
154 154
 	 * @return string a string that can be displayed on your Web page showing powered-by-PRADO information
155 155
 	 */
156
-	public static function poweredByPrado($logoType = 0)
156
+	public static function poweredByPrado($logoType=0)
157 157
 	{
158
-		$logoName = $logoType == 1?'powered2':'powered';
159
-		if(self::$_application !== null)
158
+		$logoName=$logoType==1 ? 'powered2' : 'powered';
159
+		if(self::$_application!==null)
160 160
 		{
161
-			$am = self::$_application->getAssetManager();
162
-			$url = $am->publishFilePath(self::getPathOfNamespace('Prado\\' . $logoName, '.gif'));
161
+			$am=self::$_application->getAssetManager();
162
+			$url=$am->publishFilePath(self::getPathOfNamespace('Prado\\'.$logoName, '.gif'));
163 163
 		}
164 164
 		else
165
-			$url = 'http://pradosoft.github.io/docs/' . $logoName . '.gif';
166
-		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>';
165
+			$url='http://pradosoft.github.io/docs/'.$logoName.'.gif';
166
+		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>';
167 167
 	}
168 168
 
169 169
 	/**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public static function phpFatalErrorHandler()
192 192
 	{
193
-		$error = error_get_last();
193
+		$error=error_get_last();
194 194
 		if($error &&
195 195
 			TPhpErrorException::isFatalError($error) &&
196 196
 			error_reporting() & $error['type'])
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public static function exceptionHandler($exception)
212 212
 	{
213
-		if(self::$_application !== null && ($errorHandler = self::$_application->getErrorHandler()) !== null)
213
+		if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null)
214 214
 		{
215 215
 			$errorHandler->handleError(null, $exception);
216 216
 		}
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	public static function setApplication($application)
234 234
 	{
235
-		if(self::$_application !== null && !defined('PRADO_TEST_RUN'))
235
+		if(self::$_application!==null && !defined('PRADO_TEST_RUN'))
236 236
 			throw new TInvalidOperationException('prado_application_singleton_required');
237
-		self::$_application = $application;
237
+		self::$_application=$application;
238 238
 	}
239 239
 
240 240
 	/**
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 
262 262
 	protected static function prado3NamespaceToPhpNamespace($type)
263 263
 	{
264
-		if(substr($type, 0, 6) === 'System')
265
-			$type = 'Prado' . substr($type, 6);
264
+		if(substr($type, 0, 6)==='System')
265
+			$type='Prado'.substr($type, 6);
266 266
 
267
-		if(false === strpos($type, '\\'))
267
+		if(false===strpos($type, '\\'))
268 268
 			return str_replace('.', '\\', $type);
269 269
 		else
270 270
 			return $type;
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
 	 */
286 286
 	public static function createComponent($requestedType)
287 287
 	{
288
-		$type = static::prado3NamespaceToPhpNamespace($requestedType);
288
+		$type=static::prado3NamespaceToPhpNamespace($requestedType);
289 289
 		if(!isset(self::$classExists[$type]))
290
-			self::$classExists[$type] = class_exists($type, false);
290
+			self::$classExists[$type]=class_exists($type, false);
291 291
 
292 292
 		if(!isset(self::$_usings[$type]) && !self::$classExists[$type]) {
293 293
 			static::using($type);
294
-			self::$classExists[$type] = class_exists($type, false);
294
+			self::$classExists[$type]=class_exists($type, false);
295 295
 		}
296 296
 
297 297
 		/*
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 		 * \Application\Common\MyDataModule)
302 302
 		 * Skip this if the class is inside the Prado\* namespace, since all Prado classes are now namespaced
303 303
 		 */
304
-		if(($pos = strrpos($type, '\\')) !== false && ($requestedType != $type) && strpos($type, 'Prado\\') !== 0)
305
-			$type = substr($type, $pos + 1);
304
+		if(($pos=strrpos($type, '\\'))!==false && ($requestedType!=$type) && strpos($type, 'Prado\\')!==0)
305
+			$type=substr($type, $pos + 1);
306 306
 
307
-		if(($n = func_num_args()) > 1)
307
+		if(($n=func_num_args()) > 1)
308 308
 		{
309
-			$args = func_get_args();
309
+			$args=func_get_args();
310 310
 			switch($n) {
311 311
 				case 2:
312 312
 					return new $type($args[1]);
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 					return new $type($args[1], $args[2], $args[3], $args[4]);
322 322
 				break;
323 323
 				default:
324
-					$s = '$args[1]';
325
-					for($i = 2;$i < $n;++$i)
326
-						$s .= ",\$args[$i]";
324
+					$s='$args[1]';
325
+					for($i=2; $i < $n; ++$i)
326
+						$s.=",\$args[$i]";
327 327
 					eval("\$component=new $type($s);");
328 328
 					return $component;
329 329
 				break;
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 	 * @param boolean whether to check the existence of the class after the class file is included
343 343
 	 * @throws TInvalidDataValueException if the namespace is invalid
344 344
 	 */
345
-	public static function using($namespace, $checkClassExistence = true)
345
+	public static function using($namespace, $checkClassExistence=true)
346 346
 	{
347
-		$namespace = static::prado3NamespaceToPhpNamespace($namespace);
347
+		$namespace=static::prado3NamespaceToPhpNamespace($namespace);
348 348
 
349 349
 		if(isset(self::$_usings[$namespace]) || class_exists($namespace, false))
350 350
 			return;
@@ -352,21 +352,21 @@  discard block
 block discarded – undo
352 352
 		if(array_key_exists($namespace, self::$classMap))
353 353
 		{
354 354
 			// fast autoload a Prado3 class name
355
-			$phpNamespace = self::$classMap[$namespace];
355
+			$phpNamespace=self::$classMap[$namespace];
356 356
 			if(class_exists($phpNamespace, true) || interface_exists($phpNamespace, true))
357 357
 			{
358 358
 				if(!class_exists($namespace) && !interface_exists($namespace))
359 359
 					class_alias($phpNamespace, $namespace);
360 360
 				return;
361 361
 			}
362
-		} elseif(($pos = strrpos($namespace, '\\')) === false) {
362
+		} elseif(($pos=strrpos($namespace, '\\'))===false) {
363 363
 			// trying to autoload an old class name
364 364
 			foreach(self::$_usings as $k => $v)
365 365
 			{
366
-				$path = $v . DIRECTORY_SEPARATOR . $namespace . self::CLASS_FILE_EXT;
366
+				$path=$v.DIRECTORY_SEPARATOR.$namespace.self::CLASS_FILE_EXT;
367 367
 				if(file_exists($path))
368 368
 				{
369
-					$phpNamespace = '\\' . $k . '\\' . $namespace;
369
+					$phpNamespace='\\'.$k.'\\'.$namespace;
370 370
 					if(class_exists($phpNamespace, true) || interface_exists($phpNamespace, true))
371 371
 					{
372 372
 						if(!class_exists($namespace) && !interface_exists($namespace))
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
 
379 379
 			if($checkClassExistence && !class_exists($namespace, false) && !interface_exists($namespace, false))
380 380
 				throw new TInvalidOperationException('prado_component_unknown', $namespace, '');
381
-		} elseif(($path = self::getPathOfNamespace($namespace, self::CLASS_FILE_EXT)) !== null) {
382
-			$className = substr($namespace, $pos + 1);
383
-			if($className === '*')  // a directory
381
+		} elseif(($path=self::getPathOfNamespace($namespace, self::CLASS_FILE_EXT))!==null) {
382
+			$className=substr($namespace, $pos + 1);
383
+			if($className==='*')  // a directory
384 384
 			{
385
-				self::$_usings[substr($namespace, 0, $pos)] = $path;
385
+				self::$_usings[substr($namespace, 0, $pos)]=$path;
386 386
 			}
387 387
 			else  // a file
388 388
 			{
@@ -419,11 +419,11 @@  discard block
 block discarded – undo
419 419
 	 * @param string extension to be appended if the namespace refers to a file
420 420
 	 * @return string file path corresponding to the namespace, null if namespace is invalid
421 421
 	 */
422
-	public static function getPathOfNamespace($namespace, $ext = '')
422
+	public static function getPathOfNamespace($namespace, $ext='')
423 423
 	{
424
-		$namespace = static::prado3NamespaceToPhpNamespace($namespace);
424
+		$namespace=static::prado3NamespaceToPhpNamespace($namespace);
425 425
 
426
-		if(self::CLASS_FILE_EXT === $ext || empty($ext))
426
+		if(self::CLASS_FILE_EXT===$ext || empty($ext))
427 427
 		{
428 428
 			if(isset(self::$_usings[$namespace]))
429 429
 				return self::$_usings[$namespace];
@@ -432,11 +432,11 @@  discard block
 block discarded – undo
432 432
 				return self::$_aliases[$namespace];
433 433
 		}
434 434
 
435
-		$segs = explode('\\', $namespace);
436
-		$alias = array_shift($segs);
435
+		$segs=explode('\\', $namespace);
436
+		$alias=array_shift($segs);
437 437
 
438
-		if(null !== ($file = array_pop($segs)) && null !== ($root = self::getPathOfAlias($alias)))
439
-			return rtrim($root . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $segs), '/\\') . (($file === '*') ? '' : DIRECTORY_SEPARATOR . $file . $ext);
438
+		if(null!==($file=array_pop($segs)) && null!==($root=self::getPathOfAlias($alias)))
439
+			return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $segs), '/\\').(($file==='*') ? '' : DIRECTORY_SEPARATOR.$file.$ext);
440 440
 
441 441
 		return null;
442 442
 	}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public static function getPathOfAlias($alias)
449 449
 	{
450
-		return isset(self::$_aliases[$alias])?self::$_aliases[$alias]:null;
450
+		return isset(self::$_aliases[$alias]) ?self::$_aliases[$alias] : null;
451 451
 	}
452 452
 
453 453
 	protected static function getPathAliases()
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
 	{
466 466
 		if(isset(self::$_aliases[$alias]) && !defined('PRADO_TEST_RUN'))
467 467
 			throw new TInvalidOperationException('prado_alias_redefined', $alias);
468
-		elseif(($rp = realpath($path)) !== false && is_dir($rp))
468
+		elseif(($rp=realpath($path))!==false && is_dir($rp))
469 469
 		{
470
-			if(strpos($alias, '.') === false)
471
-				self::$_aliases[$alias] = $rp;
470
+			if(strpos($alias, '.')===false)
471
+				self::$_aliases[$alias]=$rp;
472 472
 			else
473 473
 				throw new TInvalidDataValueException('prado_aliasname_invalid', $alias);
474 474
 		}
@@ -485,53 +485,53 @@  discard block
 block discarded – undo
485 485
 	public static function fatalError($msg)
486 486
 	{
487 487
 		echo '<h1>Fatal Error</h1>';
488
-		echo '<p>' . $msg . '</p>';
488
+		echo '<p>'.$msg.'</p>';
489 489
 		if(!function_exists('debug_backtrace'))
490 490
 			return;
491 491
 		echo '<h2>Debug Backtrace</h2>';
492 492
 		echo '<pre>';
493
-		$index = -1;
493
+		$index=-1;
494 494
 		foreach(debug_backtrace() as $t)
495 495
 		{
496 496
 			$index++;
497
-			if($index == 0)  // hide the backtrace of this function
497
+			if($index==0)  // hide the backtrace of this function
498 498
 				continue;
499
-			echo '#' . $index . ' ';
499
+			echo '#'.$index.' ';
500 500
 			if(isset($t['file']))
501
-				echo basename($t['file']) . ':' . $t['line'];
501
+				echo basename($t['file']).':'.$t['line'];
502 502
 			else
503 503
 				 echo '<PHP inner-code>';
504 504
 			echo ' -- ';
505 505
 			if(isset($t['class']))
506
-				echo $t['class'] . $t['type'];
507
-			echo $t['function'] . '(';
506
+				echo $t['class'].$t['type'];
507
+			echo $t['function'].'(';
508 508
 			if(isset($t['args']) && count($t['args']) > 0)
509 509
 			{
510
-				$count = 0;
510
+				$count=0;
511 511
 				foreach($t['args'] as $item)
512 512
 				{
513 513
 					if(is_string($item))
514 514
 					{
515
-						$str = htmlentities(str_replace("\r\n", "", $item), ENT_QUOTES);
516
-						if (strlen($item) > 70)
517
-							echo "'" . substr($str, 0, 70) . "...'";
515
+						$str=htmlentities(str_replace("\r\n", "", $item), ENT_QUOTES);
516
+						if(strlen($item) > 70)
517
+							echo "'".substr($str, 0, 70)."...'";
518 518
 						else
519
-							echo "'" . $str . "'";
519
+							echo "'".$str."'";
520 520
 					}
521
-					elseif (is_int($item) || is_float($item))
521
+					elseif(is_int($item) || is_float($item))
522 522
 						echo $item;
523
-					elseif (is_object($item))
523
+					elseif(is_object($item))
524 524
 						echo get_class($item);
525
-					elseif (is_array($item))
526
-						echo 'array(' . count($item) . ')';
527
-					elseif (is_bool($item))
525
+					elseif(is_array($item))
526
+						echo 'array('.count($item).')';
527
+					elseif(is_bool($item))
528 528
 						echo $item ? 'true' : 'false';
529
-					elseif ($item === null)
529
+					elseif($item===null)
530 530
 						echo 'NULL';
531
-					elseif (is_resource($item))
531
+					elseif(is_resource($item))
532 532
 						echo get_resource_type($item);
533 533
 					$count++;
534
-					if (count($t['args']) > $count)
534
+					if(count($t['args']) > $count)
535 535
 						echo ', ';
536 536
 				}
537 537
 			}
@@ -550,23 +550,23 @@  discard block
 block discarded – undo
550 550
 	 */
551 551
 	public static function getUserLanguages()
552 552
 	{
553
-		static $languages = null;
554
-		if($languages === null)
553
+		static $languages=null;
554
+		if($languages===null)
555 555
 		{
556 556
 			if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
557
-				$languages[0] = 'en';
557
+				$languages[0]='en';
558 558
 			else
559 559
 			{
560
-				$languages = [];
560
+				$languages=[];
561 561
 				foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language)
562 562
 				{
563
-					$array = explode(';q=', trim($language));
564
-					$languages[trim($array[0])] = isset($array[1])?(float)$array[1]:1.0;
563
+					$array=explode(';q=', trim($language));
564
+					$languages[trim($array[0])]=isset($array[1]) ? (float) $array[1] : 1.0;
565 565
 				}
566 566
 				arsort($languages);
567
-				$languages = array_keys($languages);
567
+				$languages=array_keys($languages);
568 568
 				if(empty($languages))
569
-					$languages[0] = 'en';
569
+					$languages[0]='en';
570 570
 			}
571 571
 		}
572 572
 		return $languages;
@@ -578,15 +578,15 @@  discard block
 block discarded – undo
578 578
 	 */
579 579
 	public static function getPreferredLanguage()
580 580
 	{
581
-		static $language = null;
582
-		if($language === null)
581
+		static $language=null;
582
+		if($language===null)
583 583
 		{
584
-			$langs = Prado::getUserLanguages();
585
-			$lang = explode('-', $langs[0]);
584
+			$langs=Prado::getUserLanguages();
585
+			$lang=explode('-', $langs[0]);
586 586
 			if(empty($lang[0]) || !ctype_alpha($lang[0]))
587
-				$language = 'en';
587
+				$language='en';
588 588
 			else
589
-				$language = $lang[0];
589
+				$language=$lang[0];
590 590
 		}
591 591
 		return $language;
592 592
 	}
@@ -603,19 +603,19 @@  discard block
 block discarded – undo
603 603
 	 * @param (string|TControl) control of the message
604 604
 	 * @see log, getLogger
605 605
 	 */
606
-	public static function trace($msg, $category = 'Uncategorized', $ctl = null)
606
+	public static function trace($msg, $category='Uncategorized', $ctl=null)
607 607
 	{
608
-		if(self::$_application && self::$_application->getMode() === TApplicationMode::Performance)
608
+		if(self::$_application && self::$_application->getMode()===TApplicationMode::Performance)
609 609
 			return;
610
-		if(!self::$_application || self::$_application->getMode() === TApplicationMode::Debug)
610
+		if(!self::$_application || self::$_application->getMode()===TApplicationMode::Debug)
611 611
 		{
612
-			$trace = debug_backtrace();
612
+			$trace=debug_backtrace();
613 613
 			if(isset($trace[0]['file']) && isset($trace[0]['line']))
614
-				$msg .= " (line {$trace[0]['line']}, {$trace[0]['file']})";
615
-			$level = TLogger::DEBUG;
614
+				$msg.=" (line {$trace[0]['line']}, {$trace[0]['file']})";
615
+			$level=TLogger::DEBUG;
616 616
 		}
617 617
 		else
618
-			$level = TLogger::INFO;
618
+			$level=TLogger::INFO;
619 619
 		self::log($msg, $level, $category, $ctl);
620 620
 	}
621 621
 
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
 	 * @param string category of the message
632 632
 	 * @param (string|TControl) control of the message
633 633
 	 */
634
-	public static function log($msg, $level = TLogger::INFO, $category = 'Uncategorized', $ctl = null)
634
+	public static function log($msg, $level=TLogger::INFO, $category='Uncategorized', $ctl=null)
635 635
 	{
636
-		if(self::$_logger === null)
637
-			self::$_logger = new TLogger;
636
+		if(self::$_logger===null)
637
+			self::$_logger=new TLogger;
638 638
 		self::$_logger->log($msg, $level, $category, $ctl);
639 639
 	}
640 640
 
@@ -643,8 +643,8 @@  discard block
 block discarded – undo
643 643
 	 */
644 644
 	public static function getLogger()
645 645
 	{
646
-		if(self::$_logger === null)
647
-			self::$_logger = new TLogger;
646
+		if(self::$_logger===null)
647
+			self::$_logger=new TLogger;
648 648
 		return self::$_logger;
649 649
 	}
650 650
 
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 	 * @param boolean whether to syntax highlight the output. Defaults to false.
658 658
 	 * @return string the string representation of the variable
659 659
 	 */
660
-	public static function varDump($var, $depth = 10, $highlight = false)
660
+	public static function varDump($var, $depth=10, $highlight=false)
661 661
 	{
662 662
 		return TVarDumper::dump($var, $depth, $highlight);
663 663
 	}
@@ -672,32 +672,32 @@  discard block
 block discarded – undo
672 672
 	 * @see TTranslate::formatter()
673 673
 	 * @see TTranslate::init()
674 674
 	 */
675
-	public static function localize($text, $parameters = [], $catalogue = null, $charset = null)
675
+	public static function localize($text, $parameters=[], $catalogue=null, $charset=null)
676 676
 	{
677
-		$app = Prado::getApplication()->getGlobalization(false);
677
+		$app=Prado::getApplication()->getGlobalization(false);
678 678
 
679
-		$params = [];
679
+		$params=[];
680 680
 		foreach($parameters as $key => $value)
681
-			$params['{' . $key . '}'] = $value;
681
+			$params['{'.$key.'}']=$value;
682 682
 
683 683
 		//no translation handler provided
684
-		if($app === null || ($config = $app->getTranslationConfiguration()) === null)
684
+		if($app===null || ($config=$app->getTranslationConfiguration())===null)
685 685
 			return strtr($text, $params);
686 686
 
687
-		if ($catalogue === null)
688
-			$catalogue = isset($config['catalogue'])?$config['catalogue']:'messages';
687
+		if($catalogue===null)
688
+			$catalogue=isset($config['catalogue']) ? $config['catalogue'] : 'messages';
689 689
 
690 690
 		Translation::init($catalogue);
691 691
 
692 692
 		//globalization charset
693
-		$appCharset = $app === null ? '' : $app->getCharset();
693
+		$appCharset=$app===null ? '' : $app->getCharset();
694 694
 
695 695
 		//default charset
696
-		$defaultCharset = ($app === null) ? 'UTF-8' : $app->getDefaultCharset();
696
+		$defaultCharset=($app===null) ? 'UTF-8' : $app->getDefaultCharset();
697 697
 
698 698
 		//fall back
699
-		if(empty($charset)) $charset = $appCharset;
700
-		if(empty($charset)) $charset = $defaultCharset;
699
+		if(empty($charset)) $charset=$appCharset;
700
+		if(empty($charset)) $charset=$defaultCharset;
701 701
 
702 702
 		return Translation::formatter($catalogue)->format($text, $params, $catalogue, $charset);
703 703
 	}
Please login to merge, or discard this patch.
framework/Exceptions/THttpException.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,16 +38,16 @@
 block discarded – undo
38 38
 	 */
39 39
 	public function __construct($statusCode, $errorMessage)
40 40
 	{
41
-		$this->_statusCode = $statusCode;
41
+		$this->_statusCode=$statusCode;
42 42
 		$this->setErrorCode($errorMessage);
43
-		$errorMessage = $this->translateErrorMessage($errorMessage);
44
-		$args = func_get_args();
43
+		$errorMessage=$this->translateErrorMessage($errorMessage);
44
+		$args=func_get_args();
45 45
 		array_shift($args);
46 46
 		array_shift($args);
47
-		$n = count($args);
48
-		$tokens = [];
49
-		for($i = 0;$i < $n;++$i)
50
-			$tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]);
47
+		$n=count($args);
48
+		$tokens=[];
49
+		for($i=0; $i < $n; ++$i)
50
+			$tokens['{'.$i.'}']=TPropertyValue::ensureString($args[$i]);
51 51
 		parent::__construct(strtr($errorMessage, $tokens));
52 52
 	}
53 53
 
Please login to merge, or discard this patch.
framework/Exceptions/TErrorHandler.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * error template file basename
59 59
 	 */
60
-	const ERROR_FILE_NAME = 'error';
60
+	const ERROR_FILE_NAME='error';
61 61
 	/**
62 62
 	 * exception template file basename
63 63
 	 */
64
-	const EXCEPTION_FILE_NAME = 'exception';
64
+	const EXCEPTION_FILE_NAME='exception';
65 65
 	/**
66 66
 	 * number of lines before and after the error line to be displayed in case of an exception
67 67
 	 */
68
-	const SOURCE_LINES = 12;
68
+	const SOURCE_LINES=12;
69 69
 	/**
70 70
 	 * number of prado internal function calls to be dropped from stack traces on fatal errors
71 71
 	 */
72
-	const FATAL_ERROR_TRACE_DROP_LINES = 5;
72
+	const FATAL_ERROR_TRACE_DROP_LINES=5;
73 73
 
74 74
 	/**
75 75
 	 * @var string error template directory
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function getErrorTemplatePath()
93 93
 	{
94
-		if($this->_templatePath === null)
95
-			$this->_templatePath = Prado::getFrameworkPath() . '/Exceptions/templates';
94
+		if($this->_templatePath===null)
95
+			$this->_templatePath=Prado::getFrameworkPath().'/Exceptions/templates';
96 96
 		return $this->_templatePath;
97 97
 	}
98 98
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function setErrorTemplatePath($value)
106 106
 	{
107
-		if(($templatePath = Prado::getPathOfNamespace($value)) !== null && is_dir($templatePath))
108
-			$this->_templatePath = $templatePath;
107
+		if(($templatePath=Prado::getPathOfNamespace($value))!==null && is_dir($templatePath))
108
+			$this->_templatePath=$templatePath;
109 109
 		else
110 110
 			throw new TConfigurationException('errorhandler_errortemplatepath_invalid', $value);
111 111
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function handleError($sender, $param)
123 123
 	{
124
-		static $handling = false;
124
+		static $handling=false;
125 125
 		// We need to restore error and exception handlers,
126 126
 		// because within error and exception handlers, new errors and exceptions
127 127
 		// cannot be handled properly by PHP
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
 			$this->handleRecursiveError($param);
133 133
 		else
134 134
 		{
135
-			$handling = true;
136
-			if(($response = $this->getResponse()) !== null)
135
+			$handling=true;
136
+			if(($response=$this->getResponse())!==null)
137 137
 				$response->clear();
138 138
 			if(!headers_sent())
139 139
 				header('Content-Type: text/html; charset=UTF-8');
140 140
 			if($param instanceof THttpException)
141 141
 				$this->handleExternalError($param->getStatusCode(), $param);
142
-			elseif($this->getApplication()->getMode() === TApplicationMode::Debug)
142
+			elseif($this->getApplication()->getMode()===TApplicationMode::Debug)
143 143
 				$this->displayException($param);
144 144
 			else
145 145
 				$this->handleExternalError(500, $param);
@@ -153,30 +153,30 @@  discard block
 block discarded – undo
153 153
 	 * @return string
154 154
 	 * @since 3.1.6
155 155
 	 */
156
-	protected static function hideSecurityRelated($value, $exception = null)
156
+	protected static function hideSecurityRelated($value, $exception=null)
157 157
 	{
158
-		$aRpl = [];
159
-		if($exception !== null && $exception instanceof \Exception)
158
+		$aRpl=[];
159
+		if($exception!==null && $exception instanceof \Exception)
160 160
 		{
161 161
 			if($exception instanceof TPhpFatalErrorException &&
162 162
 				function_exists('xdebug_get_function_stack'))
163 163
 			{
164
-				$aTrace = array_slice(array_reverse(xdebug_get_function_stack()), self::FATAL_ERROR_TRACE_DROP_LINES, -1);
164
+				$aTrace=array_slice(array_reverse(xdebug_get_function_stack()), self::FATAL_ERROR_TRACE_DROP_LINES, -1);
165 165
 			} else {
166
-				$aTrace = $exception->getTrace();
166
+				$aTrace=$exception->getTrace();
167 167
 			}
168 168
 
169 169
 			foreach($aTrace as $item)
170 170
 			{
171 171
 				if(isset($item['file']))
172
-					$aRpl[dirname($item['file']) . DIRECTORY_SEPARATOR] = '<hidden>' . DIRECTORY_SEPARATOR;
172
+					$aRpl[dirname($item['file']).DIRECTORY_SEPARATOR]='<hidden>'.DIRECTORY_SEPARATOR;
173 173
 			}
174 174
 		}
175
-		$aRpl[$_SERVER['DOCUMENT_ROOT']] = '${DocumentRoot}';
176
-		$aRpl[str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT'])] = '${DocumentRoot}';
177
-		$aRpl[PRADO_DIR . DIRECTORY_SEPARATOR] = '${PradoFramework}' . DIRECTORY_SEPARATOR;
175
+		$aRpl[$_SERVER['DOCUMENT_ROOT']]='${DocumentRoot}';
176
+		$aRpl[str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT'])]='${DocumentRoot}';
177
+		$aRpl[PRADO_DIR.DIRECTORY_SEPARATOR]='${PradoFramework}'.DIRECTORY_SEPARATOR;
178 178
 		if(isset($aRpl[DIRECTORY_SEPARATOR])) unset($aRpl[DIRECTORY_SEPARATOR]);
179
-		$aRpl = array_reverse($aRpl, true);
179
+		$aRpl=array_reverse($aRpl, true);
180 180
 
181 181
 		return str_replace(array_keys($aRpl), $aRpl, $value);
182 182
 	}
@@ -193,21 +193,21 @@  discard block
 block discarded – undo
193 193
 		if(!($exception instanceof THttpException))
194 194
 			error_log($exception->__toString());
195 195
 
196
-		$content = $this->getErrorTemplate($statusCode, $exception);
196
+		$content=$this->getErrorTemplate($statusCode, $exception);
197 197
 
198
-		$serverAdmin = isset($_SERVER['SERVER_ADMIN'])?$_SERVER['SERVER_ADMIN']:'';
198
+		$serverAdmin=isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : '';
199 199
 
200
-		$isDebug = $this->getApplication()->getMode() === TApplicationMode::Debug;
200
+		$isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug;
201 201
 
202
-		$errorMessage = $exception->getMessage();
202
+		$errorMessage=$exception->getMessage();
203 203
 		if($isDebug)
204
-			$version = $_SERVER['SERVER_SOFTWARE'] . ' <a href="https://github.com/pradosoft/prado">PRADO</a>/' . Prado::getVersion();
204
+			$version=$_SERVER['SERVER_SOFTWARE'].' <a href="https://github.com/pradosoft/prado">PRADO</a>/'.Prado::getVersion();
205 205
 		else
206 206
 		{
207
-			$version = '';
208
-			$errorMessage = self::hideSecurityRelated($errorMessage, $exception);
207
+			$version='';
208
+			$errorMessage=self::hideSecurityRelated($errorMessage, $exception);
209 209
 		}
210
-		$tokens = [
210
+		$tokens=[
211 211
 			'%%StatusCode%%' => "$statusCode",
212 212
 			'%%ErrorMessage%%' => htmlspecialchars($errorMessage),
213 213
 			'%%ServerAdmin%%' => $serverAdmin,
@@ -229,16 +229,16 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	protected function handleRecursiveError($exception)
231 231
 	{
232
-		if($this->getApplication()->getMode() === TApplicationMode::Debug)
232
+		if($this->getApplication()->getMode()===TApplicationMode::Debug)
233 233
 		{
234 234
 			echo "<html><head><title>Recursive Error</title></head>\n";
235 235
 			echo "<body><h1>Recursive Error</h1>\n";
236
-			echo "<pre>" . $exception->__toString() . "</pre>\n";
236
+			echo "<pre>".$exception->__toString()."</pre>\n";
237 237
 			echo "</body></html>";
238 238
 		}
239 239
 		else
240 240
 		{
241
-			error_log("Error happened while processing an existing error:\n" . $exception->__toString());
241
+			error_log("Error happened while processing an existing error:\n".$exception->__toString());
242 242
 			header('HTTP/1.0 500 Internal Error');
243 243
 		}
244 244
 	}
@@ -252,53 +252,53 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	protected function displayException($exception)
254 254
 	{
255
-		if(php_sapi_name() === 'cli')
255
+		if(php_sapi_name()==='cli')
256 256
 		{
257
-			echo $exception->getMessage() . "\n";
257
+			echo $exception->getMessage()."\n";
258 258
 			echo $this->getExactTraceAsString($exception);
259 259
 			return;
260 260
 		}
261 261
 
262 262
 		if($exception instanceof TTemplateException)
263 263
 		{
264
-			$fileName = $exception->getTemplateFile();
265
-			$lines = empty($fileName)?explode("\n", $exception->getTemplateSource()):@file($fileName);
266
-			$source = $this->getSourceCode($lines, $exception->getLineNumber());
267
-			if($fileName === '')
268
-				$fileName = '---embedded template---';
269
-			$errorLine = $exception->getLineNumber();
264
+			$fileName=$exception->getTemplateFile();
265
+			$lines=empty($fileName) ?explode("\n", $exception->getTemplateSource()) : @file($fileName);
266
+			$source=$this->getSourceCode($lines, $exception->getLineNumber());
267
+			if($fileName==='')
268
+				$fileName='---embedded template---';
269
+			$errorLine=$exception->getLineNumber();
270 270
 		}
271 271
 		else
272 272
 		{
273
-			if(($trace = $this->getExactTrace($exception)) !== null)
273
+			if(($trace=$this->getExactTrace($exception))!==null)
274 274
 			{
275
-				$fileName = $trace['file'];
276
-				$errorLine = $trace['line'];
275
+				$fileName=$trace['file'];
276
+				$errorLine=$trace['line'];
277 277
 			}
278 278
 			else
279 279
 			{
280
-				$fileName = $exception->getFile();
281
-				$errorLine = $exception->getLine();
280
+				$fileName=$exception->getFile();
281
+				$errorLine=$exception->getLine();
282 282
 			}
283
-			$source = $this->getSourceCode(@file($fileName), $errorLine);
283
+			$source=$this->getSourceCode(@file($fileName), $errorLine);
284 284
 		}
285 285
 
286
-		if($this->getApplication()->getMode() === TApplicationMode::Debug)
287
-			$version = $_SERVER['SERVER_SOFTWARE'] . ' <a href="https://github.com/pradosoft/prado">PRADO</a>/' . Prado::getVersion();
286
+		if($this->getApplication()->getMode()===TApplicationMode::Debug)
287
+			$version=$_SERVER['SERVER_SOFTWARE'].' <a href="https://github.com/pradosoft/prado">PRADO</a>/'.Prado::getVersion();
288 288
 		else
289
-			$version = '';
289
+			$version='';
290 290
 
291
-		$tokens = [
291
+		$tokens=[
292 292
 			'%%ErrorType%%' => get_class($exception),
293 293
 			'%%ErrorMessage%%' => $this->addLink(htmlspecialchars($exception->getMessage())),
294
-			'%%SourceFile%%' => htmlspecialchars($fileName) . ' (' . $errorLine . ')',
294
+			'%%SourceFile%%' => htmlspecialchars($fileName).' ('.$errorLine.')',
295 295
 			'%%SourceCode%%' => $source,
296 296
 			'%%StackTrace%%' => htmlspecialchars($this->getExactTraceAsString($exception)),
297 297
 			'%%Version%%' => $version,
298 298
 			'%%Time%%' => @strftime('%Y-%m-%d %H:%M', time())
299 299
 		];
300 300
 
301
-		$content = $this->getExceptionTemplate($exception);
301
+		$content=$this->getExceptionTemplate($exception);
302 302
 
303 303
 		echo strtr($content, $tokens);
304 304
 	}
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	protected function getExceptionTemplate($exception)
314 314
 	{
315
-		$lang = Prado::getPreferredLanguage();
316
-		$exceptionFile = Prado::getFrameworkPath() . '/Exceptions/templates/' . self::EXCEPTION_FILE_NAME . '-' . $lang . '.html';
315
+		$lang=Prado::getPreferredLanguage();
316
+		$exceptionFile=Prado::getFrameworkPath().'/Exceptions/templates/'.self::EXCEPTION_FILE_NAME.'-'.$lang.'.html';
317 317
 		if(!is_file($exceptionFile))
318
-			$exceptionFile = Prado::getFrameworkPath() . '/Exceptions/templates/' . self::EXCEPTION_FILE_NAME . '.html';
319
-		if(($content = @file_get_contents($exceptionFile)) === false)
318
+			$exceptionFile=Prado::getFrameworkPath().'/Exceptions/templates/'.self::EXCEPTION_FILE_NAME.'.html';
319
+		if(($content=@file_get_contents($exceptionFile))===false)
320 320
 			die("Unable to open exception template file '$exceptionFile'.");
321 321
 		return $content;
322 322
 	}
@@ -339,45 +339,45 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	protected function getErrorTemplate($statusCode, $exception)
341 341
 	{
342
-		$base = $this->getErrorTemplatePath() . DIRECTORY_SEPARATOR . self::ERROR_FILE_NAME;
343
-		$lang = Prado::getPreferredLanguage();
342
+		$base=$this->getErrorTemplatePath().DIRECTORY_SEPARATOR.self::ERROR_FILE_NAME;
343
+		$lang=Prado::getPreferredLanguage();
344 344
 		if(is_file("$base$statusCode-$lang.html"))
345
-			$errorFile = "$base$statusCode-$lang.html";
345
+			$errorFile="$base$statusCode-$lang.html";
346 346
 		elseif(is_file("$base$statusCode.html"))
347
-			$errorFile = "$base$statusCode.html";
347
+			$errorFile="$base$statusCode.html";
348 348
 		elseif(is_file("$base-$lang.html"))
349
-			$errorFile = "$base-$lang.html";
349
+			$errorFile="$base-$lang.html";
350 350
 		else
351
-			$errorFile = "$base.html";
352
-		if(($content = @file_get_contents($errorFile)) === false)
351
+			$errorFile="$base.html";
352
+		if(($content=@file_get_contents($errorFile))===false)
353 353
 			die("Unable to open error template file '$errorFile'.");
354 354
 		return $content;
355 355
 	}
356 356
 
357 357
 	private function getExactTrace($exception)
358 358
 	{
359
-		$result = null;
359
+		$result=null;
360 360
 		if($exception instanceof TPhpFatalErrorException &&
361 361
 			function_exists('xdebug_get_function_stack'))
362 362
 		{
363
-			$trace = array_slice(array_reverse(xdebug_get_function_stack()), self::FATAL_ERROR_TRACE_DROP_LINES, -1);
363
+			$trace=array_slice(array_reverse(xdebug_get_function_stack()), self::FATAL_ERROR_TRACE_DROP_LINES, -1);
364 364
 		} else {
365
-			$trace = $exception->getTrace();
365
+			$trace=$exception->getTrace();
366 366
 		}
367 367
 		
368 368
 		// if PHP exception, we want to show the 2nd stack level context
369 369
 		// because the 1st stack level is of little use (it's in error handler)
370 370
 		if($exception instanceof TPhpErrorException) {
371 371
 			if(isset($trace[0]['file']))
372
-				$result = $trace[0];
372
+				$result=$trace[0];
373 373
 			elseif(isset($trace[1]))
374
-				$result = $trace[1];
374
+				$result=$trace[1];
375 375
 		} elseif($exception instanceof TInvalidOperationException) {
376 376
 			// in case of getter or setter error, find out the exact file and row
377
-			if(($result = $this->getPropertyAccessTrace($trace, '__get')) === null)
378
-				$result = $this->getPropertyAccessTrace($trace, '__set');
377
+			if(($result=$this->getPropertyAccessTrace($trace, '__get'))===null)
378
+				$result=$this->getPropertyAccessTrace($trace, '__set');
379 379
 		}
380
-		if($result !== null && strpos($result['file'], ': eval()\'d code') !== false)
380
+		if($result!==null && strpos($result['file'], ': eval()\'d code')!==false)
381 381
 			return null;
382 382
 
383 383
 		return $result;
@@ -388,19 +388,19 @@  discard block
 block discarded – undo
388 388
 		if($exception instanceof TPhpFatalErrorException &&
389 389
 			function_exists('xdebug_get_function_stack'))
390 390
 		{
391
-			$trace = array_slice(array_reverse(xdebug_get_function_stack()), self::FATAL_ERROR_TRACE_DROP_LINES, -1);
392
-			$txt = '';
393
-			$row = 0;
391
+			$trace=array_slice(array_reverse(xdebug_get_function_stack()), self::FATAL_ERROR_TRACE_DROP_LINES, -1);
392
+			$txt='';
393
+			$row=0;
394 394
 
395 395
 			// try to mimic Exception::getTraceAsString()
396 396
 			foreach($trace as $line)
397 397
 			{
398 398
 				if(array_key_exists('function', $line))
399
-					$func = $line['function'] . '(' . implode(',', $line['params']) . ')';
399
+					$func=$line['function'].'('.implode(',', $line['params']).')';
400 400
 				else
401
-					$func = 'unknown';
401
+					$func='unknown';
402 402
 
403
-				$txt .= '#' . $row . ' ' . $line['file'] . '(' . $line['line'] . '): ' . $func . "\n";
403
+				$txt.='#'.$row.' '.$line['file'].'('.$line['line'].'): '.$func."\n";
404 404
 				$row++;
405 405
 			}
406 406
 
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 	private function getPropertyAccessTrace($trace, $pattern)
414 414
 	{
415
-		$result = null;
415
+		$result=null;
416 416
 		foreach($trace as $t)
417 417
 		{
418
-			if(isset($t['function']) && $t['function'] === $pattern)
419
-				$result = $t;
418
+			if(isset($t['function']) && $t['function']===$pattern)
419
+				$result=$t;
420 420
 			else
421 421
 				break;
422 422
 		}
@@ -425,44 +425,44 @@  discard block
 block discarded – undo
425 425
 
426 426
 	private function getSourceCode($lines, $errorLine)
427 427
 	{
428
-		$beginLine = $errorLine - self::SOURCE_LINES >= 0?$errorLine - self::SOURCE_LINES:0;
429
-		$endLine = $errorLine + self::SOURCE_LINES <= count($lines)?$errorLine + self::SOURCE_LINES:count($lines);
428
+		$beginLine=$errorLine - self::SOURCE_LINES >= 0 ? $errorLine - self::SOURCE_LINES : 0;
429
+		$endLine=$errorLine + self::SOURCE_LINES <= count($lines) ? $errorLine + self::SOURCE_LINES : count($lines);
430 430
 
431
-		$source = '';
432
-		for($i = $beginLine;$i < $endLine;++$i)
431
+		$source='';
432
+		for($i=$beginLine; $i < $endLine; ++$i)
433 433
 		{
434
-			if($i === $errorLine - 1)
434
+			if($i===$errorLine - 1)
435 435
 			{
436
-				$line = htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
437
-				$source .= "<div class=\"error\">" . $line . "</div>";
436
+				$line=htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
437
+				$source.="<div class=\"error\">".$line."</div>";
438 438
 			}
439 439
 			else
440
-				$source .= htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
440
+				$source.=htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
441 441
 		}
442 442
 		return $source;
443 443
 	}
444 444
 
445 445
 	private function addLink($message) {
446
-		if (null !== ($class = $this->getErrorClassNameSpace($message))) {
447
-			return str_replace($class['name'], '<a href="' . $class['url'] . '" target="_blank">' . $class['name'] . '</a>', $message);
446
+		if(null!==($class=$this->getErrorClassNameSpace($message))) {
447
+			return str_replace($class['name'], '<a href="'.$class['url'].'" target="_blank">'.$class['name'].'</a>', $message);
448 448
 		}
449 449
 		return $message;
450 450
 	}
451 451
 
452 452
 	private function getErrorClassNameSpace($message) {
453
-		$matches = [];
453
+		$matches=[];
454 454
 		preg_match('/\b(T[A-Z]\w+)\b/', $message, $matches);
455
-		if (is_array($matches) && count($matches) > 0) {
456
-			$class = $matches[0];
455
+		if(is_array($matches) && count($matches) > 0) {
456
+			$class=$matches[0];
457 457
 			try {
458
-				$function = new \ReflectionClass($class);
458
+				$function=new \ReflectionClass($class);
459 459
 			}
460
-			catch (\Exception $e) {
460
+			catch(\Exception $e) {
461 461
 				return null;
462 462
 			}
463
-			$classname = $function->getNamespaceName();
463
+			$classname=$function->getNamespaceName();
464 464
 			return [
465
-				'url' => 'http://pradosoft.github.io/docs/manual/class-' . str_replace('\\', '.', (string) $classname) . '.' . $class . '.html',
465
+				'url' => 'http://pradosoft.github.io/docs/manual/class-'.str_replace('\\', '.', (string) $classname).'.'.$class.'.html',
466 466
 				'name' => $class,
467 467
 			];
468 468
 		}
Please login to merge, or discard this patch.
framework/Exceptions/TTemplateException.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
  */
25 25
 class TTemplateException extends TConfigurationException
26 26
 {
27
-	private $_template = '';
28
-	private $_lineNumber = 0;
29
-	private $_fileName = '';
27
+	private $_template='';
28
+	private $_lineNumber=0;
29
+	private $_fileName='';
30 30
 
31 31
 	/**
32 32
 	 * @return string the template source code that causes the exception. This is empty if {@link getTemplateFile TemplateFile} is not empty.
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function setTemplateSource($value)
43 43
 	{
44
-		$this->_template = $value;
44
+		$this->_template=$value;
45 45
 	}
46 46
 
47 47
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function setTemplateFile($value)
59 59
 	{
60
-		$this->_fileName = $value;
60
+		$this->_fileName=$value;
61 61
 	}
62 62
 
63 63
 	/**
@@ -73,6 +73,6 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function setLineNumber($value)
75 75
 	{
76
-		$this->_lineNumber = TPropertyValue::ensureInteger($value);
76
+		$this->_lineNumber=TPropertyValue::ensureInteger($value);
77 77
 	}
78 78
 }
Please login to merge, or discard this patch.
framework/Exceptions/TException.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
  */
38 38
 class TException extends \Exception
39 39
 {
40
-	private $_errorCode = '';
41
-	protected static $_messageCache = [];
40
+	private $_errorCode='';
41
+	protected static $_messageCache=[];
42 42
 
43 43
 	/**
44 44
 	 * Constructor.
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function __construct($errorMessage)
51 51
 	{
52
-		$this->_errorCode = $errorMessage;
53
-		$errorMessage = $this->translateErrorMessage($errorMessage);
54
-		$args = func_get_args();
52
+		$this->_errorCode=$errorMessage;
53
+		$errorMessage=$this->translateErrorMessage($errorMessage);
54
+		$args=func_get_args();
55 55
 		array_shift($args);
56
-		$n = count($args);
57
-		$tokens = [];
58
-		for($i = 0;$i < $n;++$i)
59
-			$tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]);
56
+		$n=count($args);
57
+		$tokens=[];
58
+		for($i=0; $i < $n; ++$i)
59
+			$tokens['{'.$i.'}']=TPropertyValue::ensureString($args[$i]);
60 60
 		parent::__construct(strtr($errorMessage, $tokens));
61 61
 	}
62 62
 
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	protected function translateErrorMessage($key)
69 69
 	{
70
-		$msgFile = $this->getErrorMessageFile();
70
+		$msgFile=$this->getErrorMessageFile();
71 71
 
72 72
 		// Cache messages
73
-		if (!isset(self::$_messageCache[$msgFile]))
73
+		if(!isset(self::$_messageCache[$msgFile]))
74 74
 		{
75
-			if(($entries = @file($msgFile)) !== false)
75
+			if(($entries=@file($msgFile))!==false)
76 76
 			{
77 77
 				foreach($entries as $entry)
78 78
 				{
79
-					list($code, $message) = array_merge(explode('=', $entry, 2), [ '' ]);
80
-					self::$_messageCache[$msgFile][trim($code)] = trim($message);
79
+					list($code, $message)=array_merge(explode('=', $entry, 2), ['']);
80
+					self::$_messageCache[$msgFile][trim($code)]=trim($message);
81 81
 				}
82 82
 			}
83 83
 		}
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	protected function getErrorMessageFile()
91 91
 	{
92
-		$lang = Prado::getPreferredLanguage();
93
-		$msgFile = Prado::getFrameworkPath() . '/Exceptions/messages/messages-' . $lang . '.txt';
92
+		$lang=Prado::getPreferredLanguage();
93
+		$msgFile=Prado::getFrameworkPath().'/Exceptions/messages/messages-'.$lang.'.txt';
94 94
 		if(!is_file($msgFile))
95
-			$msgFile = Prado::getFrameworkPath() . '/Exceptions/messages/messages.txt';
95
+			$msgFile=Prado::getFrameworkPath().'/Exceptions/messages/messages.txt';
96 96
 		return $msgFile;
97 97
 	}
98 98
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function setErrorCode($code)
111 111
 	{
112
-		$this->_errorCode = $code;
112
+		$this->_errorCode=$code;
113 113
 	}
114 114
 
115 115
 	/**
@@ -125,6 +125,6 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function setErrorMessage($message)
127 127
 	{
128
-		$this->message = $message;
128
+		$this->message=$message;
129 129
 	}
130 130
 }
Please login to merge, or discard this patch.
framework/Exceptions/TPhpErrorException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function __construct($errno, $errstr, $errfile, $errline)
34 34
 	{
35
-		static $errorTypes = [
35
+		static $errorTypes=[
36 36
 			E_ERROR => "Error",
37 37
 			E_WARNING => "Warning",
38 38
 			E_PARSE => "Parsing Error",
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 			E_USER_NOTICE => "User Notice",
47 47
 			E_STRICT => "Runtime Notice"
48 48
 		];
49
-		$errorType = isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error';
49
+		$errorType=isset($errorTypes[$errno]) ? $errorTypes[$errno] : 'Unknown Error';
50 50
 		parent::__construct("[$errorType] $errstr (@line $errline in file $errfile).");
51 51
 	}
52 52
 
Please login to merge, or discard this patch.