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

canContain() abstract public method

Returns true if this block can contain the given block as a child node
abstract public canContain ( AbstractBlock $block ) : boolean
$block AbstractBlock
return boolean
    public abstract function canContain(AbstractBlock $block);

Usage Example

Beispiel #1
0
 /**
  * @param AbstractBlock $block
  *
  * @return AbstractBlock
  */
 public function addBlock(AbstractBlock $block)
 {
     $this->getBlockCloser()->closeUnmatchedBlocks();
     $block->setStartLine($this->lineNumber);
     while (!$this->tip->canContain($block)) {
         $this->tip->finalize($this);
     }
     $this->tip->addChild($block);
     $this->tip = $block;
     $this->container = $block;
     return $block;
 }