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
04:18
created

BridgeFactory   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 53.33 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 0
cbo 5
dl 32
loc 60
ccs 0
cts 26
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getChronosBridge() 16 18 2
A getMarathonBridge() 16 18 2
A getFilesystemBridge() 0 18 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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
    {
30
        if ($oApiClient->ping())
31
        {
32
            return new BridgeChronos(
33
                $oApiClient,
34
                $oCache,
35
                $oJobEntityValidatorService,
36
                $oLogger);
37
        }
38
39
        return new DummyBridge($oLogger);
40
    }
41
42 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...
43
        ApiClientInterface $oApiClient,
44
        CacheInterface $oCache,
45
        JobValidatorServiceInterface $oJobEntityValidatorService,
46
        LoggerInterface $oLogger
47
    )
48
    {
49
        if ($oApiClient->ping())
50
        {
51
            return new BridgeMarathon(
52
                $oApiClient,
53
                $oCache,
54
                $oJobEntityValidatorService,
55
                $oLogger);
56
        }
57
58
        return new DummyBridge($oLogger);
59
    }
60
61
62
    public static function getFilesystemBridge(
63
        Filesystem $oFileSystemService,
64
        CacheInterface $oCache,
65
        $sRepositoryDir,
66
        LoggerInterface $oLogger
67
    )
68
    {
69
        if (empty($sRepositoryDir))
70
        {
71
            return new DummyBridge($oLogger);
72
        }
73
74
        return new BridgeFileSystem(
75
            $oFileSystemService,
76
            $oCache,
77
            $sRepositoryDir
78
        );
79
    }
80
}
81