NotificationEvent   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 5
A getEvent() 0 4 1
A isActive() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the XabbuhPandaClient package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Xabbuh\PandaClient\Model;
13
14
/**
15
 * Representation of notification events consisting of an event name and its
16
 * activation state.
17
 *
18
 * @author Christian Flothmann <[email protected]>
19
 */
20
class NotificationEvent
21
{
22
    private $event;
23
24
    private $active;
25
26
    public function __construct($event, $active)
27
    {
28
        // normalise event names
29
        $event = strtr($event, '_', '-');
30
31
        // check for valid event names
32
        if (
33
            $event != 'video-created' && $event != 'video-encoded' &&
34
            $event != 'encoding-progress' && $event != 'encoding-completed'
35
        ) {
36
            throw new \InvalidArgumentException('Unknown notification event $event');
37
        }
38
39
        $this->event = $event;
40
        $this->active = $active;
41
    }
42
43
    public function getEvent()
44
    {
45
        return $this->event;
46
    }
47
48
    public function isActive()
49
    {
50
        return $this->active;
51
    }
52
}
53