src/Ciconia/Extension/Gfm/TableExtension.php
protected function parseHeader(Text $header, Collection $baseTags)
    {
        $cells = new Collection();

        try {
            $header->split('/\|/')->each(function (Text $cell, $index) use ($baseTags, &$cells) {
                /* @var Tag $tag */
                $tag = clone $baseTags->get($index);
                $tag->setName('th');
                $this->markdown->emit('inline', array($cell));
                $tag->setText($cell->trim());

                $cells->add($tag);
            });
        } catch (\OutOfBoundsException $e) {
            throw new SyntaxError(
                'Too much cells on table header.',
                $this, $header, $this->markdown, $e
            );
        }

        if ($baseTags->count() != $cells->count()) {
            throw new SyntaxError(
                'Unexpected number of table cells in header.',
                $this, $header, $this->markdown
            );
        }

        return $cells;
    }
protected function parseHeader(Text $header, Collection $baseTags)
    {
        $cells = new Collection();

        try {
            $header->split('/\|/')->each(function (Text $cell, $index) use ($baseTags, &$cells) {
                /* @var Tag $tag */
                $tag = clone $baseTags->get($index);
                $tag->setName('th');
                $this->markdown->emit('inline', array($cell));
                $tag->setText($cell->trim());

                $cells->add($tag);
            });
        } catch (\OutOfBoundsException $e) {
            throw new SyntaxError(
                'Too much cells on table header.',
                $this, $header, $this->markdown, $e
            );
        }

        if ($baseTags->count() != $cells->count()) {
            throw new SyntaxError(
                'Unexpected number of table cells in header.',
                $this, $header, $this->markdown
            );
        }

        return $cells;
    }
protected function parseHeader ( Text $ header , Collection $ baseTags ) { $ cells = new Collection ( ) ; try { $ header -> split ( '/\|/' ) -> each ( function ( Text $ cell , $ index ) use ( $ baseTags , & $ cells ) { /* @var Tag $tag */ $ tag = clone $ baseTags -> get ( $ index ) ; $ tag -> setName ( 'th' ) ; $ this -> markdown -> emit ( 'inline' , array ( $ cell ) ) ; $ tag -> setText ( $ cell -> trim ( ) ) ; $ cells -> add ( $ tag ) ; } ) ; } catch ( \ OutOfBoundsException $ e ) { throw new SyntaxError ( 'Too much cells on table header.' , $ this , $ header , $ this -> markdown , $ e ) ; } if ( $ baseTags -> count ( ) != $ cells -> count ( ) ) { throw new SyntaxError ( 'Unexpected number of table cells in header.' , $ this , $ header , $ this -> markdown ) ; } return $ cells ; }
@param Text       $header
@param Collection $baseTags

@throws \Ciconia\Exception\SyntaxError

@return Collection
@param Text $header @param Collection $baseTags