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   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 8 1
A isNamePropertyValid() 0 4 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