Exemplo n.º 1
0
 /**
  * Render structured element
  *
  * @return string
  */
 public function render()
 {
     $renderFunction = function (&$element, $key) {
         $element = $element->render();
     };
     array_walk($this->elements, $renderFunction);
     $structuredElements = StructureManager::buildStructure($this->elements, $this->structure);
     return $structuredElements;
 }
Exemplo n.º 2
0
 /**
  * Enable to use functions such as Tools::green('random string')
  *
  * @return string
  */
 public static function __callstatic($name, $params)
 {
     if (array_key_exists($name, TextColorManager::getKnownColors())) {
         return TextColorManager::$name($params);
     }
     if (BackgroundColorManager::isBackgroundCall($name)) {
         return BackgroundColorManager::$name($params);
     }
     if (in_array($name, BorderManager::getKnownBorders())) {
         return BorderManager::$name($params);
     }
     if (in_array($name, StructureManager::getDisplayableStructures())) {
         return StructureManager::$name($params);
     }
     if (array_key_exists($name, StyleManager::getKnownStyles())) {
         return StyleManager::$name($params);
     }
     if (FigletManager::isFigletCall($name)) {
         return FigletManager::$name($params);
     }
     throw new Exception("Unknown function name {$name}");
 }
Exemplo n.º 3
0
 public function testUnknownStructure()
 {
     $this->exception(function () {
         BaseStructure\StructureManager::unknown('foo');
     })->hasMessage('Unknown structure function name unknown');
 }