Completed
Push — master ( 9e96b9...82827b )
by Alexander
06:00 queued 02:54
created

PhpTokenValidator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 21
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A check() 0 11 4
1
<?php
2
/**
3
 * PHP token validator
4
 *
5
 * @file      PhpTokenValidator.php
6
 *
7
 * PHP version 5.6+
8
 *
9
 * @author    Yancharuk Alexander <alex at itvault dot info>
10
 * @copyright © 2012-2016 Alexander Yancharuk
11
 * @date      Tue Aug 26 18:27:04
12
 * @license   The BSD 3-Clause License
13
 *            <https://tldrlegal.com/license/bsd-3-clause-license-(revised)>
14
 */
15
16
namespace Veles\Validators;
17
18
class PhpTokenValidator implements ValidatorInterface
19
{
20
	/**
21
	 * PHP token validation
22
	 *
23
	 * @param mixed $value Values for checking
24
	 *
25
	 * @return bool
26
	 */
27 5
	public function check($value)
28
	{
29 5
		if (is_string($value)
30 4
			|| (is_array($value) && isset($value[0], $value[1], $value[2]))
31 5
		) {
32 3
			return true;
33
		}
34
35
36 3
		return false;
37
	}
38
}
39