Example #1
0
File: Dug.php Project: label305/dug
 /**
  * @param array $path
  * @return Data[]
  */
 public function data(array $path)
 {
     $source = $this->sourceForPath($path);
     if ($source === null) {
         throw new RouteNotFoundException($path);
     }
     $combined = DataCombiner::combine($source->getDataProviderInstance($this->classInitializer)->handle($path));
     return (new ReferenceResolver($this))->process($combined);
 }
Example #2
0
 public function testCombineMultiple()
 {
     /* Given */
     $data = [Data::build(['foo', 1], ['foo' => 'bar']), Data::build(['foo', 1], ['name' => 'bar2']), Data::build(['foo', 2], ['foo2' => 'bar']), Data::build(['foo', 2], ['name2' => 'bar2'])];
     /* When */
     $result = DataCombiner::combine($data);
     /* Then */
     assertThat(count($result), is(2));
     assertThat($result[0]->getValue(), is(['foo' => 'bar', 'name' => 'bar2']));
     assertThat($result[1]->getValue(), is(['foo2' => 'bar', 'name2' => 'bar2']));
 }