Completed
Pull Request — master (#6)
by Christopher
15:01 queued 06:11
created

Event::authoriser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TechWilk\Rota;
4
5
use TechWilk\Rota\Authoriser\EventAuthoriser;
6
use TechWilk\Rota\Base\Event as BaseEvent;
7
8
/**
9
 * Skeleton subclass for representing a row from the 'cr_events' table.
10
 *
11
 *
12
 *
13
 * You should add additional methods to this class to meet the
14
 * application requirements.  This class will only be generated as
15
 * long as it does not already exist in the output directory.
16
 */
17
class Event extends BaseEvent
18
{
19
    /**
20
     * Get array of userroles currently assigned to the event.
21
     *
22
     * @return array of UserRole() objects
23
     */
24
    public function getCurrentUserRoles()
25
    {
26
        $eventPeople = $this->getEventPeople();
27
28
        $userRoles = [];
29
        foreach ($eventPeople as $eventPerson) {
30
            $userRoles[] = $eventPerson->getUserRole();
31
        }
32
33
        return $userRoles;
34
    }
35
36
    public function authoriser()
37
    {
38
        return new EventAuthoriser($this);
39
    }
40
}
41