restructured abi of main class

feature/tests
Michael Ochmann 3 years ago
parent 3ea15a3f51
commit 03356fc709
  1. 17
      src/Parkdown.php

@ -2,17 +2,26 @@
namespace parkdown;
use DOMDocument;
class Parkdown {
private string $sourceCode;
private DOMDocument $tree_;
public function __construct(string $sourceCode) {
$this->sourceCode= $sourceCode;
}
$this->sourceCode = $sourceCode;
public function html() : void {
$lexer = new Lexer($this->sourceCode);
$parser = new Parser($lexer->tokenize());
echo $parser->parse();
$this->tree_ = $parser->parse();
}
public function tree() : DOMDocument {
return $this->tree_;
}
public function html() : string {
return $this->tree_->saveHTML();
}
}
Loading…
Cancel
Save