SchemaProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 60%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addMapping() 0 4 1
A getMapping() 0 4 1
1
<?php
2
/**
3
 * SchemaProvider.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        https://www.ipublikuj.eu
7
 * @author         Adam Kadlec <[email protected]>
8
 * @package        iPublikuj:JsonAPIClient!
9
 * @subpackage     Schemas
10
 * @since          1.0.0
11
 *
12
 * @date           05.05.18
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\JsonAPIClient\Schemas;
18
19
use Nette;
20
21
/**
22
 * Schemas provider
23
 *
24
 * @package        iPublikuj:JsonAPIClient!
25
 * @subpackage     Schemas
26
 *
27
 * @author         Adam Kadlec <[email protected]>
28
 */
29 1
final class SchemaProvider
30
{
31
	/**
32
	 * Implement nette smart magic
33
	 */
34 1
	use Nette\SmartObject;
35
36
	/**
37
	 * @var array
38
	 */
39
	private $mapping = [];
40
41
	/**
42
	 * @param string $entity
43
	 * @param string|callable $schema
44
	 *
45
	 * @return void
46
	 */
47
	public function addMapping(string $entity, $schema) : void
48
	{
49
		$this->mapping[$entity] = $schema;
50
	}
51
52
	/**
53
	 * @return array
54
	 */
55
	public function getMapping() : array
56
	{
57 1
		return $this->mapping;
58
	}
59
}
60