src/Storage/File/FileWriter.php
public function open()
    {
        if ($this->isOpened()) {
            return;
        }

        $this->handle = @fopen($this->filePath, self::OPEN_MODE);
        if ($this->handle === false) {
            throw new \RuntimeException("Could not open file for writing: " . $this->filePath);
        }

        if (!$this->lock(LOCK_EX)) {
            $this->close();
            throw new \RuntimeException("Could not aquire an exclusive lock for " . $this->filePath);
        }

        if ($this->options["backup"]) {
            $this->createBkFile();
        }
        
        $this->writeErrors = false;
    }
public function open()
    {
        if ($this->isOpened()) {
            return;
        }

        $this->handle = @fopen($this->filePath, self::OPEN_MODE);
        if ($this->handle === false) {
            throw new \RuntimeException("Could not open file for writing: " . $this->filePath);
        }

        if (!$this->lock(LOCK_EX)) {
            $this->close();
            throw new \RuntimeException("Could not aquire an exclusive lock for " . $this->filePath);
        }

        if ($this->options["backup"]) {
            $this->createBkFile();
        }
        
        $this->writeErrors = false;
    }
public function open ( ) { if ( $ this -> isOpened ( ) ) { return ; } $ this -> handle = @ fopen ( $ this -> filePath , self :: OPEN_MODE ) ; if ( $ this -> handle === false ) { throw new \ RuntimeException ( "Could not open file for writing: " . $ this -> filePath ) ; } if ( ! $ this -> lock ( LOCK_EX ) ) { $ this -> close ( ) ; throw new \ RuntimeException ( "Could not aquire an exclusive lock for " . $ this -> filePath ) ; } if ( $ this -> options [ "backup" ] ) { $ this -> createBkFile ( ) ; } $ this -> writeErrors = false ; }
Opens the file for writing

Obtains an exclusive lock
Creates a backup file if the corresponding class option is set

@return void
@throws \RuntimeException On open/lock error
Opens the file for writing