-
Notifications
You must be signed in to change notification settings - Fork 0
/
Group.php
72 lines (63 loc) · 1.36 KB
/
Group.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Created by IntelliJ IDEA.
* User: Mattias Kågström
* Date: 2017-04-04
* Time: 11:20
*/
class Group
{
private $id, $prio, $name, $users = array(), $applications = array();
function __construct($id, $prio, $name)
{
$this->id = $id;
$this->prio = $prio;
$this->name = $name;
}
function __toString()
{
return json_encode($this->getObject());
}
function getObject()
{
$group["id"] = $this->id;
$group["prio"] = $this->prio;
$group["name"] = $this->name;
$group["users"] = $this->users;
$group["applications"] = $this->applications;
return $group;
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getPrio()
{
return $this->prio;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param $user User, the user to ad to the group
*/
public function addUser($user){
array_push($this->users, $user->getObject());
}
/**
* @param $application Application, The application to add to the grop
*/
public function addApplication($application){
array_push($this->applications, $application->getObject());
}
}