Completed
Push — master ( 841bb5...43701d )
by Nate
09:20
created

JmsSerializerContext::getAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
 * Copyright (c) Nate Brunette.
4
 * Distributed under the MIT License (http://opensource.org/licenses/MIT)
5
 */
6
7
namespace Tebru\Retrofit\Annotation\Serializer;
8
9
/**
10
 * Class JmsSerializerContext
11
 *
12
 * @author Matthew Loberg <[email protected]>
13
 * @author Nate Brunette <[email protected]>
14
 */
15
abstract class JmsSerializerContext
16
{
17
    /**
18
     * Serialization groups
19
     *
20
     * @var array
21
     */
22
    private $groups;
23
24
    /**
25
     * Object version
26
     *
27
     * @var int
28
     */
29
    private $version;
30
31
    /**
32
     * If we should serialize null values
33
     *
34
     * @var bool
35
     */
36
    private $serializeNull = false;
37
38
    /**
39
     * If we should check depth
40
     *
41
     * @var bool
42
     */
43
    private $enableMaxDepthChecks = false;
44
45
    /**
46
     * Extra attributes
47
     *
48
     * @var array
49
     */
50
    private $attributes = [];
51
52
    /**
53
     * Constructor
54
     *
55
     * @param array $params
56
     */
57
    public function __construct(array $params)
58
    {
59
        if (array_key_exists('groups', $params)) {
60
            $this->groups = (array) $params['groups'];
61
            unset($params['groups']);
62
        }
63
64
        if (array_key_exists('version', $params)) {
65
            $this->version = $params['version'];
66
            unset($params['version']);
67
        }
68
69
        if (array_key_exists('serializeNull', $params)) {
70
            $this->serializeNull = $params['serializeNull'];
71
            unset($params['serializeNull']);
72
        }
73
74
        if (array_key_exists('enableMaxDepthChecks', $params)) {
75
            $this->enableMaxDepthChecks = $params['enableMaxDepthChecks'];
76
            unset($params['enableMaxDepthChecks']);
77
        }
78
79
        $this->attributes = $params;
80
    }
81
82
    /**
83
     * Get Groups
84
     *
85
     * @return array
86
     */
87
    public function getGroups()
88
    {
89
        return $this->groups;
90
    }
91
92
    /**
93
     * Get version
94
     *
95
     * @return int
96
     */
97
    public function getVersion()
98
    {
99
        return $this->version;
100
    }
101
102
    /**
103
     * Get SerializeNull
104
     *
105
     * @return bool
106
     */
107
    public function getSerializeNull()
108
    {
109
        return $this->serializeNull;
110
    }
111
112
    /**
113
     * Get enable max depth checks
114
     *
115
     * @return bool
116
     */
117
    public function getEnableMaxDepthChecks()
118
    {
119
        return $this->enableMaxDepthChecks;
120
    }
121
122
    /**
123
     * Get Attributes
124
     *
125
     * @return array
126
     */
127
    public function getAttributes()
128
    {
129
        return $this->attributes;
130
    }
131
}
132