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 (#68)
by Bidesh
02:54
created

Command   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 91.67%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 35
ccs 11
cts 12
cp 0.9167
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 8 1
B isCommandPropertyValid() 0 13 5
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\ChronosJobEntity;
14
use Chapi\Entity\Chronos\JobEntity;
15
use Chapi\Entity\JobEntityInterface;
16
use Chapi\Service\JobValidator\PropertyValidatorInterface;
17
18
class Command extends AbstractPropertyValidator implements PropertyValidatorInterface
19
{
20
    const DIC_NAME = 'CommandValidator';
21
    const MESSAGE_TEMPLATE = '"%s" is not allowed to be empty for non docker jobs';
22
23
    /**
24
     * @inheritDoc
25
     */
26 3
    public function isValid($sProperty, JobEntityInterface $oJobEntity)
27
    {
28 3
        return $this->returnIsValidHelper(
29 3
            $this->isCommandPropertyValid($oJobEntity),
30 3
            $sProperty,
31
            self::MESSAGE_TEMPLATE
32 3
        );
33
    }
34
35
    /**
36
     * @param JobEntityInterface $oJobEntity
37
     * @return bool
38
     */
39 3
    private function isCommandPropertyValid(JobEntityInterface $oJobEntity)
40
    {
41 3
        if (!$oJobEntity instanceof ChronosJobEntity) {
42
            throw new \RuntimeException('Required ChronosJobEntity. Something else found.');
43
        }
44
45 3
        if (is_null($oJobEntity->container))
46 3
        {
47 3
            return (!empty($oJobEntity->command) && is_string($oJobEntity->command));
48
        }
49
        
50 1
        return (empty($oJobEntity->command) || is_string($oJobEntity->command));
51
    }
52
}