CreateEvent   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 5
Bugs 1 Features 1
Metric Value
c 5
b 1
f 1
dl 0
loc 53
wmc 5
lcom 1
cbo 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getDocument() 0 11 2
A setDocument() 0 4 1
A getAlias() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of Sulu.
5
 *
6
 * (c) MASSIVE ART WebServices GmbH
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Sulu\Component\DocumentManager\Event;
13
14
class CreateEvent extends AbstractEvent
15
{
16
    /**
17
     * @var object
18
     */
19
    private $document;
20
21
    /**
22
     * @var string
23
     */
24
    private $alias;
25
26
    /**
27
     * @param string $alias
28
     */
29
    public function __construct($alias)
30
    {
31
        $this->alias = $alias;
32
    }
33
34
    /**
35
     * @return object
36
     *
37
     * @throws \RuntimeException
38
     */
39
    public function getDocument()
40
    {
41
        if (!$this->document) {
42
            throw new \RuntimeException(
43
                'No document has been set, an event listener should have created a document before ' .
44
                'this method was called.'
45
            );
46
        }
47
48
        return $this->document;
49
    }
50
51
    /**
52
     * @param object $document
53
     */
54
    public function setDocument($document)
55
    {
56
        $this->document = $document;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getAlias()
63
    {
64
        return $this->alias;
65
    }
66
}
67