GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

JobName::isNamePropertyValid()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * @package: chapi
4
 *
5
 * @author:  msiebeneicher
6
 * @since:   2016-11-10
7
 *
8
 */
9
10
namespace Chapi\Service\JobValidator\PropertyValidator;
11
12
use Chapi\Entity\Chronos\JobEntity;
13
use Chapi\Entity\JobEntityInterface;
14
use Chapi\Service\JobValidator\PropertyValidatorInterface;
15
16
class JobName extends AbstractPropertyValidator implements PropertyValidatorInterface
17
{
18
    const DIC_NAME = 'JobNameValidator';
19
    
20
    const REG_EX_VALID_NAME = '/^[a-zA-Z0-9_-]*$/';
21
    const MESSAGE_TEMPLATE = '"%s" contains invalid characters. Please use only "a-z", "A-Z", "0-9" "-" and "_"';
22
23
    /**
24
     * @inheritDoc
25
     */
26 3
    public function isValid($property, JobEntityInterface $jobEntity)
27
    {
28 3
        return $this->returnIsValidHelper(
29 3
            $this->isNamePropertyValid($jobEntity->{$property}),
30 3
            $property,
31 3
            self::MESSAGE_TEMPLATE
32
        );
33
    }
34
35
    /**
36
     * @param string $name
37
     * @return bool
38
     */
39 3
    private function isNamePropertyValid($name)
40
    {
41 3
        return (!empty($name) && preg_match(self::REG_EX_VALID_NAME, $name));
42
    }
43
}
44