Passed
Push — main ( 813e95...426dc3 )
by Thierry
07:49
created

AbstractAnnotation::setReader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * AbstractAnnotation.php
5
 *
6
 * Common functions for Jaxon annotations.
7
 *
8
 * @package jaxon-annotations
9
 * @author Thierry Feuzeu <[email protected]>
10
 * @copyright 2022 Thierry Feuzeu <[email protected]>
11
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
12
 * @link https://github.com/jaxon-php/jaxon-annotations
13
 */
14
15
namespace Jaxon\Annotations\Annotation;
16
17
use Jaxon\Annotations\AnnotationReader;
18
use mindplay\annotations\Annotation;
19
use mindplay\annotations\IAnnotationParser;
20
21
abstract class AbstractAnnotation extends Annotation implements IAnnotationParser
22
{
23
    /**
24
     * @var AnnotationReader
25
     */
26
    protected $xReader;
27
28
    /**
29
     * @var mixed
30
     */
31
    protected $xPrevValue = null;
32
33
    /**
34
     * @param AnnotationReader $xReader
35
     */
36
    public function setReader(AnnotationReader $xReader): void
37
    {
38
        $this->xReader = $xReader;
39
    }
40
41
    /**
42
     * Set the attribute previous value
43
     *
44
     * @param mixed $xPrevValue The previous value of the attribute
45
     *
46
     * @return void
47
     */
48
    public function setPrevValue($xPrevValue)
49
    {
50
        $this->xPrevValue = $xPrevValue;
51
    }
52
53
    /**
54
     * Get the annotation name
55
     *
56
     * This is usually the corresponding option name in the Jaxon config.
57
     *
58
     * @return string
59
     */
60
    abstract public function getName(): string;
61
62
    /**
63
     * Get the annotation value
64
     *
65
     * For attributes with multiple values, the previous value needs to be merged with the current.
66
     *
67
     * @return mixed
68
     */
69
    abstract public function getValue();
70
}
71