$this->tidyconfig = array('indent' => false, 'clean' => true, 'merge-divs' => false, 'quote-marks' => true, 'drop-empty-paras' => false, 'markup' => false, 'output-xhtml' => true, 'wrap' => 0); } public abstract function run(); public function getURL($url) { $data = "awerawer"; // in my code, $data is downloaded from a site $tidy = new tidy(); $tidy->parseString($data, $this->tidyconfig, 'utf8'); $tidy->cleanRepair(); return $tidy; } } class ChildClass extends BaseClass { public function __construct() { parent::__construct(); } public function run() { $result = $this->getURL('awer'); if ($result === null) { echo "\tError:\n"; } var_dump((string) $result); } } $instance = new ChildClass(); $instance->run();