protected function setFile($file)
    {
        if ($file == $this->file) {
            // no change
            return;
        }
        if ($this->fileHandle) {
            // close existing file
            \fclose($this->fileHandle);
            $this->fileHandle = null;
        }
        $this->file = $file;
        if (empty($file)) {
            return;
        }
        $fileExists = \file_exists($file);
        $this->fileHandle = \fopen($file, 'a');
        if ($this->fileHandle) {
            \fwrite($this->fileHandle, '***** '.\date('Y-m-d H:i:s').' *****'."\n");
            if (!$fileExists) {
                // we just created file
                \chmod($file, 0660);
            }
        }
    }
protected function setFile($file)
    {
        if ($file == $this->file) {
            // no change
            return;
        }
        if ($this->fileHandle) {
            // close existing file
            \fclose($this->fileHandle);
            $this->fileHandle = null;
        }
        $this->file = $file;
        if (empty($file)) {
            return;
        }
        $fileExists = \file_exists($file);
        $this->fileHandle = \fopen($file, 'a');
        if ($this->fileHandle) {
            \fwrite($this->fileHandle, '***** '.\date('Y-m-d H:i:s').' *****'."\n");
            if (!$fileExists) {
                // we just created file
                \chmod($file, 0660);
            }
        }
    }
protected function setFile ( $ file ) { if ( $ file == $ this -> file ) { // no change return ; } if ( $ this -> fileHandle ) { // close existing file \ fclose ( $ this -> fileHandle ) ; $ this -> fileHandle = null ; } $ this -> file = $ file ; if ( empty ( $ file ) ) { return ; } $ fileExists = \ file_exists ( $ file ) ; $ this -> fileHandle = \ fopen ( $ file , 'a' ) ; if ( $ this -> fileHandle ) { \ fwrite ( $ this -> fileHandle , '***** ' . \ date ( 'Y-m-d H:i:s' ) . ' *****' . "\n" ) ; if ( ! $ fileExists ) { // we just created file \ chmod ( $ file , 0660 ) ; } } }
Set file we will write to

@param string $file file path

@return void
Set file we will write to