public function write() {
        $filename = $this->getFileName();
        if(basename($filename) == '.php') {
            throw new CatchableException('Invalid Filename: '.$filename);
        }
        if(!is_dir(dirname($filename))) {
            mkdir(dirname($filename), 0777, true);
        }
        file_put_contents($filename, $this->toString());
    }