Completed
Push — master ( 00c305...784882 )
by Nate
03:32
created

SerializerContext::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
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;
10
use Tebru\Dynamo\Annotation\DynamoAnnotation;
11
12
/**
13
 * Class SerializerContext
14
 *
15
 * @author Nate Brunette <[email protected]>
16
 *
17
 * @Annotation
18
 * @Target({"CLASS", "METHOD"})
19
 */
20 View Code Duplication
class SerializerContext implements DynamoAnnotation
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
{
22
    const NAME = 'serializer_context';
23
24
    /**
25
     * @var array
26
     */
27
    private $values;
28
29
    /**
30
     * Constructor
31
     *
32
     * @param array $params
33
     */
34
    public function __construct(array $params)
35
    {
36
        Tebru\assertArrayKeyExists('value', $params, 'SerializerContext must be passed a value');
37
        Tebru\assertTrue(is_array($params['value']), 'SerializerContext value must be an array');
38
39
        $this->values = $params['value'];
40
    }
41
42
    /**
43
     * @return array
44
     */
45
    public function getContext()
46
    {
47
        return $this->values;
48
    }
49
50
    /**
51
     * The name of the annotation or class of annotations
52
     *
53
     * @return string
54
     */
55
    public function getName()
56
    {
57
        return self::NAME;
58
    }
59
60
    /**
61
     * Whether or not multiple annotations of this type can
62
     * be added to a method
63
     *
64
     * @return bool
65
     */
66
    public function allowMultiple()
67
    {
68
        return false;
69
    }
70
}
71