1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of PhpUnitGen. |
5
|
|
|
* |
6
|
|
|
* (c) 2017-2018 Paul Thébaud <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE.md |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace PhpUnitGen\Annotation; |
13
|
|
|
|
14
|
|
|
use PhpUnitGen\Annotation\AnnotationInterface\AnnotationInterface; |
15
|
|
|
use PhpUnitGen\Model\PropertyTrait\NodeTrait; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class AbstractAnnotation. |
19
|
|
|
* |
20
|
|
|
* @author Paul Thébaud <[email protected]>. |
21
|
|
|
* @copyright 2017-2018 Paul Thébaud <[email protected]>. |
22
|
|
|
* @license https://opensource.org/licenses/MIT The MIT license. |
23
|
|
|
* @link https://github.com/paul-thebaud/phpunit-generator |
24
|
|
|
* @since Class available since Release 2.0.0. |
25
|
|
|
*/ |
26
|
|
|
abstract class AbstractAnnotation implements AnnotationInterface |
27
|
|
|
{ |
28
|
|
|
use NodeTrait; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string $name The annotation name (such as "@PhpUnitGen\AssertTrue()"). |
32
|
|
|
*/ |
33
|
|
|
private $name; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var int $line The annotation line on documentation block. |
37
|
|
|
*/ |
38
|
|
|
private $line; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string|null $stringContent The string content of annotation, null if none. |
42
|
|
|
*/ |
43
|
|
|
private $stringContent; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* {@inheritdoc} |
47
|
|
|
*/ |
48
|
|
|
abstract public function getType(): int; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* {@inheritdoc} |
52
|
|
|
*/ |
53
|
|
|
abstract public function compile(): void; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* {@inheritdoc} |
57
|
|
|
*/ |
58
|
|
|
public function setName(string $name): void |
59
|
|
|
{ |
60
|
|
|
$this->name = $name; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* {@inheritdoc} |
65
|
|
|
*/ |
66
|
|
|
public function getName(): string |
67
|
|
|
{ |
68
|
|
|
return $this->name; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* {@inheritdoc} |
73
|
|
|
*/ |
74
|
|
|
public function setLine(int $line): void |
75
|
|
|
{ |
76
|
|
|
$this->line = $line; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* {@inheritdoc} |
81
|
|
|
*/ |
82
|
|
|
public function getLine(): int |
83
|
|
|
{ |
84
|
|
|
return $this->line; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* {@inheritdoc} |
89
|
|
|
*/ |
90
|
|
|
public function setStringContent(?string $stringContent): void |
91
|
|
|
{ |
92
|
|
|
$this->stringContent = $stringContent; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* {@inheritdoc} |
97
|
|
|
*/ |
98
|
|
|
public function getStringContent(): ?string |
99
|
|
|
{ |
100
|
|
|
return $this->stringContent; |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|