Passed
Push — master ( 8ec95c...ad8656 )
by Jean-Christophe
05:01
created

IsTrueValidator::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Ubiquity\contents\validation\validators\basic;
4
5
use Ubiquity\utils\base\UString;
6
use Ubiquity\contents\validation\validators\ValidatorHasNotNull;
7
8
class IsTrueValidator extends ValidatorHasNotNull {
9
	
10 1
	public function __construct(){
11 1
		$this->message="This value should return true";
12 1
	}
13 1
	public function validate($value) {
14 1
		parent::validate($value);
15 1
		return UString::isBooleanTrue($value);
16
	}
17
	
18
	/**
19
	 * {@inheritDoc}
20
	 * @see \Ubiquity\contents\validation\validators\Validator::getParameters()
21
	 */
22 1
	public function getParameters(): array {
23 1
		return ["value"];
24
	}
25
}
26
27