DefaultProxy   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A addError() 0 4 1
A getValidator() 0 4 1
A isValid() 0 4 1
A setValidator() 0 4 1
A getErrors() 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\Validators;
15
16
use Maslosoft\Addendum\Interfaces\AnnotatedInterface;
17
use Maslosoft\Mangan\Interfaces\Validators\ValidatorInterface;
18
use Maslosoft\Mangan\Interfaces\Validators\ValidatorProxyInterface;
19
20
/**
21
 * BaseProxy
22
 *
23
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
24
 */
25
abstract class DefaultProxy implements ValidatorInterface, ValidatorProxyInterface
26
{
27
28
	/**
29
	 *
30
	 * @var ValidatorInterface
31
	 */
32
	private $validator = null;
33
34
	public function addError($message)
35
	{
36
		$this->validator->addError($message);
37
	}
38
39
	public function getValidator()
40
	{
41
		return $this->validator;
42
	}
43
44
	public function isValid(AnnotatedInterface $model, $attribute)
45
	{
46
		return $this->validator->isValid($model, $attribute);
47
	}
48
49
	public function setValidator(ValidatorInterface $validator)
50
	{
51
		$this->validator = $validator;
52
	}
53
54
	public function getErrors()
55
	{
56
		return $this->validator->getErrors();
57
	}
58
59
}
60