|
| 1 | +<?php |
| 2 | +declare(strict_types=1); |
| 3 | +/** |
| 4 | + * @copyright Copyright (c) 2016, ownCloud, Inc. |
| 5 | + * |
| 6 | + * @author Maxence Lange <[email protected]> |
| 7 | + * |
| 8 | + * @license AGPL-3.0 |
| 9 | + * |
| 10 | + * This code is free software: you can redistribute it and/or modify |
| 11 | + * it under the terms of the GNU Affero General Public License, version 3, |
| 12 | + * as published by the Free Software Foundation. |
| 13 | + * |
| 14 | + * This program is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + * GNU Affero General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU Affero General Public License, version 3, |
| 20 | + * along with this program. If not, see <http://www.gnu.org/licenses/> |
| 21 | + * |
| 22 | + */ |
| 23 | + |
| 24 | +namespace OCP\Lock; |
| 25 | + |
| 26 | +/** |
| 27 | + * Class ManuallyLockedException |
| 28 | + * |
| 29 | + * @package OCP\Lock |
| 30 | + * @since 18.0.0 |
| 31 | + */ |
| 32 | +class ManuallyLockedException extends LockedException { |
| 33 | + |
| 34 | + /** |
| 35 | + * owner of the lock |
| 36 | + * |
| 37 | + * @var string |
| 38 | + */ |
| 39 | + private $owner = ''; |
| 40 | + |
| 41 | + /** |
| 42 | + * estimated timeout for the lock |
| 43 | + * |
| 44 | + * @var int |
| 45 | + * @since 18.0.0 |
| 46 | + */ |
| 47 | + private $timeout = -1; |
| 48 | + |
| 49 | + /** |
| 50 | + * ManuallyLockedException constructor. |
| 51 | + * |
| 52 | + * @param string $path locked path |
| 53 | + * @param \Exception|null $previous previous exception for cascading |
| 54 | + * @param string $existingLock |
| 55 | + * @param string $owner |
| 56 | + * @param int $timeout |
| 57 | + * |
| 58 | + * @since 18.0.0 |
| 59 | + */ |
| 60 | + public function __construct(string $path, \Exception $previous = null, string $existingLock = null, string $owner = '', int $timeout = -1) { |
| 61 | + parent::__construct($path, $previous, $existingLock); |
| 62 | + $this->owner = $owner; |
| 63 | + $this->timeout = $timeout; |
| 64 | + } |
| 65 | + |
| 66 | + |
| 67 | + /** |
| 68 | + * @return int |
| 69 | + * @since 18.0.0 |
| 70 | + */ |
| 71 | + public function getTimeout(): int { |
| 72 | + return $this->timeout; |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * @return string |
| 77 | + * @since 18.0.0 |
| 78 | + */ |
| 79 | + public function getOwner(): string { |
| 80 | + return $this->owner; |
| 81 | + } |
| 82 | + |
| 83 | +} |
0 commit comments