@@ -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 | /** |
@@ -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 |
@@ -59,17 +59,17 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * @var string the etcd host |
| 61 | 61 | */ |
| 62 | - protected $_host = 'localhost'; |
|
| 62 | + protected $_host='localhost'; |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * @var integer the etcd port |
| 66 | 66 | */ |
| 67 | - protected $_port = 2379; |
|
| 67 | + protected $_port=2379; |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @var string the directory to store values in |
| 71 | 71 | */ |
| 72 | - protected $_dir = 'pradocache'; |
|
| 72 | + protected $_dir='pradocache'; |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * Initializes this module. |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function init($config) |
| 81 | 81 | { |
| 82 | - if (!function_exists('curl_version')) throw new TConfigurationException('curl_extension_required'); |
|
| 82 | + if(!function_exists('curl_version')) throw new TConfigurationException('curl_extension_required'); |
|
| 83 | 83 | parent::init($config); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param string $value the etcd host |
| 97 | 97 | */ |
| 98 | 98 | public function setHost($value) { |
| 99 | - $this->_host = TPropertyValue::ensureString($value); |
|
| 99 | + $this->_host=TPropertyValue::ensureString($value); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @param integer $value the etcd port |
| 113 | 113 | */ |
| 114 | 114 | public function setPort($value) { |
| 115 | - $this->_port = TPropertyValue::ensureInteger($value); |
|
| 115 | + $this->_port=TPropertyValue::ensureInteger($value); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param string $value the directory to store values in |
| 129 | 129 | */ |
| 130 | 130 | public function setDir($value) { |
| 131 | - $this->_dir = TPropertyValue::ensureString($value); |
|
| 131 | + $this->_dir=TPropertyValue::ensureString($value); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | protected function getValue($key) |
| 141 | 141 | { |
| 142 | - $result = $this->request('GET', $this->_dir . '/' . $key); |
|
| 142 | + $result=$this->request('GET', $this->_dir.'/'.$key); |
|
| 143 | 143 | return property_exists($result, 'errorCode') ? false : unserialize($result->node->value); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | protected function setValue($key, $value, $expire) |
| 156 | 156 | { |
| 157 | - $value = ['value' => serialize($value)]; |
|
| 158 | - if ($expire > 0) $value['ttl'] = $expire; |
|
| 159 | - $result = $this->request('PUT', $this->_dir . '/' . $key, $value); |
|
| 157 | + $value=['value' => serialize($value)]; |
|
| 158 | + if($expire > 0) $value['ttl']=$expire; |
|
| 159 | + $result=$this->request('PUT', $this->_dir.'/'.$key, $value); |
|
| 160 | 160 | return !property_exists($result, 'errorCode'); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | protected function addValue($key, $value, $expire) |
| 173 | 173 | { |
| 174 | - $value = ['value' => serialize($value), 'prevExist' => 'false']; |
|
| 175 | - if ($expire > 0) $value['ttl'] = $expire; |
|
| 176 | - $result = $this->request('PUT', $this->_dir . '/' . $key, $value); |
|
| 174 | + $value=['value' => serialize($value), 'prevExist' => 'false']; |
|
| 175 | + if($expire > 0) $value['ttl']=$expire; |
|
| 176 | + $result=$this->request('PUT', $this->_dir.'/'.$key, $value); |
|
| 177 | 177 | return !property_exists($result, 'errorCode'); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | protected function deleteValue($key) |
| 187 | 187 | { |
| 188 | - $this->request('DELETE', $this->_dir . '/' . $key); |
|
| 188 | + $this->request('DELETE', $this->_dir.'/'.$key); |
|
| 189 | 189 | return true; |
| 190 | 190 | } |
| 191 | 191 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function flush() |
| 197 | 197 | { |
| 198 | - $this->request('DELETE', $this->_dir . '?recursive=true'); |
|
| 198 | + $this->request('DELETE', $this->_dir.'?recursive=true'); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -208,15 +208,15 @@ discard block |
||
| 208 | 208 | * @param array the additional post data to send with the request |
| 209 | 209 | * @return \stdClass the response from the etcd instance |
| 210 | 210 | */ |
| 211 | - protected function request($method, $key, $value = []) { |
|
| 212 | - $curl = curl_init("http://{$this->_host}:{$this->_port}/v2/keys/{$key}"); |
|
| 211 | + protected function request($method, $key, $value=[]) { |
|
| 212 | + $curl=curl_init("http://{$this->_host}:{$this->_port}/v2/keys/{$key}"); |
|
| 213 | 213 | curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); |
| 214 | 214 | curl_setopt($curl, CURLOPT_HEADER, false); |
| 215 | 215 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
| 216 | 216 | curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); |
| 217 | 217 | curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']); |
| 218 | 218 | curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($value)); |
| 219 | - $response = curl_exec($curl); |
|
| 219 | + $response=curl_exec($curl); |
|
| 220 | 220 | curl_close($curl); |
| 221 | 221 | return json_decode($response); |
| 222 | 222 | } |
@@ -35,8 +35,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -51,7 +51,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -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 | /** |