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(); }
protected function putDataHeldByAggregator(Aggregator $a, DOMElement $destination) { /* @var $a ListAggregator */ $destination->appendChild(new DOMText($a->getListAsString())); }
/** * 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)); }
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); }
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); }
protected function convertToScalarImpl(Aggregator $aggregator) { /* @var $aggregator Percentage */ return number_format($aggregator->getAsFloat(), 0); }
public function visit(Aggregator $a) { return $a->accept($this->findPresenterOf($a)); }
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()); }
protected function putDataHeldByAggregator(Aggregator $a, DOMElement $destination) { $destination->appendChild($this->getDOMNodeOf($a->getAggregatorOfNodes(), $destination)); }
/** * @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; }
protected function convertToScalarImpl(Aggregator $aggregator) { /* @var $aggregator Counter */ return $aggregator->getNumberOfAggregatedSubjects(); }