src/DataStore/src/DataStore/CsvBase.php
protected function lockFile($nbTries = 0)
    {
        if (!$this->lockHandler->lock()) {
            if ($nbTries >= static::MAX_LOCK_TRIES) {
                throw new DataStoreException(
                    sprintf("Reach max retry (%s) for locking queue file {$this->filename}", static::MAX_LOCK_TRIES)
                );
            }

            usleep(10);

            return $this->lockFile($nbTries + 1);
        }

        return true;
    }
protected function lockFile($nbTries = 0)
    {
        if (!$this->lockHandler->lock()) {
            if ($nbTries >= static::MAX_LOCK_TRIES) {
                throw new DataStoreException(
                    sprintf("Reach max retry (%s) for locking queue file {$this->filename}", static::MAX_LOCK_TRIES)
                );
            }

            usleep(10);

            return $this->lockFile($nbTries + 1);
        }

        return true;
    }
protected function lockFile ( $ nbTries = 0 ) { if ( ! $ this -> lockHandler -> lock ( ) ) { if ( $ nbTries >= static :: MAX_LOCK_TRIES ) { throw new DataStoreException ( sprintf ( "Reach max retry (%s) for locking queue file {$this->filename}" , static :: MAX_LOCK_TRIES ) ) ; } usleep ( 10 ) ; return $ this -> lockFile ( $ nbTries + 1 ) ; } return true ; }
Locks the file

@param int $nbTries - count of tries of locking queue
@return bool
@throws \rollun\datastore\DataStore\DataStoreException
Locks the file