TagMeta   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 42
rs 10
c 2
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A toJson() 0 4 1
1
<?php
2
3
/**
4
 * This software package is licensed under `AGPL, Commercial` license[s].
5
 *
6
 * @package maslosoft/zamm
7
 * @license AGPL, Commercial
8
 *
9
 * @copyright Copyright (c) Peter Maselkowski <[email protected]>
10
 * @link https://maslosoft.com/zamm/
11
 */
12
13
namespace Maslosoft\Zamm\Meta;
14
15
use Maslosoft\Zamm\Decorators\ZammTags;
16
use Maslosoft\Zamm\Interfaces\Renderers\RendererInterface;
17
18
/**
19
 * TagMeta
20
 * @see ZammTags
21
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
22
 */
23
class TagMeta
24
{
25
26
	/**
27
	 * Current working class name
28
	 * @var string
29
	 */
30
	public $className = '';
31
32
	/**
33
	 * Current method or property name
34
	 * @var string
35
	 */
36
	public $name = '';
37
38
	/**
39
	 * Implemented renderer interfaces
40
	 * @var string[]
41
	 */
42
	public $interfaces = [];
43
44
	/**
45
	 * Class constructor
46
	 * @param RendererInterface $renderer
47
	 */
48
	public function __construct(RendererInterface $renderer)
49
	{
50
		$this->interfaces = class_implements($renderer);
51
		$this->className = $renderer->getClassName();
52
		$this->name = $renderer->getName();
53
	}
54
55
	/**
56
	 * Convert to json
57
	 * @return string
58
	 */
59
	public function toJson()
60
	{
61
		return json_encode($this, JSON_FORCE_OBJECT);
62
	}
63
64
}
65