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

LabelAnnotation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 4 1
A __toString() 0 4 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