AbstractAnnotation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 51
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setPrevValue() 0 3 1
A setReader() 0 3 1
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
     * @return void
37
     */
38
    public function setReader(AnnotationReader $xReader): void
39
    {
40
        $this->xReader = $xReader;
41
    }
42
43
    /**
44
     * Set the attribute previous value
45
     *
46
     * @param mixed $xPrevValue The previous value of the attribute
47
     *
48
     * @return void
49
     */
50
    public function setPrevValue($xPrevValue): void
51
    {
52
        $this->xPrevValue = $xPrevValue;
53
    }
54
55
    /**
56
     * Get the annotation name
57
     *
58
     * This is usually the corresponding option name in the Jaxon config.
59
     *
60
     * @return string
61
     */
62
    abstract public function getName(): string;
63
64
    /**
65
     * Get the annotation value
66
     *
67
     * For attributes with multiple values, the previous value needs to be merged with the current.
68
     *
69
     * @return mixed
70
     */
71
    abstract public function getValue();
72
}
73