Passed
Push — master ( 3592a4...bf89a7 )
by Jean-Christophe
05:06
created

GreaterThanOrEqualValidator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 17
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A validate() 0 3 1
A getParameters() 0 2 1
A __construct() 0 2 1
1
<?php
2
3
namespace Ubiquity\contents\validation\validators\comparison;
4
5
6
use Ubiquity\contents\validation\validators\ValidatorHasNotNull;
7
8
class GreaterThanOrEqualValidator extends ValidatorHasNotNull {
9
	
10
	protected $ref;
11
	
12 1
	public function __construct(){
13 1
		$this->message="This value should be greater or equal than `{ref}`";
14 1
	}
15 1
	public function validate($value) {
16 1
		parent::validate($value);
17 1
		return $value>=$this->ref;
18
	}
19
	/**
20
	 * {@inheritDoc}
21
	 * @see \Ubiquity\contents\validation\validators\Validator::getParameters()
22
	 */
23 1
	public function getParameters(): array {
24 1
		return ["ref","value"];
25
	}
26
27
}
28
29