コード例 #1
0
ファイル: Set.php プロジェクト: timetoogo/pinq
 /**
  * {@inheritDoc}
  */
 public function remove($value)
 {
     $identityHash = Identity::hash($value);
     if (!isset($this->values[$identityHash]) && !array_key_exists($identityHash, $this->values)) {
         return false;
     }
     unset($this->values[$identityHash]);
     $this->length--;
     return true;
 }
コード例 #2
0
ファイル: OrderedMap.php プロジェクト: timetoogo/pinq
 /**
  * {@inheritDoc}
  */
 public function remove($key)
 {
     $identityHash = Identity::hash($key);
     if (isset($this->keyIdentityPositionMap[$identityHash])) {
         $position = $this->keyIdentityPositionMap[$identityHash];
         unset($this->keys[$position], $this->values[$position], $this->keyIdentityPositionMap[$identityHash]);
         if ($position !== $this->length) {
             $this->keys = array_values($this->keys);
             $this->values = array_values($this->values);
         }
         $this->length--;
         if ($key === $this->largestIntKey) {
             $this->loadLargestIntKey();
         }
         return true;
     }
     return false;
 }