コード例 #1
0
ファイル: 12-9.php プロジェクト: quekaihua/StudyTest
    }
    public function offsetSet($key, $value)
    {
        $this->_keys[spl_object_hash($key)] = $key;
        $this->_values[spl_object_hash($key)] = $value;
    }
    public function offsetGet($key)
    {
        return $this->_values[spl_object_hash($key)];
    }
    public function offsetExists($key)
    {
        return array_key_exists(spl_object_hash($key), $this->_values);
    }
    public function offsetUnset($key)
    {
        unset($this->_values[spl_object_hash($key)]);
        unset($this->_keys[spl_object_hash($key)]);
    }
    public function getKey($hash)
    {
        return $this->_keys[$hash];
    }
}
$key = new KeyObject();
$collection = new CollectionObject();
$collection[$key] = 'test';
foreach ($collection as $k => $v) {
    print_r($collection->getKey($k));
    print_r($v);
}
コード例 #2
0
 protected function _Set($k, $v)
 {
     parent::_Set($k, $v);
     usort($this->data, $this->function);
 }
コード例 #3
0
 function remove($k)
 {
     parent::Remove($k);
     //Reorder over gap
     $this->data = array_values($this->data);
 }
コード例 #4
0
ファイル: Map.php プロジェクト: weblement/collections
 public function remove($key)
 {
     return parent::removeIndex($key);
 }
コード例 #5
0
ファイル: Plural.php プロジェクト: robtro/php-bandwidth
 public function __construct()
 {
     $args = func_get_args();
     $data = Ensure::Input($args[0]);
     parent::__construct($data, new AppendsResource(array(array("term" => "recordingId", "link" => TRUE, "value" => $args[1]))));
 }