Code Duplication    Length = 51-51 lines in 2 locations

src/Annotation/Serializer/DeserializerContext.php 1 location

@@ 20-70 (lines=51) @@
17
 * @Annotation
18
 * @Target({"CLASS", "METHOD"})
19
 */
20
class DeserializerContext implements DynamoAnnotation
21
{
22
    const NAME = 'deserializer_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, 'DeserializerContext must be passed a value');
37
        Tebru\assertTrue(is_array($params['value']), 'DeserializerContext 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

src/Annotation/Serializer/SerializerContext.php 1 location

@@ 20-70 (lines=51) @@
17
 * @Annotation
18
 * @Target({"CLASS", "METHOD"})
19
 */
20
class SerializerContext implements DynamoAnnotation
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