for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Matks\Vivian\Output;
use Matks\Vivian\Structure\Structure;
use Matks\Vivian\Structure\StructureManager;
/**
* Structured Elements
*
* Array of TextElements to be echoed printed in a structured way
*/
class StructuredElements
{
* @var TextElement[]
private $elements;
* @var Structure
private $structure;
* @param TextElement[] $elements
* @param Structure $structure
public function __construct(array $elements, Structure $structure)
foreach ($elements as $element) {
if (!($element instanceof \Matks\Vivian\Output\TextElement)) {
throw new \InvalidArgumentException('Provided array should contain only TextElement, ' . get_class($element) . ' provided instead');
}
$this->elements = $elements;
$this->structure = $structure;
* @return TextElement[]
public function getElements()
return $this->elements;
* @return Structure
public function getStructure()
return $this->structure;
* Render structured element
* @return string
public function render()
$renderFunction = function (&$element, $key) {
$key
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$element = $element->render();
};
array_walk($this->elements, $renderFunction);
$structuredElements = StructureManager::buildStructure($this->elements, $this->structure);
return $structuredElements;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.