Passed
Push — master ( fce6df...8e01ff )
by Georg
14:04 queued 11s
created

UserLiveStatusEvent::getTimestamp()   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 Copyright (c) 2020, Georg Ehrke
7
 *
8
 * @author Georg Ehrke <[email protected]>
9
 *
10
 * @license AGPL-3.0
11
 *
12
 * This code is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License, version 3,
14
 * as published by the Free Software Foundation.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License, version 3,
22
 * along with this program. If not, see <http://www.gnu.org/licenses/>
23
 *
24
 */
25
26
namespace OCP\User\Events;
27
28
use OCP\EventDispatcher\Event;
29
use OCP\IUser;
30
31
/**
32
 * @since 20.0.0
33
 */
34
class UserLiveStatusEvent extends Event {
35
36
	/**
37
	 * @var string
38
	 * @since 20.0.0
39
	 */
40
	public const STATUS_ONLINE = 'online';
41
42
	/**
43
	 * @var string
44
	 * @since 20.0.0
45
	 */
46
	public const STATUS_AWAY = 'away';
47
48
	/**
49
	 * @var string
50
	 * @since 20.0.0
51
	 */
52
	public const STATUS_OFFLINE = 'offline';
53
54
	/** @var IUser */
55
	private $user;
56
57
	/** @var string */
58
	private $status;
59
60
	/** @var int */
61
	private $timestamp;
62
63
	/**
64
	 * @param IUser $user
65
	 * @param string $status
66
	 * @param int $timestamp
67
	 * @since 20.0.0
68
	 */
69
	public function __construct(IUser $user,
70
								string $status,
71
								int $timestamp) {
72
		parent::__construct();
73
		$this->user = $user;
74
		$this->status = $status;
75
		$this->timestamp = $timestamp;
76
	}
77
78
	/**
79
	 * @return IUser
80
	 * @since 20.0.0
81
	 */
82
	public function getUser(): IUser {
83
		return $this->user;
84
	}
85
86
	/**
87
	 * @return string
88
	 * @since 20.0.0
89
	 */
90
	public function getStatus(): string {
91
		return $this->status;
92
	}
93
94
	/**
95
	 * @return int
96
	 * @since 20.0.0
97
	 */
98
	public function getTimestamp(): int {
99
		return $this->timestamp;
100
	}
101
}
102