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

DeserializationContext::getName()   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
use Tebru\Dynamo\Annotation\DynamoAnnotation;
10
11
/**
12
 * DeserializationContext
13
 *
14
 * Define a context when deserializing an object from a response.
15
 *
16
 * @author Matthew Loberg <[email protected]>
17
 * @author Nate Brunette <[email protected]>
18
 *
19
 * @Annotation
20
 * @Target({"CLASS", "METHOD"})
21
 */
22
class DeserializationContext extends JmsSerializerContext implements DynamoAnnotation
23
{
24
    const NAME = 'deserialization_context';
25
26
    /**
27
     * Depth to use while deserializing
28
     *
29
     * @var int
30
     */
31
    private $depth;
32
33
    /**
34
     * Constructor
35
     *
36
     * @param array $params
37
     */
38
    public function __construct(array $params)
39
    {
40
        if (array_key_exists('depth', $params)) {
41
            $this->depth = $params['depth'];
42
            unset($params['depth']);
43
        }
44
45
        parent::__construct($params);
46
    }
47
48
    /**
49
     * Get Depth
50
     *
51
     * @return int
52
     */
53
    public function getDepth()
54
    {
55
        return $this->depth;
56
    }
57
58
    /**
59
     * The name of the annotation or class of annotations
60
     *
61
     * @return string
62
     */
63
    public function getName()
64
    {
65
        return self::NAME;
66
    }
67
68
    /**
69
     * Whether or not multiple annotations of this type can
70
     * be added to a method
71
     *
72
     * @return bool
73
     */
74
    public function allowMultiple()
75
    {
76
        return false;
77
    }
78
}
79