Completed
Push — master ( f8bd36...f2dc96 )
by Jean-Christophe
01:33
created

LessThanValidator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

3 Methods

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