数组定义规范统一

This commit is contained in:
thinkphp
2013-04-01 11:03:19 +08:00
parent 668aca97c8
commit 6f5db51323
33 changed files with 87 additions and 87 deletions

View File

@@ -28,7 +28,7 @@ class Apc {
* @param array $options 缓存参数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if(!function_exists('apc_cache_info')) {
throw New Exception('_NOT_SUPPERT_:Apc');
}
@@ -65,7 +65,7 @@ class Apc {
// 记录缓存队列
$queue = apc_fetch('__info__');
if(!$queue) {
$queue = array();
$queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {

View File

@@ -36,7 +36,7 @@ class Db {
* @param array $options 缓存参数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}
@@ -101,7 +101,7 @@ class Db {
$queue = xcache_get('__info__');
if(!$result) {
$this->handler->execute('INSERT INTO '.$this->options['table'].' (`cachekey`,`data`,`expire`) VALUES (\'__info__\',\'\',0)');
$queue = array();
$queue = [];
}else{
$queue = unserialize($result[0]['data']);
}

View File

@@ -26,7 +26,7 @@ class Eaccelerator {
* @param array $options 缓存参数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}
@@ -61,7 +61,7 @@ class Eaccelerator {
// 记录缓存队列
$queue = eaccelerator_get('__info__');
if(!$queue) {
$queue = array();
$queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {

View File

@@ -29,7 +29,7 @@ class File {
* 架构函数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}
@@ -133,7 +133,7 @@ class File {
$queue_file = dirname($filename).'/__info__.php';
$queue = unserialize(file_get_contents($queue_file));
if(!$queue) {
$queue = array();
$queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {

View File

@@ -29,7 +29,7 @@ class Memcache {
* @param array $options 缓存参数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if ( !extension_loaded('memcache') ) {
throw new Exception('_NOT_SUPPERT_:memcache');
}
@@ -71,7 +71,7 @@ class Memcache {
// 记录缓存队列
$queue = $this->handler->get('__info__');
if(!$queue) {
$queue = array();
$queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {

View File

@@ -30,7 +30,7 @@ class Redis {
* @param array $options 缓存参数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if ( !extension_loaded('redis') ) {
throw new Exception('_NOT_SUPPERT_:redis');
}
@@ -77,7 +77,7 @@ class Redis {
// 记录缓存队列
$queue = $this->handler->get('__info__');
if(!$queue) {
$queue = array();
$queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {

View File

@@ -29,7 +29,7 @@ class Secache {
* @param array $options 缓存参数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}
@@ -67,7 +67,7 @@ class Secache {
// 记录缓存队列
$queue = $this->handler->fetch(md5('__info__'));
if(!$queue) {
$queue = array();
$queue = [];
}
if(false===array_search($key, $queue)) array_push($queue,$key);
if(count($queue) > $this->options['length']) {
@@ -669,7 +669,7 @@ class secache{
}
function _all_schemas(){
$schema = array();
$schema = [];
for($i=0;$i<16;$i++){
$this->_seek(60+$i*$this->schema_item_size);
$info = unpack('V1'.implode('/V1',$this->schema_struct),fread($this->_rs,$this->schema_item_size));
@@ -683,7 +683,7 @@ class secache{
}
function schemaStatus(){
$return = array();
$return = [];
foreach($this->_all_schemas() as $k=>$schemaItem){
if($schemaItem['free']){
$this->_dfollow($schemaItem['free'],$schemaItem['freecount']);

View File

@@ -24,7 +24,7 @@ class Simple {
* 架构函数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if(!empty($options)) {
$this->options = array_merge($this->options,$options);
}

View File

@@ -29,7 +29,7 @@ class Sqlite {
* @param array $options 缓存参数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if ( !extension_loaded('sqlite') ) {
throw new Exception('_NOT_SUPPERT_:sqlite');
}

View File

@@ -26,7 +26,7 @@ class Wincache {
* @param array $options 缓存参数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if ( !function_exists('wincache_ucache_info') ) {
throw new Exception('_NOT_SUPPERT_:WinCache');
}
@@ -64,7 +64,7 @@ class Wincache {
// 记录缓存队列
$queue = wincache_ucache_get('__info__');
if(!$queue) {
$queue = array();
$queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {

View File

@@ -26,7 +26,7 @@ class Xcache {
* @param array $options 缓存参数
* @access public
*/
public function __construct($options=array()) {
public function __construct($options=[]) {
if ( !function_exists('xcache_info') ) {
throw new Exception('_NOT_SUPPERT_:Xcache');
}
@@ -67,7 +67,7 @@ class Xcache {
// 记录缓存队列
$queue = xcache_get('__info__');
if(!$queue) {
$queue = array();
$queue = [];
}
if(false===array_search($name, $queue)) array_push($queue,$name);
if(count($queue) > $this->options['length']) {