Completed
Push — master ( bc20b4...b7ce52 )
by Nate
03:15
created

Since::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 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\Gson\Annotation;
8
9
use Tebru\AnnotationReader\AbstractAnnotation;
10
11
/**
12
 * Class Since
13
 *
14
 * Used to exclude classes or properties that should not be serialized if the version number
15
 * is less than the @Since value.  Will not be used if version number is not defined on the
16
 * builder.
17
 *
18
 * @author Nate Brunette <[email protected]>
19
 *
20
 * @Annotation
21
 * @Target({"CLASS", "PROPERTY", "METHOD"})
22
 */
23
class Since extends AbstractAnnotation
24
{
25
    /**
26
     * @var string
27
     */
28
    private $value;
29
30
    /**
31
     * Initialize annotation data
32
     */
33 2
    protected function init(): void
34
    {
35 2
        $this->assertKey();
36
37 1
        $this->value = (string)$this->data['value'];
38 1
    }
39
40
    /**
41
     * Get the value
42
     *
43
     * @return string
44
     */
45 1
    public function getValue()
46
    {
47 1
        return $this->value;
48
    }
49
50
51
}
52