/** * Initialize program */ public function initialize() { $this->block = new CompositeBlock(new TextBlock('Main Block'), 'block'); $this->block->addBlock(new ImageBlock('\\img\\php-logo.png'), 'block'); $textBlock = new TextBlock('Composite Block'); $block2 = new CompositeBlock($textBlock, 'block'); $block2->addBlock(new TextBlock('Text Block'), 'block'); $block2->addBlock(new ButtonBlock('This is button'), 'block'); $this->block->addBlock($block2, 'block'); $this->block->addBlock(new TextBlock('Text in block'), 'block'); }
/** * Rewind counter */ public function rewind() { $this->currentBlock = $this->compositeBlock->count() - 1; }
/** * @return bool */ public function valid() { return null !== $this->compositeBlock->getBlock($this->currentBlock); }