HydrateEvent   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getDocument() 0 11 2
A setDocument() 0 5 1
A setLocale() 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
use PHPCR\NodeInterface;
15
16
class HydrateEvent extends AbstractMappingEvent
17
{
18
    /**
19
     * @param NodeInterface $node
20
     * @param string $locale
21
     * @param array $options
22
     */
23
    public function __construct(NodeInterface $node, $locale, array $options = [])
24
    {
25
        $this->locale = $locale;
26
        $this->node = $node;
27
        $this->options = $options;
0 ignored issues
show
Documentation Bug introduced by
It seems like $options of type array is incompatible with the declared type object<Symfony\Component...solver\OptionsResolver> of property $options.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
28
    }
29
30
    /**
31
     * @return object
32
     *
33
     * @throws \RuntimeException
34
     */
35
    public function getDocument()
36
    {
37
        if (null === $this->document) {
38
            throw new \RuntimeException(
39
                'Trying to retrieve document when no document has been set. An event ' .
40
                'listener should have set the document.'
41
            );
42
        }
43
44
        return $this->document;
45
    }
46
47
    /**
48
     * @param object $document
49
     */
50
    public function setDocument($document)
51
    {
52
        $this->document = $document;
53
        $this->accessor = null;
54
    }
55
56
    /**
57
     * @param string $locale
58
     */
59
    public function setLocale($locale)
60
    {
61
        $this->locale = $locale;
62
    }
63
}
64