src/Jackiedo/DotenvEditor/DotenvEditor.php
public function load($filePath = null, $restoreIfNotFound = false, $restorePath = null)
    {
        $this->resetContent();

        if (! is_null($filePath)) {
            $this->filePath = $filePath;
        } else {
            if (method_exists($this->app, 'environmentPath') && method_exists($this->app, 'environmentFile')) {
                $this->filePath = $this->app->environmentPath().'/'.$this->app->environmentFile();
            } else {
                $this->filePath = __DIR__.'/../../../../../../.env';
            }
        }

        $this->reader->load($this->filePath);

        if (file_exists($this->filePath)) {
            $this->writer->setBuffer($this->getContent());
            return $this;
        } elseif ($restoreIfNotFound) {
            return $this->restore($restorePath);
        } else {
            return $this;
        }
    }
public function load($filePath = null, $restoreIfNotFound = false, $restorePath = null)
    {
        $this->resetContent();

        if (! is_null($filePath)) {
            $this->filePath = $filePath;
        } else {
            if (method_exists($this->app, 'environmentPath') && method_exists($this->app, 'environmentFile')) {
                $this->filePath = $this->app->environmentPath().'/'.$this->app->environmentFile();
            } else {
                $this->filePath = __DIR__.'/../../../../../../.env';
            }
        }

        $this->reader->load($this->filePath);

        if (file_exists($this->filePath)) {
            $this->writer->setBuffer($this->getContent());
            return $this;
        } elseif ($restoreIfNotFound) {
            return $this->restore($restorePath);
        } else {
            return $this;
        }
    }
public function load ( $ filePath = null , $ restoreIfNotFound = false , $ restorePath = null ) { $ this -> resetContent ( ) ; if ( ! is_null ( $ filePath ) ) { $ this -> filePath = $ filePath ; } else { if ( method_exists ( $ this -> app , 'environmentPath' ) && method_exists ( $ this -> app , 'environmentFile' ) ) { $ this -> filePath = $ this -> app -> environmentPath ( ) . '/' . $ this -> app -> environmentFile ( ) ; } else { $ this -> filePath = __DIR__ . '/../../../../../../.env' ; } } $ this -> reader -> load ( $ this -> filePath ) ; if ( file_exists ( $ this -> filePath ) ) { $ this -> writer -> setBuffer ( $ this -> getContent ( ) ) ; return $ this ; } elseif ( $ restoreIfNotFound ) { return $ this -> restore ( $ restorePath ) ; } else { return $ this ; } }
Load file for working

@param  string|null  $filePath           The file path
@param  boolean      $restoreIfNotFound  Restore this file from other file if it's not found
@param  string|null  $restorePath        The file path you want to restore from

@return DotenvEditor
Load file for working