@@ -110,13 +110,13 @@ |
||
110 | 110 | /** |
111 | 111 | * Factory method to instantiate a new MessageSource depending on the |
112 | 112 | * source type. The allowed source types are 'XLIFF', 'PHP', 'gettext' and |
113 | - * 'Database'. The source parameter depends on the source type. |
|
114 | - * For 'gettext', 'PHP' and 'XLIFF', 'source' should point to the directory |
|
115 | - * where the messages are stored. |
|
116 | - * For 'Database', 'source' must be a valid connection id. |
|
113 | + * 'Database'. The source parameter depends on the source type. |
|
114 | + * For 'gettext', 'PHP' and 'XLIFF', 'source' should point to the directory |
|
115 | + * where the messages are stored. |
|
116 | + * For 'Database', 'source' must be a valid connection id. |
|
117 | 117 | * |
118 | - * Custom message source are possible by supplying the a filename parameter |
|
119 | - * in the factory method. |
|
118 | + * Custom message source are possible by supplying the a filename parameter |
|
119 | + * in the factory method. |
|
120 | 120 | * |
121 | 121 | * @param string the message source type. |
122 | 122 | * @param string the location of the resource or the ConnectionID. |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | /** |
84 | 84 | * The DateTimeFormatInfo, containing culture specific patterns and names. |
85 | - * @var DateTimeFormatInfo |
|
85 | + * @var DateTimeFormatInfo |
|
86 | 86 | */ |
87 | 87 | protected $formatInfo; |
88 | 88 | |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Get the year. |
313 | - * "yy" will return the last two digits of year. |
|
314 | - * "yyyy" will return the full integer year. |
|
313 | + * "yy" will return the last two digits of year. |
|
314 | + * "yyyy" will return the full integer year. |
|
315 | 315 | * @param array getdate format. |
316 | 316 | * @param string a pattern. |
317 | 317 | * @return string year |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | |
332 | 332 | /** |
333 | 333 | * Get the month. |
334 | - * "M" will return integer 1 through 12 |
|
335 | - * "MM" will return the narrow month name, e.g. "J" |
|
336 | - * "MMM" will return the abrreviated month name, e.g. "Jan" |
|
337 | - * "MMMM" will return the month name, e.g. "January" |
|
334 | + * "M" will return integer 1 through 12 |
|
335 | + * "MM" will return the narrow month name, e.g. "J" |
|
336 | + * "MMM" will return the abrreviated month name, e.g. "Jan" |
|
337 | + * "MMMM" will return the month name, e.g. "January" |
|
338 | 338 | * @param array getdate format. |
339 | 339 | * @param string a pattern. |
340 | 340 | * @return string month name |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | |
359 | 359 | /** |
360 | 360 | * Get the day of the week. |
361 | - * "E" will return integer 0 (for Sunday) through 6 (for Saturday). |
|
362 | - * "EE" will return the narrow day of the week, e.g. "M" |
|
363 | - * "EEE" will return the abrreviated day of the week, e.g. "Mon" |
|
364 | - * "EEEE" will return the day of the week, e.g. "Monday" |
|
361 | + * "E" will return integer 0 (for Sunday) through 6 (for Saturday). |
|
362 | + * "EE" will return the narrow day of the week, e.g. "M" |
|
363 | + * "EEE" will return the abrreviated day of the week, e.g. "Mon" |
|
364 | + * "EEEE" will return the day of the week, e.g. "Monday" |
|
365 | 365 | * @param array getdate format. |
366 | 366 | * @param string a pattern. |
367 | 367 | * @return string day of the week. |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | /** |
388 | 388 | * Get the day of the month. |
389 | - * "d" for non-padding, "dd" will always return 2 characters. |
|
389 | + * "d" for non-padding, "dd" will always return 2 characters. |
|
390 | 390 | * @param array getdate format. |
391 | 391 | * @param string a pattern. |
392 | 392 | * @return string day of the month |
@@ -558,12 +558,12 @@ discard block |
||
558 | 558 | protected function getDayInMonth($date, $pattern='FF') |
559 | 559 | { |
560 | 560 | switch ($pattern) { |
561 | - case 'F': |
|
562 | - return $date->format('j'); |
|
563 | - case 'FF': |
|
564 | - return $date->format('d'); |
|
565 | - default: |
|
566 | - throw new Exception('The pattern for day in month is "F" or "FF".'); |
|
561 | + case 'F': |
|
562 | + return $date->format('j'); |
|
563 | + case 'FF': |
|
564 | + return $date->format('d'); |
|
565 | + default: |
|
566 | + throw new Exception('The pattern for day in month is "F" or "FF".'); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | */ |
106 | 106 | private $_port=11211; |
107 | 107 | |
108 | - private $_timeout = 360; |
|
108 | + private $_timeout = 360; |
|
109 | 109 | |
110 | 110 | /** |
111 | - * @var integer Controls the minimum value length before attempting to compress automatically. |
|
112 | - */ |
|
113 | - private $_threshold=0; |
|
111 | + * @var integer Controls the minimum value length before attempting to compress automatically. |
|
112 | + */ |
|
113 | + private $_threshold=0; |
|
114 | 114 | |
115 | 115 | /** |
116 | - * @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. |
|
117 | - */ |
|
118 | - private $_minSavings=0.0; |
|
116 | + * @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. |
|
117 | + */ |
|
118 | + private $_minSavings=0.0; |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * @var boolean whether to use memcached or memcache as the underlying caching extension. |
@@ -159,63 +159,63 @@ discard block |
||
159 | 159 | $this->_cache = $this->_useMemcached ? new Memcached : new Memcache; |
160 | 160 | $this->loadConfig($config); |
161 | 161 | if(count($this->_servers)) |
162 | - { |
|
163 | - foreach($this->_servers as $server) |
|
164 | - { |
|
165 | - Prado::trace('Adding server '.$server['Host'].' from serverlist', '\Prado\Caching\TMemCache'); |
|
166 | - if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'], |
|
167 | - $server['Weight'],$server['Timeout'],$server['RetryInterval'])===false) |
|
168 | - throw new TConfigurationException('memcache_connection_failed',$server['Host'],$server['Port']); |
|
169 | - } |
|
170 | - } |
|
171 | - else |
|
172 | - { |
|
173 | - Prado::trace('Adding server '.$this->_host, '\Prado\Caching\TMemCache'); |
|
174 | - if($this->_cache->addServer($this->_host,$this->_port)===false) |
|
175 | - throw new TConfigurationException('memcache_connection_failed',$this->_host,$this->_port); |
|
176 | - } |
|
162 | + { |
|
163 | + foreach($this->_servers as $server) |
|
164 | + { |
|
165 | + Prado::trace('Adding server '.$server['Host'].' from serverlist', '\Prado\Caching\TMemCache'); |
|
166 | + if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'], |
|
167 | + $server['Weight'],$server['Timeout'],$server['RetryInterval'])===false) |
|
168 | + throw new TConfigurationException('memcache_connection_failed',$server['Host'],$server['Port']); |
|
169 | + } |
|
170 | + } |
|
171 | + else |
|
172 | + { |
|
173 | + Prado::trace('Adding server '.$this->_host, '\Prado\Caching\TMemCache'); |
|
174 | + if($this->_cache->addServer($this->_host,$this->_port)===false) |
|
175 | + throw new TConfigurationException('memcache_connection_failed',$this->_host,$this->_port); |
|
176 | + } |
|
177 | 177 | if($this->_threshold!==0) |
178 | - $this->_cache->setCompressThreshold($this->_threshold,$this->_minSavings); |
|
178 | + $this->_cache->setCompressThreshold($this->_threshold,$this->_minSavings); |
|
179 | 179 | $this->_initialized=true; |
180 | 180 | parent::init($config); |
181 | 181 | } |
182 | 182 | |
183 | - /** |
|
183 | + /** |
|
184 | 184 | * Loads configuration from an XML element |
185 | 185 | * @param TXmlElement configuration node |
186 | 186 | * @throws TConfigurationException if log route class or type is not specified |
187 | 187 | */ |
188 | 188 | private function loadConfig($xml) |
189 | 189 | { |
190 | - if($xml instanceof TXmlElement) |
|
190 | + if($xml instanceof TXmlElement) |
|
191 | 191 | { |
192 | - foreach($xml->getElementsByTagName('server') as $serverConfig) |
|
193 | - { |
|
194 | - $properties=$serverConfig->getAttributes(); |
|
195 | - if(($host=$properties->remove('Host'))===null) |
|
196 | - throw new TConfigurationException('memcache_serverhost_required'); |
|
197 | - if(($port=$properties->remove('Port'))===null) |
|
198 | - throw new TConfigurationException('memcache_serverport_required'); |
|
199 | - if(!is_numeric($port)) |
|
200 | - throw new TConfigurationException('memcache_serverport_invalid'); |
|
201 | - $server = array('Host'=>$host,'Port'=>$port,'Weight'=>1,'Timeout'=>1800,'RetryInterval'=>15,'Persistent'=>true); |
|
202 | - $checks = array( |
|
203 | - 'Weight'=>'memcache_serverweight_invalid', |
|
204 | - 'Timeout'=>'memcache_servertimeout_invalid', |
|
205 | - 'RetryInterval'=>'memcach_serverretryinterval_invalid' |
|
206 | - ); |
|
207 | - foreach($checks as $property=>$exception) |
|
208 | - { |
|
209 | - $value=$properties->remove($property); |
|
210 | - if($value!==null && is_numeric($value)) |
|
211 | - $server[$property]=$value; |
|
212 | - else if($value!==null) |
|
213 | - throw new TConfigurationException($exception); |
|
214 | - } |
|
215 | - $server['Persistent']= TPropertyValue::ensureBoolean($properties->remove('Persistent')); |
|
216 | - $this->_servers[]=$server; |
|
217 | - } |
|
218 | - } |
|
192 | + foreach($xml->getElementsByTagName('server') as $serverConfig) |
|
193 | + { |
|
194 | + $properties=$serverConfig->getAttributes(); |
|
195 | + if(($host=$properties->remove('Host'))===null) |
|
196 | + throw new TConfigurationException('memcache_serverhost_required'); |
|
197 | + if(($port=$properties->remove('Port'))===null) |
|
198 | + throw new TConfigurationException('memcache_serverport_required'); |
|
199 | + if(!is_numeric($port)) |
|
200 | + throw new TConfigurationException('memcache_serverport_invalid'); |
|
201 | + $server = array('Host'=>$host,'Port'=>$port,'Weight'=>1,'Timeout'=>1800,'RetryInterval'=>15,'Persistent'=>true); |
|
202 | + $checks = array( |
|
203 | + 'Weight'=>'memcache_serverweight_invalid', |
|
204 | + 'Timeout'=>'memcache_servertimeout_invalid', |
|
205 | + 'RetryInterval'=>'memcach_serverretryinterval_invalid' |
|
206 | + ); |
|
207 | + foreach($checks as $property=>$exception) |
|
208 | + { |
|
209 | + $value=$properties->remove($property); |
|
210 | + if($value!==null && is_numeric($value)) |
|
211 | + $server[$property]=$value; |
|
212 | + else if($value!==null) |
|
213 | + throw new TConfigurationException($exception); |
|
214 | + } |
|
215 | + $server['Persistent']= TPropertyValue::ensureBoolean($properties->remove('Persistent')); |
|
216 | + $this->_servers[]=$server; |
|
217 | + } |
|
218 | + } |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |