Completed
Push — master ( 184221...41c13d )
by Peter
05:18
created

LabelAnnotation::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * This software package is licensed under AGPL or Commercial license.
5
 *
6
 * @package maslosoft/mangan
7
 * @licence AGPL or Commercial
8
 * @copyright Copyright (c) Piotr Masełkowski <[email protected]>
9
 * @copyright Copyright (c) Maslosoft
10
 * @copyright Copyright (c) Others as mentioned in code
11
 * @link https://maslosoft.com/mangan/
12
 */
13
14
namespace Maslosoft\Mangan\Annotations;
15
16
use Maslosoft\Mangan\Meta\ManganPropertyAnnotation;
17
18
/**
19
 * Label
20
 * Set entity's 'label' field
21
 * @template Label('${text}')
22
 */
23
class LabelAnnotation extends ManganPropertyAnnotation
24
{
25
26
	public $value = '';
27
28 65
	public function init()
29
	{
30 65
		$this->getEntity()->label = $this->value;
31 65
	}
32
33 1
	public function __toString()
34
	{
35 1
		return $this->value;
36
	}
37
38
}
39