Passed
Push — master ( 902adb...3cf321 )
by Christoph
10:44 queued 11s
created

Card::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @copyright 2020 Christoph Wurst <[email protected]>
7
 *
8
 * @author 2020 Christoph Wurst <[email protected]>
9
 *
10
 * @license GNU AGPL version 3 or any later version
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License as
14
 * published by the Free Software Foundation, either version 3 of the
15
 * License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU Affero General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 */
25
26
namespace OCA\ContactsInteraction;
27
28
use OCA\ContactsInteraction\Db\RecentContact;
29
use Sabre\CardDAV\ICard;
30
use Sabre\DAV\Exception\NotImplemented;
31
use Sabre\DAVACL\ACLTrait;
32
use Sabre\DAVACL\IACL;
33
34
class Card implements ICard, IACL {
35
36
	use ACLTrait;
37
38
	/** @var RecentContact */
39
	private $contact;
40
41
	/** @var string */
42
	private $principal;
43
44
	/** @var array */
45
	private $acls;
46
47
	public function __construct(RecentContact $contact, string $principal, array $acls) {
48
		$this->contact = $contact;
49
		$this->principal = $principal;
50
		$this->acls = $acls;
51
	}
52
53
	/**
54
	 * @inheritDoc
55
	 */
56
	function getOwner(): ?string {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
57
		$this->principal;
58
	}
59
60
	/**
61
	 * @inheritDoc
62
	 */
63
	function getACL(): array {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
64
		return $this->acls;
65
	}
66
67
	/**
68
	 * @inheritDoc
69
	 */
70
	function setAcls(array $acls): void {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Unused Code introduced by
The parameter $acls is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

70
	function setAcls(/** @scrutinizer ignore-unused */ array $acls): void {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
71
		throw new NotImplemented();
72
	}
73
74
	/**
75
	 * @inheritDoc
76
	 */
77
	function put($data): ?string {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
78
		throw new NotImplemented();
79
	}
80
81
	/**
82
	 * @inheritDoc
83
	 */
84
	function get() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
85
		return $this->contact->getCard();
86
	}
87
88
	/**
89
	 * @inheritDoc
90
	 */
91
	function getContentType(): ?string {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
92
		return 'text/vcard; charset=utf-8';
93
	}
94
95
	/**
96
	 * @inheritDoc
97
	 */
98
	function getETag(): ?string {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
99
		return null;
100
	}
101
102
	/**
103
	 * @inheritDoc
104
	 */
105
	function getSize(): int {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
106
		throw new NotImplemented();
107
	}
108
109
	/**
110
	 * @inheritDoc
111
	 */
112
	function delete(): void {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
113
		throw new NotImplemented();
114
	}
115
116
	/**
117
	 * @inheritDoc
118
	 */
119
	function getName(): string {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
120
		return (string) $this->contact->getId();
121
	}
122
123
	/**
124
	 * @inheritDoc
125
	 */
126
	function setName($name): void {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
127
		throw new NotImplemented();
128
	}
129
130
	/**
131
	 * @inheritDoc
132
	 */
133
	function getLastModified(): ?int {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
134
		return $this->contact->getLastContact();
135
	}
136
137
}
138