Esempio n. 1
0
 /**
  * Broke this out to more easily make it recursive
  * @param array $data
  * @param ContextInterface $context
  * @return Tree 
  */
 private function doBuild(array $data, ContextInterface $context)
 {
     $filter = new FilterFactory($context, $data['Condition']);
     $tree = new Tree($filter->build());
     $tree->setSegmentName($data['segmentName']);
     $tree->setSegmentId($data['segmentId']);
     if (is_array($data['children'])) {
         foreach ($data['children'] as $child) {
             $segment = $this->doBuild($child, $context);
             $segment->setParent($tree);
             $tree->addChild($segment);
         }
     }
     return $tree;
 }
Esempio n. 2
0
 /**
  * Test that passing no object to the factory returns a truth type
  * @return void
  */
 public function testEmptyJsonBuildsTruth()
 {
     $factory = new JsonFactory($this->context);
     $filter = $factory->build();
     $this->assertInstanceOf('Verdict\\Filter\\Comparison\\Truth', $filter);
 }