mergeWith() публичный Метод

Creates a new instance to which the given specs have been merged. In case of conflicts, the existing values are kept.
public mergeWith ( self $specs ) : self
$specs self
Результат self
Пример #1
0
 /**
  * @testdox Merging a bag that has a constructor method with a new one that has one as well, the result will kept its constructor method.
  */
 public function testMergeTwoBags2()
 {
     $constructorA = new SimpleMethodCall('childCreate', []);
     $constructorB = new SimpleMethodCall('parentCreate', []);
     $bagA = new SpecificationBag($constructorA, new PropertyBag(), new MethodCallBag());
     $bagB = new SpecificationBag($constructorB, new PropertyBag(), new MethodCallBag());
     $bag = $bagA->mergeWith($bagB);
     $this->assertEquals($constructorA, $bagA->getConstructor());
     $this->assertEquals($constructorB, $bagB->getConstructor());
     $this->assertEquals($constructorA, $bag->getConstructor());
 }