Ejemplo n.º 1
0
 protected function putDataHeldByAggregator(Aggregator $a, DOMElement $destination)
 {
     /* @var $a Container */
     foreach ($a->getAllActualAggregators() as $aggregatorToAdd) {
         $destination->appendChild($this->getDOMNodeOf($aggregatorToAdd, $destination));
     }
 }
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     /* @var $aggregator GroupingAggregator */
     return array_map(function (AggregatorOfSubjectsWithCommonProperties $subAggregator) {
         return $this->presenterOfActualAggregators->convertToScalar($subAggregator);
     }, $aggregator->getAggregatorsOfSubjectsWithCommonProperties());
 }
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     /* @var $aggregator NodeAggregator  */
     return ['own' => $this->aggregatorPresenter->convertToScalar($aggregator->getActualAggregator()), 'children' => array_map(function (Aggregator $childAggregator) {
         return $this->aggregatorPresenter->convertToScalar($childAggregator);
     }, $aggregator->getChildren())];
 }
 public function visit(Aggregator $a)
 {
     if (!$a instanceof \lukaszmakuch\Aggregator\LabelGenerator\WithCustomLabel) {
         throw new \lukaszmakuch\Aggregator\XmlPresenter\Exception\UnableToCreateXml();
     }
     $xmlDoc = new \DOMDocument();
     $xmlDoc->loadXML($a->getActualAggregator()->accept($this->presenterOfEveryAggregator));
     $xmlDoc->documentElement->setAttribute("label", $a->getLabel());
     return $xmlDoc->saveXML();
 }
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     try {
         /* @var $aggregator PropertyList */
         return array_map(function (ComparableProperty $p) {
             return $this->propertyAsText->getTextBasedOn($p);
         }, $aggregator->getProperties());
     } catch (UnableToGetText $e) {
         throw new UnableToPresent('unable to convert a property to text');
     }
 }
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     /* @var $aggregator WithCustomLabel */
     return $this->presenterOfActualAggregators->convertToScalar($aggregator->getActualAggregator());
 }
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     /* @var $aggregator HierarchicalAggregator  */
     return $this->nodePresenter->convertToScalar($aggregator->getAggregatorOfNodes());
 }
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     /* @var $aggregator ListAggregator */
     return $aggregator->getListAsString();
 }
Ejemplo n.º 9
0
 protected function putDataHeldByAggregator(Aggregator $a, DOMElement $destination)
 {
     /* @var $a ListAggregator */
     $destination->appendChild(new DOMText($a->getListAsString()));
 }
Ejemplo n.º 10
0
 /**
  * Asserts that the aggregation result for the given aggregator matches the given result.
  *
  * @param mixed $expectedResultOfAggregation
  * @throws VisitorException
  */
 private function assertAggregationResultImpl($expectedResultOfAggregation, Aggregator $a)
 {
     $this->assertSame($expectedResultOfAggregation, $a->accept($this->scalarPresentingVisitor));
 }
Ejemplo n.º 11
0
 protected function putDataHeldByAggregator(Aggregator $a, DOMElement $destination)
 {
     $destination->appendChild(new DOMText((int) $a->isTrue()));
 }
 public function accept(AggregatorVisitor $v)
 {
     return $this->if->isTrue() ? $this->then->accept($v) : $this->else->accept($v);
 }
Ejemplo n.º 13
0
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     /* @var $aggregator MoreThan */
     return $aggregator->isTrue();
 }
 protected function putDataHeldByAggregator(Aggregator $a, DOMElement $destination)
 {
     /* @var $a HierarchicalAggregator */
     $this->addHierarchyNodeTags($a->getAggregatorOfNodes(), $destination, self::ROOT_NODE_LEVEL, self::ROOT_NODE_PARENT_LABEL);
 }
Ejemplo n.º 15
0
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     /* @var $aggregator Percentage */
     return number_format($aggregator->getAsFloat(), 0);
 }
Ejemplo n.º 16
0
 public function visit(Aggregator $a)
 {
     return $a->accept($this->findPresenterOf($a));
 }
Ejemplo n.º 17
0
 protected function putDataHeldByAggregator(Aggregator $a, DOMElement $destination)
 {
     /* @var $a Counter */
     $destination->appendChild(new DOMText($a->getNumberOfAggregatedSubjects()));
 }
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     /* @var $aggregator AggregatorOfSubjectsWithCommonProperties */
     return $this->presenterOfActualAggregators->convertToScalar($aggregator->getActualAggregator());
 }
Ejemplo n.º 19
0
 protected function putDataHeldByAggregator(Aggregator $a, DOMElement $destination)
 {
     $destination->appendChild($this->getDOMNodeOf($a->getAggregatorOfNodes(), $destination));
 }
Ejemplo n.º 20
0
 /**
  * @param Aggregator $a
  * @throws UnableToCreateXml
  * @return DOMNode
  */
 protected function getDOMNodeOf(Aggregator $a, DOMElement $destination)
 {
     $childXml = $destination->ownerDocument->createDocumentFragment();
     $childXml->appendXML($a->accept($this->presenterOfEveryAggregator));
     return $childXml;
 }
Ejemplo n.º 21
0
 protected function convertToScalarImpl(Aggregator $aggregator)
 {
     /* @var $aggregator Counter */
     return $aggregator->getNumberOfAggregatedSubjects();
 }