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

PhpTokenValidator::check()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.2
c 1
b 0
f 0
cc 4
eloc 5
nc 2
nop 1
crap 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