public function exportToFile(string $filename)
    {
        if (($p = strrpos($filename, DIRECTORY_SEPARATOR)) >= 0) {
            $path = substr($filename, 0, $p);
            $name = substr($filename, $p + 1);

            if (strlen($path) > 0 && !is_dir($path)) {
                mkdir($path, 0755, true);
            }
        }

        if (($handler = fopen($filename, 'w'))) {
            fwrite($handler, $this->code);
            fclose($handler);
        }
    }