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.
Completed
Pull Request — master (#61)
by Marc
04:35
created

Command::isValid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * @package: chapi
4
 *
5
 * @author:  msiebeneicher
6
 * @since:   2016-11-10
7
 *
8
 */
9
10
11
namespace Chapi\Service\JobValidator\PropertyValidator;
12
13
use Chapi\Entity\Chronos\JobEntity;
14
use Chapi\Service\JobValidator\PropertyValidatorInterface;
15
16
class Command extends AbstractPropertyValidator implements PropertyValidatorInterface
17
{
18
    const DIC_NAME = 'CommandValidator';
19
    const MESSAGE_TEMPLATE = '"%s" is not allowed to be empty for non docker jobs';
20
21
    /**
22
     * @inheritDoc
23
     */
24 3
    public function isValid($sProperty, JobEntity $oJobEntity)
25
    {
26 3
        return $this->returnIsValidHelper(
27 3
            $this->isCommandPropertyValid($oJobEntity),
28 3
            $sProperty,
29
            self::MESSAGE_TEMPLATE
30 3
        );
31
    }
32
33
    /**
34
     * @param JobEntity $oJobEntity
35
     * @return bool
36
     */
37 3
    private function isCommandPropertyValid(JobEntity $oJobEntity)
38
    {
39 3
        if (is_null($oJobEntity->container))
40 3
        {
41 3
            return (!empty($oJobEntity->command) && is_string($oJobEntity->command));
42
        }
43
        
44 1
        return (empty($oJobEntity->command) || is_string($oJobEntity->command));
45
    }
46
}