dom = new Dom; $this->period = strtotime("1 week ago"); $this->markdown = new \cebe\markdown\Markdown(); $this->output = ''; } /** * Function to start the section. * @param whether to return or print the text */ protected function startSection($return = false) { $text = "#### ".$this->title."\n"; if ($return) { return $text; } $this->output .= $text; } protected function endSection() {} abstract protected function parse(); public function print() { $this->startSection(); $this->parse(); $this->endSection(); if ($this->output === $this->startSection(true)) // nothing to print return; echo $this->markdown->parse($this->output); } }