/** * Generate the label. * * @return string */ public function generate() { if ($this->isVisible()) { return parent::generate(); } return ''; }
/** * @param Node $parent * @param string $position * @return $this */ public function appendTo(Node $parent, $position = Node::POSITION_LAST) { $parent->addChild($this, $position); return $this; }
/** * Construct. * * @param string $tag Element tag. * @param array $attributes Attributes. */ public function __construct($tag, $attributes = array()) { parent::__construct($tag, $attributes); $this->childAttributes = new Attributes(); }
function it_casts_to_string_contains_content(Node $a) { $content = '<a href="#test">Test</a>'; $a->generate()->willReturn($content); $a->__toString()->willReturn($content); $this->addChild($a); $this->generate()->shouldReturn('<p class="example" id="test">' . $content . '</p>' . PHP_EOL); }
function it_is_appendable_to_position(Node $parent) { $parent->addChild($this, Node::POSITION_FIRST)->shouldBeCalled(); $this->appendTo($parent, Node::POSITION_FIRST)->shouldReturn($this); }