public function prepFile($path)
    {
        //Check for existing file and HTML format
        if (file_exists($path) and $this->_format == 'HTML') {
            $file = file($path);
            array_pop($file);
            file_put_contents($path, $file);
        } elseif ($this->_format == 'HTML') {
            $html = '<html><head></head><body><table border="1">' . PHP_EOL;
            $file = fopen($path, 'a');
            fwrite($file, $html);
            fclose($file);
        } elseif (file_exists($path) and $this->_format == 'XML') {
            $file = file($path);
            array_pop($file);
            file_put_contents($path, $file);
        } elseif ($this->_format == 'XML') {
            $xml = '<?xml version="1.0" standalone="no"?><log>' . PHP_EOL;
            $file = fopen($path, 'a');
            fwrite($file, $xml);
            fclose($file);
        }
    }
public function prepFile($path)
    {
        //Check for existing file and HTML format
        if (file_exists($path) and $this->_format == 'HTML') {
            $file = file($path);
            array_pop($file);
            file_put_contents($path, $file);
        } elseif ($this->_format == 'HTML') {
            $html = '<html><head></head><body><table border="1">' . PHP_EOL;
            $file = fopen($path, 'a');
            fwrite($file, $html);
            fclose($file);
        } elseif (file_exists($path) and $this->_format == 'XML') {
            $file = file($path);
            array_pop($file);
            file_put_contents($path, $file);
        } elseif ($this->_format == 'XML') {
            $xml = '<?xml version="1.0" standalone="no"?><log>' . PHP_EOL;
            $file = fopen($path, 'a');
            fwrite($file, $xml);
            fclose($file);
        }
    }
public function prepFile ( $ path ) { //Check for existing file and HTML format if ( file_exists ( $ path ) and $ this -> _format == 'HTML' ) { $ file = file ( $ path ) ; array_pop ( $ file ) ; file_put_contents ( $ path , $ file ) ; } elseif ( $ this -> _format == 'HTML' ) { $ html = '<html><head></head><body><table border="1">' . PHP_EOL ; $ file = fopen ( $ path , 'a' ) ; fwrite ( $ file , $ html ) ; fclose ( $ file ) ; } elseif ( file_exists ( $ path ) and $ this -> _format == 'XML' ) { $ file = file ( $ path ) ; array_pop ( $ file ) ; file_put_contents ( $ path , $ file ) ; } elseif ( $ this -> _format == 'XML' ) { $ xml = '<?xml version="1.0" standalone="no"?><log>' . PHP_EOL ; $ file = fopen ( $ path , 'a' ) ; fwrite ( $ file , $ xml ) ; fclose ( $ file ) ; } }
Either open a new file with the correct string or remove a previous closing string

@return void
Either open a new file with the correct string or remove a previous closing string