PhpTokenValidator::check()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 4
rs 10
1
<?php
2
/**
3
 * PHP token validator
4
 *
5
 * @file      PhpTokenValidator.php
6
 *
7
 * PHP version 8.0+
8
 *
9
 * @author    Yancharuk Alexander <alex at itvault dot info>
10
 * @copyright © 2012-2021 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 10
	public function check($value)
28
	{
29 10
		if (is_string($value)
30 10
			|| (is_array($value) && isset($value[0], $value[1], $value[2]))
31
		) {
32 7
			return true;
33
		}
34
35
36 3
		return false;
37
	}
38
}
39