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);
        }
    }
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);
        }
    }
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 ) ; } }
Exports the code to a file.
@param string $filename File name and path to create export file.
Exports the code to a file .