BaseMeta   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 27
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 4
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\Meta;
15
16
/**
17
 * BaseMeta
18
 *
19
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
20
 */
21
abstract class BaseMeta
22
{
23
24
	use \Maslosoft\Addendum\Traits\MetaState;
25
26
	/**
27
	 * BaseMeta constructor.
28
	 * @param array|null $data
29
	 */
30 68
	public function __construct($data = null)
31
	{
32
		// For internal use
33 68
		if (null === $data)
34
		{
35 65
			return;
36
		}
37
38 48
		if (is_array($data))
39
		{
40 48
			foreach ($data as $key => $value)
41
			{
42 47
				$this->$key = $value;
43
			}
44
		}
45 48
	}
46
47
}
48