src/Helpers/FileHelperAsc.php
public static function lock($filePath, $timeout = null)
    {
        $filePath = FileHelper::normalizePath($filePath);
        $timeout = isset($timeout) ? $timeout : static::$LockTimeout;
        $expire = time() + $timeout;
        if (isset(static::$_lockedFiles[$filePath])) {
            $expire = static::$_lockedFiles[$filePath] <= $expire ? $expire : static::$_lockedFiles[$filePath];
        }
        static::$_lockedFiles[$filePath] = $expire;
        static::checkUnlockTimer();
    }
public static function lock($filePath, $timeout = null)
    {
        $filePath = FileHelper::normalizePath($filePath);
        $timeout = isset($timeout) ? $timeout : static::$LockTimeout;
        $expire = time() + $timeout;
        if (isset(static::$_lockedFiles[$filePath])) {
            $expire = static::$_lockedFiles[$filePath] <= $expire ? $expire : static::$_lockedFiles[$filePath];
        }
        static::$_lockedFiles[$filePath] = $expire;
        static::checkUnlockTimer();
    }
Lock file for some time or until some operation is not finished
@param string $filePath
@param int $timeout