Failed Conditions
Push — master ( e8410d...a45585 )
by Marcos
09:36 queued 11s
created

lib/Service/DeleteVaultRequestService.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Nextcloud - passman
4
 *
5
 * @copyright Copyright (c) 2016, Sander Brand ([email protected])
6
 * @copyright Copyright (c) 2016, Marcos Zuriaga Miguel ([email protected])
7
 * @license GNU AGPL version 3 or any later version
8
 *
9
 * This program is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License as
11
 * published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
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
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 */
23
24
namespace OCA\Passman\Service;
25
26
use OCA\Passman\Db\DeleteVaultRequest;
27
use OCA\Passman\Db\DeleteVaultRequestMapper;
28
use OCP\AppFramework\Db\Entity;
29
30
31
class DeleteVaultRequestService {
32
33
	private DeleteVaultRequestMapper $deleteVaultRequestMapper;
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
34
35
	public function __construct(DeleteVaultRequestMapper $deleteVaultRequestMapper) {
36
		$this->deleteVaultRequestMapper = $deleteVaultRequestMapper;
37
	}
38
39
	/**
40
	 *  Create a new DeleteVaultRequest
41
	 *
42
	 * @param $request DeleteVaultRequest
43
	 * @return DeleteVaultRequest
44
	 */
45
	public function createRequest(DeleteVaultRequest $request) {
46
		return $this->deleteVaultRequestMapper->insert($request);
47
	}
48
49
	/**
50
	 * Create a new DeleteVaultRequest
51
	 *
52
	 * @return Entity[]
53
	 */
54
	public function getDeleteRequests() {
55
		return $this->deleteVaultRequestMapper->getDeleteRequests();
56
	}
57
58
	/**
59
	 *  Create a new DeleteVaultRequest
60
	 *
61
	 * @param $vault_guid string The vault guid
62
	 * @return bool | Entity
63
	 */
64
	public function getDeleteRequestForVault(string $vault_guid) {
65
		try {
66
			return $this->deleteVaultRequestMapper->getDeleteRequestsForVault($vault_guid);
67
		} catch (\Exception $e) {
68
			return false;
69
		}
70
	}
71
72
	/**
73
	 *  Create a new DeleteVaultRequest
74
	 *
75
	 * @param $req DeleteVaultRequest
76
	 */
77
	public function removeDeleteRequestForVault(DeleteVaultRequest $req) {
78
		$this->deleteVaultRequestMapper->removeDeleteVaultRequest($req);
79
	}
80
}
81