Class yii\apidoc\helpers\IndexFileAnalyzer

Inheritanceyii\apidoc\helpers\IndexFileAnalyzer » cebe\markdown\Markdown
Source Code https://github.com/yiisoft/yii2-apidoc/blob/master/helpers/IndexFileAnalyzer.php

IndexFileAnalyzer analyzes index file with TOC. Typically README.md.

Public Methods

Hide inherited methods

Method Description Defined By
analyze() Parses text and returns list of chapters got from it yii\apidoc\helpers\IndexFileAnalyzer

Property Details

Hide inherited properties

$introduction public property
public $introduction null
$title public property
public $title null

Method Details

Hide inherited methods

analyze() public method

Parses text and returns list of chapters got from it

public array analyze ( $text )
$text string

                public function analyze($text)
{
    $this->parse($text);
    return $this->_chapters;
}

            
renderHeadline() protected method

protected void renderHeadline ( $block )
$block

                protected function renderHeadline($block)
{
    if ($this->_chapter === 0) {
        $this->title = $this->renderAbsy($block['content']);
        $this->introduction = '';
        $this->_chapter++;
    } else {
        $this->_chapter++;
        $this->_chapters[$this->_chapter] = [
            'headline' => $this->renderAbsy($block['content']),
            'content' => [],
        ];
    }
    return parent::renderHeadline($block);
}

            
renderList() protected method

protected void renderList ( $block )
$block

                protected function renderList($block)
{
    if ($this->_chapter > 0) {
        foreach ($block['items'] as $item => $absyElements) {
            foreach($absyElements as $element) {
                if ($element[0] === 'link') {
                    $this->_chapters[$this->_chapter]['content'][] = [
                        'headline' => $this->renderAbsy($element['text']),
                        'file' => $element['url'],
                    ];
                }
            }
        }
    }
    return parent::renderList($block);
}

            
renderParagraph() protected method

protected void renderParagraph ( $block )
$block

                protected function renderParagraph($block)
{
    if ($this->_chapter < 1) {
        $this->introduction .= $this->renderAbsy($block['content']);
    }
    return parent::renderParagraph($block);
}