Completed
Pull Request — master (#326)
by Maxence
01:32
created

SharesToken::getUserId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Circles - Bring cloud-users closer together.
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Maxence Lange <[email protected]>
9
 * @copyright 2017
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
27
namespace OCA\Circles\Model;
28
29
30
use daita\MySmallPhpTools\Traits\TArrayTools;
31
use JsonSerializable;
32
33
34
/**
35
 * Class SharesToken
36
 *
37
 * @package OCA\Circles\Model
38
 */
39
class SharesToken implements JsonSerializable {
40
41
42
	use TArrayTools;
43
44
45
	/** @var string */
46
	private $circleId = '';
47
48
	/** @var string */
49
	private $userId = '';
50
51
	/** @var int */
52
	private $shareId = 0;
53
54
	/** @var string */
55
	private $token = '';
56
57
58
	/**
59
	 * SharesToken constructor.
60
	 */
61
	function __construct() {
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...
62
	}
63
64
65
	/**
66
	 * @return string
67
	 */
68
	public function getCircleId(): string {
69
		return $this->circleId;
70
	}
71
72
	/**
73
	 * @param string $circleId
74
	 *
75
	 * @return SharesToken
76
	 */
77
	public function setCircleId(string $circleId): self {
78
		$this->circleId = $circleId;
79
80
		return $this;
81
	}
82
83
84
	/**
85
	 * @return string
86
	 */
87
	public function getUserId(): string {
88
		return $this->userId;
89
	}
90
91
	/**
92
	 * @param string $userId
93
	 *
94
	 * @return SharesToken
95
	 */
96
	public function setUserId(string $userId): self {
97
		$this->userId = $userId;
98
99
		return $this;
100
	}
101
102
103
	/**
104
	 * @return int
105
	 */
106
	public function getShareId(): int {
107
		return $this->shareId;
108
	}
109
110
	/**
111
	 * @param int $shareId
112
	 *
113
	 * @return SharesToken
114
	 */
115
	public function setShareId(int $shareId): self {
116
		$this->shareId = $shareId;
117
118
		return $this;
119
	}
120
121
122
	/**
123
	 * @return string
124
	 */
125
	public function getToken(): string {
126
		return $this->token;
127
	}
128
129
	/**
130
	 * @param string $token
131
	 *
132
	 * @return SharesToken
133
	 */
134
	public function setToken(string $token): self {
135
		$this->token = $token;
136
137
		return $this;
138
	}
139
140
141
	/**
142
	 * @param array $data
143
	 */
144
	function import(array $data) {
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...
145
		$this->setCircleId($this->get('circle_id', $data, ''));
146
		$this->setUserId($this->get('user_id', $data, ''));
147
		$this->setShareId($this->get('share_id', $data, ''));
148
		$this->setToken($this->get('token_id', $data, ''));
149
	}
150
151
152
	/**
153
	 * @return array
154
	 */
155
	function jsonSerialize(): 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...
156
		return [
157
			'circleId' => $this->getCircleId(),
158
			'userId'   => $this->getUserId(),
159
			'shareId'  => $this->getShareId(),
160
			'token'    => $this->getToken()
161
		];
162
	}
163
164
}
165
166