CodeScrawlExt.php

<?php

namespace Lia\Integration;

use Tlf\Scrawl\DoNothingExtension;

class CodeScrawlExt extends DoNothingExtension {

    public function bootstrap(){
        $this->scrawl->template_dirs[] = __DIR__.'/ScrawlTemplates/';
    }

    public function scrawl_finished(){
        // print_r($this->scrawl->options);
        $init_script = $this->scrawl->options['Lia.init_script'];
        $path = $this->scrawl->options['dir.root'] . '/' . $init_script;
        // $out_file = $this->scrawl->options['Lia.doc_path']

        $lia = \Lia\Simple::get_lia_instance($path);


        $this->scrawl->write_doc('Lia.md', 
            $this->scrawl->get_template('Lia', ['lia'=>$lia])
        );

        $this->scrawl->write_doc('Lia/Methods.md', 
            $this->scrawl->get_template('Lia/Methods', ['lia'=>$lia])
        );

        $this->scrawl->write_doc('Lia/Routes.md', 
            $this->scrawl->get_template('Lia/Routes', ['lia'=>$lia])
        );
    }
}