예제 #1
0
 public function testGroupsToArray()
 {
     $array = array('BMI' => array('groups' => array('group1', 'group2')));
     $attr = new Attribute();
     $attr->setName('BMI');
     $attr->addGroup('group1');
     $attr->addGroup('group2');
     $this->assertEquals($array, $attr->toArray());
 }
 protected function parseAttributes()
 {
     $attributes = array();
     foreach ($this->XPath->evaluate('//dd:DataDescription/Dictionary[@sourceDictType="TransformationDictionary" and @default="true"]/Field') as $f) {
         $attribute = new Attribute();
         foreach ($f->childNodes as $n) {
             if ($n->nodeName == "Name") {
                 $attribute->setName($n->nodeValue);
             }
             if ($n->nodeName == "Category") {
                 $attribute->addCategory($n->nodeValue);
             }
             if ($n->nodeName == "Interval") {
                 $closure = $n->getAttribute('closure');
                 $interval = substr($closure, 0, 4) === 'open' ? '(' : '<';
                 $interval .= $n->getAttribute('leftMargin') . ';' . $n->getAttribute('rightMargin');
                 $interval .= substr($closure, -4, 4) === 'Open' ? ')' : '>';
                 $attribute->addInterval($interval);
             }
         }
         array_push($attributes, $attribute);
     }
     return $attributes;
 }