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.

Code Duplication    Length = 53-53 lines in 2 locations

src/Module/Capability/Provider/Service.php 1 location

@@ 10-62 (lines=53) @@
7
use Saltwater\Salt\Context as SwContext;
8
use Saltwater\Salt\Service as SwService;
9
10
class Service extends Provider
11
{
12
    /**
13
     * @param string    $name
14
     * @param SwContext $context
15
     *
16
     * @return SwService
17
     */
18
    public function get($name, $context)
19
    {
20
        $class = $this->getServiceClass($context, $name);
21
22
        // TODO: RB Fallback is rather dirty, try parent context or fail out
23
        return new $class($context);
24
    }
25
26
    /**
27
     * @param SwContext $context
28
     * @param string    $service
29
     */
30
    private function getServiceClass($context, $service)
31
    {
32
        // See whether the current context namespace has this service
33
        $class = U::className($context->namespace, 'service', $service);
34
35
        if (class_exists($class)) {
36
            return $class;
37
        }
38
39
        return $this->getServiceClassFallback($context, $service);
40
    }
41
42
    private function getServiceClassFallback($context, $service)
43
    {
44
        // Check whether we have a RestService in the context namespace
45
        $class = U::className($context->namespace, 'service', 'rest');
46
47
        if (class_exists($class)) {
48
            return $class;
49
        }
50
51
        // Next up, try for a root service
52
        $class = U::className('saltwater', 'root', 'service', $service);
53
54
        if (class_exists($class)) {
55
            return $class;
56
        }
57
58
        // Fall back to the RedBean RestService
59
        // TODO: Needs to be decoupled
60
        return 'Saltwater\RedBean\Service\Rest';
61
    }
62
}
63

src/Module/Root/Provider/Service.php 1 location

@@ 10-62 (lines=53) @@
7
use Saltwater\Salt\Context as SwContext;
8
use Saltwater\Salt\Service as SwService;
9
10
class Service extends Provider
11
{
12
    /**
13
     * @param string    $name
14
     * @param SwContext $context
15
     *
16
     * @return SwService
17
     */
18
    public function get($name, $context)
19
    {
20
        $class = $this->getServiceClass($context, $name);
21
22
        // TODO: RB Fallback is rather dirty, try parent context or fail out
23
        return new $class($context);
24
    }
25
26
    /**
27
     * @param SwContext $context
28
     * @param string    $service
29
     */
30
    private function getServiceClass($context, $service)
31
    {
32
        // See whether the current context namespace has this service
33
        $class = U::className($context->namespace, 'service', $service);
34
35
        if (class_exists($class)) {
36
            return $class;
37
        }
38
39
        return $this->getServiceClassFallback($context, $service);
40
    }
41
42
    private function getServiceClassFallback($context, $service)
43
    {
44
        // Check whether we have a RestService in the context namespace
45
        $class = U::className($context->namespace, 'service', 'rest');
46
47
        if (class_exists($class)) {
48
            return $class;
49
        }
50
51
        // Next up, try for a root service
52
        $class = U::className('saltwater', 'root', 'service', $service);
53
54
        if (class_exists($class)) {
55
            return $class;
56
        }
57
58
        // Fall back to the RedBean RestService
59
        // TODO: Needs to be decoupled
60
        return 'Saltwater\RedBean\Service\Rest';
61
    }
62
}
63