src/BenConstable/Lock/Lock.php
public function acquire()
    {
        if (!$this->locked) {
            $this->fp = @fopen($this->filePath, 'a');

            if (!$this->fp || !flock($this->fp, LOCK_EX | LOCK_NB)) {
                throw new LockException("Could not get lock on {$this->filePath}");
            } else {
                $this->locked = true;
            }
        }

        return $this;
    }
public function acquire()
    {
        if (!$this->locked) {
            $this->fp = @fopen($this->filePath, 'a');

            if (!$this->fp || !flock($this->fp, LOCK_EX | LOCK_NB)) {
                throw new LockException("Could not get lock on {$this->filePath}");
            } else {
                $this->locked = true;
            }
        }

        return $this;
    }
public function acquire ( ) { if ( ! $ this -> locked ) { $ this -> fp = @ fopen ( $ this -> filePath , 'a' ) ; if ( ! $ this -> fp || ! flock ( $ this -> fp , LOCK_EX | LOCK_NB ) ) { throw new LockException ( "Could not get lock on {$this->filePath}" ) ; } else { $ this -> locked = true ; } } return $ this ; }
Acquire a lock on the resource.

@return \BenConstable\Lock\Lock This, for chaining

@throws \BenConstable\Lock\Exception\LockException If lock could not be acquired
Acquire a lock on the resource .