private function tryAcquire($operation, $lock_type)
    {
        $log_data = [
            "lock_file" => $this->lock_file,
            "lock_type" => $lock_type
        ];

        if (!$this->flock($operation)) {
            $this->logger->debug("could not acquire {lock_type} lock on {lock_file}", $log_data);

            throw new RuntimeException(
                "Could not acquire $lock_type lock on {$this->lock_file}"
            );

        }

        $this->logger->debug("{lock_type} lock acquired on {lock_file}", $log_data);
    }
private function tryAcquire($operation, $lock_type)
    {
        $log_data = [
            "lock_file" => $this->lock_file,
            "lock_type" => $lock_type
        ];

        if (!$this->flock($operation)) {
            $this->logger->debug("could not acquire {lock_type} lock on {lock_file}", $log_data);

            throw new RuntimeException(
                "Could not acquire $lock_type lock on {$this->lock_file}"
            );

        }

        $this->logger->debug("{lock_type} lock acquired on {lock_file}", $log_data);
    }
private function tryAcquire ( $ operation , $ lock_type ) { $ log_data = [ "lock_file" => $ this -> lock_file , "lock_type" => $ lock_type ] ; if ( ! $ this -> flock ( $ operation ) ) { $ this -> logger -> debug ( "could not acquire {lock_type} lock on {lock_file}" , $ log_data ) ; throw new RuntimeException ( "Could not acquire $lock_type lock on {$this->lock_file}" ) ; } $ this -> logger -> debug ( "{lock_type} lock acquired on {lock_file}" , $ log_data ) ; }
try to acquire lock on file, throw in case of faillure
@param  int    $operation
@param  string $lock_type lock type description
@return void
@see https://php.net/flock
try to acquire lock on file throw in case of faillure