League\CommonMark\Block\Element\AbstractBlock::finalize PHP Method

finalize() public method

Finalize the block; mark it closed for modification
public finalize ( League\CommonMark\ContextInterface $context, integer $endLineNumber )
$context League\CommonMark\ContextInterface
$endLineNumber integer
    public function finalize(ContextInterface $context, $endLineNumber)
    {
        if (!$this->open) {
            return;
            // TODO: Throw AlreadyClosedException?
        }
        $this->open = false;
        $this->endLine = $endLineNumber;
        $context->setTip($context->getTip()->parent());
    }

Usage Example

 public function closeUnmatchedBlocks()
 {
     while ($this->oldTip !== $this->lastMatchedContainer) {
         $this->oldTip->finalize($this->context);
         $this->oldTip = $this->oldTip->getParent();
     }
 }
All Usage Examples Of League\CommonMark\Block\Element\AbstractBlock::finalize