Hoa central
XylIf.php
Go to the documentation of this file.
1 <?php
2 
38 
39 use Hoa\Stream;
40 use Hoa\Xyl;
41 
51 {
57  protected static $_attributes = [
58  'test' => self::ATTRIBUTE_TYPE_NORMAL
59  ];
60 
61 
62 
69  public function paint(Stream\IStream\Out $out)
70  {
71  return $this->structuralCompute($out);
72  }
73 
80  public function structuralCompute(Stream\IStream\Out $out)
81  {
82  $verdict = false;
83 
84  if (true === $this->abstract->attributeExists('test')) {
85  $verdict = Xyl::evaluateXPath(
86  $this->computeAttributeValue(
87  $this->abstract->readAttribute('test'),
88  self::ATTRIBUTE_TYPE_NORMAL
89  )
90  );
91  }
92 
93  if (false === $verdict) {
94  $next = $this->abstract->selectAdjacentSiblingElement('elseif')
95  ?: $this->abstract->selectAdjacentSiblingElement('else');
96 
97  if (false === $next) {
98  return;
99  }
100 
101  $this->getConcreteElement($next)->structuralCompute($out);
102 
103  return;
104  }
105 
106  $this->computeValue($out);
107 
108  return;
109  }
110 }
structuralCompute(Stream\IStream\Out $out)
Definition: XylIf.php:80
computeValue(Stream\IStream\Out $out=null)
Definition: Concrete.php:410
paint(Stream\IStream\Out $out)
Definition: XylIf.php:69
static evaluateXPath($expression)
Definition: Xyl.php:1760
static getConcreteElement(Element $element)
Definition: Concrete.php:212
computeAttributeValue($value, $type=self::ATTRIBUTE_TYPE_UNKNOWN, $name=null)
Definition: Concrete.php:488