union() public method

(Uses strict equality '===')
public union ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to union
return pinq\ITraversable
コード例 #1
0
ファイル: UnionTest.php プロジェクト: timetoogo/pinq
 /**
  * @dataProvider emptyData
  */
 public function testThatUnionMaintainsReferences(\Pinq\ITraversable $traversable)
 {
     $data = $this->makeRefs(range('a', 'f'));
     $traversable->union($data)->iterate(function (&$i) {
         $i = "{$i}-";
     });
     $this->assertSame('a-b-c-d-e-f-', implode('', $data));
 }
コード例 #2
0
ファイル: ScopeEvaluator.php プロジェクト: timetoogo/pinq
 public function visitOperation(Segments\Operation $query)
 {
     $otherValues = self::evaluateSource($query->getSource(), $this->resolvedParameters);
     switch ($query->getOperationType()) {
         case Segments\Operation::UNION:
             $this->traversable = $this->traversable->union($otherValues);
             break;
         case Segments\Operation::INTERSECT:
             $this->traversable = $this->traversable->intersect($otherValues);
             break;
         case Segments\Operation::DIFFERENCE:
             $this->traversable = $this->traversable->difference($otherValues);
             break;
         case Segments\Operation::APPEND:
             $this->traversable = $this->traversable->append($otherValues);
             break;
         case Segments\Operation::WHERE_IN:
             $this->traversable = $this->traversable->whereIn($otherValues);
             break;
         case Segments\Operation::EXCEPT:
             $this->traversable = $this->traversable->except($otherValues);
             break;
     }
 }