Completed
Push — master ( 8b683f...7025f1 )
by Morris
29:10 queued 12:40
created

CloudFederationNotification   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 35
rs 10
wmc 2
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setMessage() 0 9 1
A getMessage() 0 3 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2018 Bjoern Schiessle <[email protected]>
4
 *
5
 * @license GNU AGPL version 3 or any later version
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Affero General Public License as
9
 * published by the Free Software Foundation, either version 3 of the
10
 * License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 */
21
22
namespace OC\Federation;
23
24
use OCP\Federation\ICloudFederationNotification;
25
26
/**
27
 * Class CloudFederationNotification
28
 *
29
 * @package OC\Federation
30
 *
31
 * @since 14.0.0
32
 */
33
class CloudFederationNotification implements ICloudFederationNotification {
34
35
	private $message = [];
36
37
	/**
38
	 * add a message to the notification
39
	 *
40
	 * @param string $notificationType (e.g. SHARE_ACCEPTED)
41
	 * @param string $resourceType (e.g. file, calendar, contact,...)
42
	 * @param string $providerId id of the share
43
	 * @param array $notification payload of the notification
44
	 *
45
	 * @since 14.0.0
46
	 */
47
	public function setMessage($notificationType, $resourceType, $providerId, array $notification) {
48
		$this->message = [
49
			'notificationType' => $notificationType,
50
			'resourceType' => $resourceType,
51
			'providerId' => $providerId,
52
			'notification' => $notification,
53
		];
54
55
	}
56
57
	/**
58
	 * get message, ready to send out
59
	 *
60
	 * @return array
61
	 *
62
	 * @since 14.0.0
63
	 */
64
	public function getMessage() {
65
		return $this->message;
66
	}
67
}
68