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

BridgeFactory::getChronosBridge()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 12

Duplication

Lines 16
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 16
loc 16
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 12
nc 2
nop 4
crap 6
1
<?php
2
/**
3
 * @package: chapi
4
 *
5
 * @author:  bthapaliya
6
 * @since:   2017-02-14
7
 */
8
9
10
namespace Chapi\Service\JobRepository;
11
12
13
use Chapi\Component\Cache\CacheInterface;
14
use Chapi\Component\RemoteClients\ApiClientInterface;
15
use Chapi\Entity\Chronos\ChronosJobEntity;
16
use Chapi\Entity\Marathon\MarathonAppEntity;
17
use Chapi\Service\JobValidator\JobValidatorServiceInterface;
18
use Psr\Log\LoggerInterface;
19
use Symfony\Component\Filesystem\Filesystem;
20
21
class BridgeFactory
0 ignored issues
show
Coding Style introduced by
BridgeFactory does not seem to conform to the naming convention (Utils?$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
22
{
23 View Code Duplication
    public static function getChronosBridge(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
        ApiClientInterface $oApiClient,
25
        CacheInterface $oCache,
26
        JobValidatorServiceInterface $oJobEntityValidatorService,
27
        LoggerInterface $oLogger
28
    ) {
29
        if ($oApiClient->ping()) {
30
            return new BridgeChronos(
31
                $oApiClient,
32
                $oCache,
33
                $oJobEntityValidatorService,
34
                $oLogger);
35
        }
36
37
        return new DummyBridge($oLogger);
38
    }
39
40 View Code Duplication
    public static function getMarathonBridge(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
        ApiClientInterface $oApiClient,
42
        CacheInterface $oCache,
43
        JobValidatorServiceInterface $oJobEntityValidatorService,
44
        LoggerInterface $oLogger
45
    ) {
46
        if ($oApiClient->ping()) {
47
            return new BridgeMarathon(
48
                $oApiClient,
49
                $oCache,
50
                $oJobEntityValidatorService,
51
                $oLogger);
52
        }
53
54
        return new DummyBridge($oLogger);
55
    }
56
57
58
    public static function getFilesystemBridge(
59
        Filesystem $oFileSystemService,
60
        CacheInterface $oCache,
61
        $sRepositoryDir,
62
        LoggerInterface $oLogger
63
    ) {
64
        if (empty($sRepositoryDir)) {
65
            return new DummyBridge($oLogger);
66
        }
67
68
        return new BridgeFileSystem(
69
            $oFileSystemService,
70
            $oCache,
71
            $sRepositoryDir
72
        );
73
    }
74
}
75