CAttributeCollection
鍖 | system.collections |
---|---|
缁ф壙 | class CAttributeCollection » CMap » CComponent |
瀹炵幇 | Countable, ArrayAccess, Traversable, IteratorAggregate |
婧愯嚜 | 1.0 |
鐗堟湰 | $Id: CAttributeCollection.php 3515 2011-12-28 12:29:24Z mdomba $ |
婧愮爜 | framework/collections/CAttributeCollection.php |
闄CMap鎻愪緵鐨勬墍鏈夊姛鑳藉锛孋AttributeCollection 鍏佽浣犲儚getting鍜宻etting灞炴т竴鏍疯幏鍙栧拰璁剧疆 灞炴у笺備緥濡傦紝涓嬮潰鐨勭敤娉曞浜庝竴涓狢AttributeCollection瀵硅薄鏉ヨ锛 閮芥槸鏈夋晥鐨勶細
$collection->text='text'; // 绛変环浜庯細$collection->add('text','text'); echo $collection->text; // 绛変环浜庯細echo $collection->itemAt('text');
灞炴у悕绉扮殑澶у皬鍐欐晱鎰熷彲浠ラ氳繃闆嗗悎鐨 caseSensitive灞炴у紑鍚垨鍏抽棴銆
鍏叡灞炴
灞炴 | 绫诲瀷 | 鎻忚堪 | 瀹氫箟鍦 |
---|---|---|---|
caseSensitive | boolean | 閿悕鏄惁澶у皬鍐欐晱鎰熴傞粯璁や负false銆 | CAttributeCollection |
count | integer | 杩斿洖map涓殑椤圭洰鏁般 | CMap |
iterator | CMapIterator | 杩斿洖閬嶅巻杩欎釜鍒楄〃鐨勯」鐩殑杩唬鍣ㄣ | CMap |
keys | array | 杩斿洖閿悕鍒楄〃 | CMap |
readOnly | boolean | 杩斿洖鍊艰鏄庤繖涓垪琛ㄦ槸鍚︿负鍙銆傞粯璁や负false銆 | CMap |
鍏叡鏂规硶
鏂规硶 | 鎻忚堪 | 瀹氫箟鍦 |
---|---|---|
__call() | 濡傛灉绫讳腑娌℃湁璋冪殑鏂规硶鍚嶏紝鍒欒皟鐢ㄨ繖涓柟娉曘 | CComponent |
__construct() | 鏋勯犳柟娉曘 | CMap |
__get() | 閫氳繃灞炴ф垨浜嬩欢鍚嶈繑鍥炰竴涓睘鎬у兼垨涓涓簨浠跺鐞嗙▼搴忓垪琛ㄣ | CAttributeCollection |
__isset() | 妫娴嬩竴涓睘鎬у兼槸鍚︿负null銆 | CAttributeCollection |
__set() | 璁剧疆涓涓粍浠跺睘鎬х殑鍊笺 | CAttributeCollection |
__unset() | 璁剧疆涓涓粍浠跺睘鎬т负null銆 | CAttributeCollection |
add() | 娣诲姞涓涓」鍒癿ap銆 | CAttributeCollection |
asa() | 杩斿洖杩欎釜鍚嶅瓧鐨勮涓哄璞° | CComponent |
attachBehavior() | 闄勫姞涓涓涓哄埌缁勪欢銆 | CComponent |
attachBehaviors() | 闄勫姞涓涓涓哄垪琛ㄥ埌缁勪欢銆 | CComponent |
attachEventHandler() | 涓轰簨浠堕檮鍔犱竴涓簨浠跺鐞嗙▼搴忋 | CComponent |
canGetProperty() | 纭畾涓涓睘鎬ф槸鍚﹀彲璇汇 | CAttributeCollection |
canSetProperty() | 纭畾涓涓睘鎬ф槸鍚﹀彲璁剧疆銆 | CAttributeCollection |
clear() | 鍒犻櫎map涓墍鏈夐」鐩 | CMap |
contains() | 杩斿洖鍊艰鏄庢寚瀹氱殑椤圭洰鏄惁鍦╩ap涓 | CAttributeCollection |
copyFrom() | 灏嗚凯浠e櫒涓殑鏁版嵁澶嶅埗鍒癿ap銆 | CMap |
count() | 杩斿洖map涓殑椤圭洰鏁般 | CMap |
detachBehavior() | 浠庣粍浠朵腑鍒嗙涓涓涓恒 | CComponent |
detachBehaviors() | 浠庣粍浠朵腑鍒嗙鎵鏈夎涓恒 | CComponent |
detachEventHandler() | 鍒嗙涓涓瓨鍦ㄧ殑浜嬩欢澶勭悊绋嬪簭銆 | CComponent |
disableBehavior() | 绂佺敤涓涓檮鍔犺涓恒 | CComponent |
disableBehaviors() | 绂佺敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 | CComponent |
enableBehavior() | 鍚敤涓涓檮鍔犺涓恒 | CComponent |
enableBehaviors() | 鍚敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 | CComponent |
evaluateExpression() | 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 | CComponent |
getCount() | 杩斿洖map涓殑椤圭洰鏁般 | CMap |
getEventHandlers() | 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 | CComponent |
getIterator() | 杩斿洖閬嶅巻杩欎釜鍒楄〃鐨勯」鐩殑杩唬鍣ㄣ | CMap |
getKeys() | 杩斿洖杩斿洖閿悕鍒楄〃 | CMap |
getReadOnly() | 杩斿洖杩斿洖鍊艰鏄庤繖涓垪琛ㄦ槸鍚︿负鍙銆傞粯璁や负false銆 | CMap |
hasEvent() | 纭畾涓涓簨浠舵槸鍚﹀畾涔夈 | CComponent |
hasEventHandler() | 妫鏌ヤ簨浠舵槸鍚︽湁闄勫姞鐨勫鐞嗙▼搴忋 | CComponent |
hasProperty() | 纭畾鏄惁涓涓睘鎬у凡瀹氫箟銆 | CAttributeCollection |
itemAt() | 杩斿洖鎸囧畾閿殑椤广 | CAttributeCollection |
mergeArray() | 閫掑綊鍚堝苟涓や釜鎴栧涓暟缁勩 | CMap |
mergeWith() | 灏嗚凯浠e櫒鐨勬暟鎹暣鍚堝埌map銆 | CMap |
offsetExists() | 杩斿洖鍊艰鏄庢寚瀹氫綅缃槸鍚﹀瓨鍦ㄥ厓绱犮 | CMap |
offsetGet() | 杩斿洖鍊兼寚瀹氫綅缃殑鍏冪礌銆 | CMap |
offsetSet() | 璁剧疆鎸囧畾浣嶇疆鐨勫厓绱犮 | CMap |
offsetUnset() | 鍒犻櫎鎸囧畾浣嶇疆鐨勫厓绱犮 | CMap |
raiseEvent() | 鍙戣捣涓涓簨浠躲 | CComponent |
remove() | 閫氳繃瀹冪殑閿粠map涓Щ闄や竴涓」鐩 | CAttributeCollection |
toArray() | CMap |
灞炴ц缁
閿悕鏄惁澶у皬鍐欐晱鎰熴傞粯璁や负false銆
鏂规硶璇︾粏
public mixed __get(string $name)
| ||
$name | string | 灞炴у悕鎴栦簨浠跺悕 |
{return} | mixed | 灞炴у兼垨浜嬩欢澶勭悊绋嬪簭鍒楄〃 |
public function __get($name)
{
if($this->contains($name))
return $this->itemAt($name);
else
return parent::__get($name);
}
閫氳繃灞炴ф垨浜嬩欢鍚嶈繑鍥炰竴涓睘鎬у兼垨涓涓簨浠跺鐞嗙▼搴忓垪琛ㄣ 杩欎釜鏂规硶閫氳繃杩斿洖涓涓敭鍊兼槸鍚﹀瓨鍦ㄤ簬闆嗗悎鏉 瑕嗙洊鐖剁被鏂规硶銆
public boolean __isset(string $name)
| ||
$name | string | 灞炴у悕鎴栦簨浠跺悕 |
{return} | boolean | 杩斿洖鍊艰鏄庡睘鎬у兼槸鍚︿负null |
public function __isset($name)
{
if($this->contains($name))
return $this->itemAt($name)!==null;
else
return parent::__isset($name);
}
妫娴嬩竴涓睘鎬у兼槸鍚︿负null銆 杩欎釜鏂规硶閫氳繃妫鏌ラ敭鍚嶆槸鍚﹀瓨鍦ㄤ簬闆嗗悎褰撲腑锛屽苟涓斾负闈瀗ull鍊硷紝杈惧埌 瑕嗙洊鐖剁被鏂规硶瀹炵幇銆
public void __set(string $name, mixed $value)
| ||
$name | string | 灞炴у悕鎴栦簨浠跺悕 |
$value | mixed | 灞炴у兼垨浜嬩欢澶勭悊绋嬪簭 |
public function __set($name,$value)
{
$this->add($name,$value);
}
璁剧疆涓涓粍浠跺睘鎬х殑鍊笺 杩欎釜鏂规硶閫氳繃娣诲姞涓涓柊鐨勯敭鍚嶅拰閿煎埌闆嗗悎锛岃揪鍒 瑕嗙洊鐖剁被鏂规硶瀹炵幇銆
public void __unset(string $name)
| ||
$name | string | 灞炴у悕鎴栦簨浠跺悕 |
public function __unset($name)
{
$this->remove($name);
}
璁剧疆涓涓粍浠跺睘鎬т负null銆 杩欎釜鏂规硶閫氳繃娓呴櫎鎸囧畾鐨勯敭鍚嶉敭鍊硷紝杈惧埌 瑕嗙洊鐖剁被鏂规硶瀹炵幇銆
public void add(mixed $key, mixed $value)
| ||
$key | mixed | key |
$value | mixed | value |
public function add($key,$value)
{
if($this->caseSensitive)
parent::add($key,$value);
else
parent::add(strtolower($key),$value);
}
娣诲姞涓涓」鍒癿ap銆 杩欎釜鏂规硶鏄紝濡傛灉caseSensitive涓篺alse锛屽垯鍏堝皢閿悕杞崲鎴愬皬鍐欙紝杈惧埌瑕嗙洊鐖剁被鏂规硶瀹炵幇銆
public boolean canGetProperty(string $name)
| ||
$name | string | 灞炴у悕 |
{return} | boolean | 杩斿洖鍊艰鏄庤灞炴ф槸鍚﹀彲璇 |
public function canGetProperty($name)
{
return $this->contains($name) || parent::canGetProperty($name);
}
纭畾涓涓睘鎬ф槸鍚﹀彲璇汇 杩欎釜鏂规硶鏄紝濡傛灉闆嗗悎涓寘鍚閿悕瀵瑰簲鐨勯敭鍊硷紝鍒欒繑鍥瀟rue锛岃揪鍒 瑕嗙洊鐖剁被鏂规硶瀹炵幇銆
public boolean canSetProperty(string $name)
| ||
$name | string | the property name |
{return} | boolean | true |
public function canSetProperty($name)
{
return true;
}
纭畾涓涓睘鎬ф槸鍚﹀彲璁剧疆銆 杩欎釜鏂规硶閫氳繃杩斿洖鐪熻鐩栫埗绫绘柟娉曞疄鐜般 鍥犱负浣犳绘槸澧炲姞涓涓柊鍊煎埌闆嗗悎銆
public boolean contains(mixed $key)
| ||
$key | mixed | 閿悕 |
{return} | boolean | 杩斿洖鍊艰鏄巑ap鏄惁鍖呭惈鐫鎸囧畾閿悕瀵瑰簲鐨勯」鐩 |
public function contains($key)
{
if($this->caseSensitive)
return parent::contains($key);
else
return parent::contains(strtolower($key));
}
杩斿洖鍊艰鏄庢寚瀹氱殑椤圭洰鏄惁鍦╩ap涓 杩欎釜鏂规硶鏄紝濡傛灉caseSensitive涓篺alse锛屽垯鍏堝皢閿悕杞崲鎴愬皬鍐欙紝杈惧埌瑕嗙洊鐖剁被鏂规硶瀹炵幇銆
public boolean hasProperty(string $name)
| ||
$name | string | 灞炴у悕 |
{return} | boolean | 杩斿洖鍊艰鏄庤灞炴ф槸鍚﹁瀹氫箟 |
public function hasProperty($name)
{
return $this->contains($name) || parent::hasProperty($name);
}
纭畾鏄惁涓涓睘鎬у凡瀹氫箟銆 杩欎釜鏂规硶鏄紝濡傛灉闆嗗悎涓寘鍚閿悕瀵瑰簲鐨勯敭鍊硷紝鍒欒繑鍥瀟rue锛岃揪鍒 瑕嗙洊鐖剁被鏂规硶瀹炵幇銆
public mixed itemAt(mixed $key)
| ||
$key | mixed | 閿悕 |
{return} | mixed | 杩斿洖鍦ㄥ亸绉婚噺浣嶇疆鐨勫厓绱狅紝濡傛灉鍦ㄦ鍋忕Щ浣嶇疆姝ゅ厓绱犳病鎵惧埌鍒欒繑鍥瀗ull銆 |
public function itemAt($key)
{
if($this->caseSensitive)
return parent::itemAt($key);
else
return parent::itemAt(strtolower($key));
}
杩斿洖鎸囧畾閿殑椤广 杩欎釜鏂规硶鏄紝濡傛灉caseSensitive涓篺alse锛屽垯鍏堝皢閿悕杞崲鎴愬皬鍐欙紝杈惧埌瑕嗙洊鐖剁被鏂规硶瀹炵幇銆
public mixed remove(mixed $key)
| ||
$key | mixed | 琚Щ闄ょ殑椤圭洰鐨勯敭鍚嶃 |
{return} | mixed | 杩斿洖绉婚櫎鐨勯敭鍊硷紝濡傛灉閿悕涓嶅瓨鍦ㄥ垯杩斿洖null銆 |
public function remove($key)
{
if($this->caseSensitive)
return parent::remove($key);
else
return parent::remove(strtolower($key));
}
閫氳繃瀹冪殑閿粠map涓Щ闄や竴涓」鐩 杩欎釜鏂规硶鏄紝濡傛灉caseSensitive涓篺alse锛屽垯鍏堝皢閿悕杞崲鎴愬皬鍐欙紝杈惧埌瑕嗙洊鐖剁被鏂规硶瀹炵幇銆