@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * @var boolean if the module is initialized |
| 94 | 94 | */ |
| 95 | - private $_initialized = false; |
|
| 95 | + private $_initialized=false; |
|
| 96 | 96 | /** |
| 97 | 97 | * @var Memcache the Memcache instance |
| 98 | 98 | */ |
@@ -100,23 +100,23 @@ discard block |
||
| 100 | 100 | /** |
| 101 | 101 | * @var string host name of the memcache server |
| 102 | 102 | */ |
| 103 | - private $_host = 'localhost'; |
|
| 103 | + private $_host='localhost'; |
|
| 104 | 104 | /** |
| 105 | 105 | * @var integer the port number of the memcache server |
| 106 | 106 | */ |
| 107 | - private $_port = 11211; |
|
| 107 | + private $_port=11211; |
|
| 108 | 108 | |
| 109 | - private $_timeout = 360; |
|
| 109 | + private $_timeout=360; |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * @var integer Controls the minimum value length before attempting to compress automatically. |
| 113 | 113 | */ |
| 114 | - private $_threshold = 0; |
|
| 114 | + private $_threshold=0; |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * @var float Specifies the minimum amount of savings to actually store the value compressed. The supplied value must be between 0 and 1. Default value is 0.2 giving a minimum 20% compression savings. |
| 118 | 118 | */ |
| 119 | - private $_minSavings = 0.0; |
|
| 119 | + private $_minSavings=0.0; |
|
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * @var boolean whether to use memcached or memcache as the underlying caching extension. |
@@ -124,12 +124,12 @@ discard block |
||
| 124 | 124 | * If false {@link http://pecl.php.net/package/memcache memcache}. will be used. |
| 125 | 125 | * Defaults to false. |
| 126 | 126 | */ |
| 127 | - private $_useMemcached = false; |
|
| 127 | + private $_useMemcached=false; |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * @var array list of servers available |
| 131 | 131 | */ |
| 132 | - private $_servers = []; |
|
| 132 | + private $_servers=[]; |
|
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Destructor. |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function __destruct() |
| 139 | 139 | { |
| 140 | - if($this->_cache !== null && !$this->_useMemcached) |
|
| 140 | + if($this->_cache!==null && !$this->_useMemcached) |
|
| 141 | 141 | $this->_cache->close(); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -157,27 +157,27 @@ discard block |
||
| 157 | 157 | if(!extension_loaded('memcached') && $this->_useMemcached) |
| 158 | 158 | throw new TConfigurationException('memcached_extension_required'); |
| 159 | 159 | |
| 160 | - $this->_cache = $this->_useMemcached ? new Memcached : new Memcache; |
|
| 160 | + $this->_cache=$this->_useMemcached ? new Memcached : new Memcache; |
|
| 161 | 161 | $this->loadConfig($config); |
| 162 | 162 | if(count($this->_servers)) |
| 163 | 163 | { |
| 164 | 164 | foreach($this->_servers as $server) |
| 165 | 165 | { |
| 166 | - Prado::trace('Adding server ' . $server['Host'] . ' from serverlist', '\Prado\Caching\TMemCache'); |
|
| 167 | - if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'], |
|
| 168 | - $server['Weight'], $server['Timeout'], $server['RetryInterval']) === false) |
|
| 166 | + Prado::trace('Adding server '.$server['Host'].' from serverlist', '\Prado\Caching\TMemCache'); |
|
| 167 | + if($this->_cache->addServer($server['Host'], $server['Port'], $server['Persistent'], |
|
| 168 | + $server['Weight'], $server['Timeout'], $server['RetryInterval'])===false) |
|
| 169 | 169 | throw new TConfigurationException('memcache_connection_failed', $server['Host'], $server['Port']); |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | else |
| 173 | 173 | { |
| 174 | - Prado::trace('Adding server ' . $this->_host, '\Prado\Caching\TMemCache'); |
|
| 175 | - if($this->_cache->addServer($this->_host, $this->_port) === false) |
|
| 174 | + Prado::trace('Adding server '.$this->_host, '\Prado\Caching\TMemCache'); |
|
| 175 | + if($this->_cache->addServer($this->_host, $this->_port)===false) |
|
| 176 | 176 | throw new TConfigurationException('memcache_connection_failed', $this->_host, $this->_port); |
| 177 | 177 | } |
| 178 | - if($this->_threshold !== 0) |
|
| 178 | + if($this->_threshold!==0) |
|
| 179 | 179 | $this->_cache->setCompressThreshold($this->_threshold, $this->_minSavings); |
| 180 | - $this->_initialized = true; |
|
| 180 | + $this->_initialized=true; |
|
| 181 | 181 | parent::init($config); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -192,29 +192,29 @@ discard block |
||
| 192 | 192 | { |
| 193 | 193 | foreach($xml->getElementsByTagName('server') as $serverConfig) |
| 194 | 194 | { |
| 195 | - $properties = $serverConfig->getAttributes(); |
|
| 196 | - if(($host = $properties->remove('Host')) === null) |
|
| 195 | + $properties=$serverConfig->getAttributes(); |
|
| 196 | + if(($host=$properties->remove('Host'))===null) |
|
| 197 | 197 | throw new TConfigurationException('memcache_serverhost_required'); |
| 198 | - if(($port = $properties->remove('Port')) === null) |
|
| 198 | + if(($port=$properties->remove('Port'))===null) |
|
| 199 | 199 | throw new TConfigurationException('memcache_serverport_required'); |
| 200 | 200 | if(!is_numeric($port)) |
| 201 | 201 | throw new TConfigurationException('memcache_serverport_invalid'); |
| 202 | - $server = ['Host' => $host,'Port' => $port,'Weight' => 1,'Timeout' => 1800,'RetryInterval' => 15,'Persistent' => true]; |
|
| 203 | - $checks = [ |
|
| 202 | + $server=['Host' => $host, 'Port' => $port, 'Weight' => 1, 'Timeout' => 1800, 'RetryInterval' => 15, 'Persistent' => true]; |
|
| 203 | + $checks=[ |
|
| 204 | 204 | 'Weight' => 'memcache_serverweight_invalid', |
| 205 | 205 | 'Timeout' => 'memcache_servertimeout_invalid', |
| 206 | 206 | 'RetryInterval' => 'memcach_serverretryinterval_invalid' |
| 207 | 207 | ]; |
| 208 | 208 | foreach($checks as $property => $exception) |
| 209 | 209 | { |
| 210 | - $value = $properties->remove($property); |
|
| 211 | - if($value !== null && is_numeric($value)) |
|
| 212 | - $server[$property] = $value; |
|
| 213 | - elseif($value !== null) |
|
| 210 | + $value=$properties->remove($property); |
|
| 211 | + if($value!==null && is_numeric($value)) |
|
| 212 | + $server[$property]=$value; |
|
| 213 | + elseif($value!==null) |
|
| 214 | 214 | throw new TConfigurationException($exception); |
| 215 | 215 | } |
| 216 | - $server['Persistent'] = TPropertyValue::ensureBoolean($properties->remove('Persistent')); |
|
| 217 | - $this->_servers[] = $server; |
|
| 216 | + $server['Persistent']=TPropertyValue::ensureBoolean($properties->remove('Persistent')); |
|
| 217 | + $this->_servers[]=$server; |
|
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | if($this->_initialized) |
| 237 | 237 | throw new TInvalidOperationException('memcache_host_unchangeable'); |
| 238 | 238 | else |
| 239 | - $this->_host = $value; |
|
| 239 | + $this->_host=$value; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | if($this->_initialized) |
| 257 | 257 | throw new TInvalidOperationException('memcache_port_unchangeable'); |
| 258 | 258 | else |
| 259 | - $this->_port = TPropertyValue::ensureInteger($value); |
|
| 259 | + $this->_port=TPropertyValue::ensureInteger($value); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | if($this->_initialized) |
| 277 | 277 | throw new TInvalidOperationException('memcache_host_unchangeable'); |
| 278 | 278 | else |
| 279 | - $this->_useMemcached = $value; |
|
| 279 | + $this->_useMemcached=$value; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | if($this->_initialized) |
| 297 | 297 | throw new TInvalidOperationException('memcache_threshold_unchangeable'); |
| 298 | 298 | else |
| 299 | - $this->_threshold = TPropertyValue::ensureInteger($value); |
|
| 299 | + $this->_threshold=TPropertyValue::ensureInteger($value); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | if($this->_initialized) |
| 317 | 317 | throw new TInvalidOperationException('memcache_min_savings_unchangeable'); |
| 318 | 318 | else |
| 319 | - $this->_minSavings = TPropertyValue::ensureFloat($value); |
|
| 319 | + $this->_minSavings=TPropertyValue::ensureFloat($value); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -168,8 +168,7 @@ |
||
| 168 | 168 | $server['Weight'], $server['Timeout'], $server['RetryInterval']) === false) |
| 169 | 169 | throw new TConfigurationException('memcache_connection_failed', $server['Host'], $server['Port']); |
| 170 | 170 | } |
| 171 | - } |
|
| 172 | - else |
|
| 171 | + } else |
|
| 173 | 172 | { |
| 174 | 173 | Prado::trace('Adding server ' . $this->_host, '\Prado\Caching\TMemCache'); |
| 175 | 174 | if($this->_cache->addServer($this->_host, $this->_port) === false) |
@@ -39,6 +39,6 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | public function getHasChanged() |
| 41 | 41 | { |
| 42 | - return Prado::getApplication()->getMode() !== TApplicationMode::Performance; |
|
| 42 | + return Prado::getApplication()->getMode()!==TApplicationMode::Performance; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function getDependencies() |
| 38 | 38 | { |
| 39 | - if($this->_dependencies === null) |
|
| 40 | - $this->_dependencies = new TCacheDependencyList; |
|
| 39 | + if($this->_dependencies===null) |
|
| 40 | + $this->_dependencies=new TCacheDependencyList; |
|
| 41 | 41 | return $this->_dependencies; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getHasChanged() |
| 51 | 51 | { |
| 52 | - if($this->_dependencies !== null) |
|
| 52 | + if($this->_dependencies!==null) |
|
| 53 | 53 | { |
| 54 | 54 | foreach($this->_dependencies as $dependency) |
| 55 | 55 | if($dependency->getHasChanged()) |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | if(!function_exists('xcache_isset')) |
| 57 | 57 | throw new TConfigurationException('xcache_extension_required'); |
| 58 | 58 | |
| 59 | - $enabled = (int)ini_get('xcache.cacher') !== 0; |
|
| 60 | - $var_size = (int)ini_get('xcache.var_size'); |
|
| 59 | + $enabled=(int) ini_get('xcache.cacher')!==0; |
|
| 60 | + $var_size=(int) ini_get('xcache.var_size'); |
|
| 61 | 61 | |
| 62 | 62 | if(!($enabled && $var_size > 0)) |
| 63 | 63 | throw new TConfigurationException('xcache_extension_not_enabled'); |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function flush() |
| 123 | 123 | { |
| 124 | - for($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) |
|
| 124 | + for($i=0, $max=xcache_count(XC_TYPE_VAR); $i < $max; $i++) |
|
| 125 | 125 | { |
| 126 | - if(xcache_clear_cache(XC_TYPE_VAR, $i) === false) |
|
| 126 | + if(xcache_clear_cache(XC_TYPE_VAR, $i)===false) |
|
| 127 | 127 | return false; |
| 128 | 128 | } |
| 129 | 129 | return true; |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function setStateName($value) |
| 55 | 55 | { |
| 56 | - $this->_stateName = $value; |
|
| 57 | - $this->_stateValue = Prado::getApplication()->getGlobalState($value); |
|
| 56 | + $this->_stateName=$value; |
|
| 57 | + $this->_stateValue=Prado::getApplication()->getGlobalState($value); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -64,6 +64,6 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function getHasChanged() |
| 66 | 66 | { |
| 67 | - return $this->_stateValue !== Prado::getApplication()->getGlobalState($this->_stateName); |
|
| 67 | + return $this->_stateValue!==Prado::getApplication()->getGlobalState($this->_stateName); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -160,8 +160,7 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | $am = self::$_application->getAssetManager(); |
| 162 | 162 | $url = $am->publishFilePath(self::getPathOfNamespace('Prado\\' . $logoName, '.gif')); |
| 163 | - } |
|
| 164 | - else |
|
| 163 | + } else |
|
| 165 | 164 | $url = 'http://pradosoft.github.io/docs/' . $logoName . '.gif'; |
| 166 | 165 | 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 | 166 | } |
@@ -213,8 +212,7 @@ discard block |
||
| 213 | 212 | if(self::$_application !== null && ($errorHandler = self::$_application->getErrorHandler()) !== null) |
| 214 | 213 | { |
| 215 | 214 | $errorHandler->handleError(null, $exception); |
| 216 | - } |
|
| 217 | - else |
|
| 215 | + } else |
|
| 218 | 216 | { |
| 219 | 217 | echo $exception; |
| 220 | 218 | } |
@@ -328,8 +326,7 @@ discard block |
||
| 328 | 326 | return $component; |
| 329 | 327 | break; |
| 330 | 328 | } |
| 331 | - } |
|
| 332 | - else |
|
| 329 | + } else |
|
| 333 | 330 | return new $type; |
| 334 | 331 | } |
| 335 | 332 | |
@@ -383,8 +380,7 @@ discard block |
||
| 383 | 380 | if($className === '*') // a directory |
| 384 | 381 | { |
| 385 | 382 | self::$_usings[substr($namespace, 0, $pos)] = $path; |
| 386 | - } |
|
| 387 | - else // a file |
|
| 383 | + } else // a file |
|
| 388 | 384 | { |
| 389 | 385 | //self::$_usings[$namespace]=$path; |
| 390 | 386 | if(!$checkClassExistence || (!class_exists($className, false) && !interface_exists($className, false))) |
@@ -394,8 +390,7 @@ discard block |
||
| 394 | 390 | include_once($path); |
| 395 | 391 | if(class_exists($namespace, false) || interface_exists($namespace, false)) |
| 396 | 392 | class_alias($namespace, $className); |
| 397 | - } |
|
| 398 | - catch(\Exception $e) |
|
| 393 | + } catch(\Exception $e) |
|
| 399 | 394 | { |
| 400 | 395 | if($checkClassExistence && !class_exists($className, false)) |
| 401 | 396 | throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage()); |
@@ -471,8 +466,7 @@ discard block |
||
| 471 | 466 | self::$_aliases[$alias] = $rp; |
| 472 | 467 | else |
| 473 | 468 | throw new TInvalidDataValueException('prado_aliasname_invalid', $alias); |
| 474 | - } |
|
| 475 | - else |
|
| 469 | + } else |
|
| 476 | 470 | throw new TInvalidDataValueException('prado_alias_invalid', $alias, $path); |
| 477 | 471 | } |
| 478 | 472 | |
@@ -517,8 +511,7 @@ discard block |
||
| 517 | 511 | echo "'" . substr($str, 0, 70) . "...'"; |
| 518 | 512 | else |
| 519 | 513 | echo "'" . $str . "'"; |
| 520 | - } |
|
| 521 | - elseif (is_int($item) || is_float($item)) |
|
| 514 | + } elseif (is_int($item) || is_float($item)) |
|
| 522 | 515 | echo $item; |
| 523 | 516 | elseif (is_object($item)) |
| 524 | 517 | echo get_class($item); |
@@ -613,8 +606,7 @@ discard block |
||
| 613 | 606 | if(isset($trace[0]['file']) && isset($trace[0]['line'])) |
| 614 | 607 | $msg .= " (line {$trace[0]['line']}, {$trace[0]['file']})"; |
| 615 | 608 | $level = TLogger::DEBUG; |
| 616 | - } |
|
| 617 | - else |
|
| 609 | + } else |
|
| 618 | 610 | $level = TLogger::INFO; |
| 619 | 611 | self::log($msg, $level, $category, $ctl); |
| 620 | 612 | } |
@@ -38,16 +38,16 @@ |
||
| 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 | |
@@ -24,9 +24,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |