removeRange() public méthode

Removes all occurrences of the supplied values from the collection.
public removeRange ( array | Traversable $values ) : void
$values array | Traversable The values to remove
Résultat void
Exemple #1
0
 /**
  * @dataProvider oneToTen
  * @expectedException \Pinq\PinqException
  */
 public function testThatInvalidValueThrowsExceptionWhenCallingRemoveRange(\Pinq\ICollection $collection, array $data)
 {
     $collection->removeRange(1);
 }
 public function visitRemoveValues(Operations\RemoveValues $operation)
 {
     $this->collection->removeRange(Traversable\ScopeEvaluator::evaluateSource($operation->getSource(), $this->parameters));
 }
 /**
  * @dataProvider oneToTen
  */
 public function testThatQueryUpdatesWhenSourceCollectionIsMutated(\Pinq\ICollection $collection, array $data)
 {
     $query = $collection->where(function ($i) {
         return $i % 2 === 0;
     })->orderByDescending(function ($i) {
         return $i;
     })->groupJoin(range(1, 10, 2))->on(function ($i, $v) {
         return $v < $i;
     })->to(function ($i, \Pinq\ITraversable $nums) {
         return $i . ':' . $nums->implode(',');
     });
     $this->assertMatchesValues($query, ['10:1,3,5,7,9', '8:1,3,5,7', '6:1,3,5', '4:1,3', '2:1']);
     $collection->removeRange([4, 5]);
     unset($collection[7]);
     $this->assertMatchesValues($query, ['10:1,3,5,7,9', '6:1,3,5', '2:1']);
 }