HydrateEvent::setLocale()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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