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.

LocatorFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 70
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A getLocator() 0 17 2
1
<?php
2
/**
3
 * MageSpec
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the MIT License, that is bundled with this
8
 * package in the file LICENSE.
9
 * It is also available through the world-wide-web at this URL:
10
 *
11
 * http://opensource.org/licenses/MIT
12
 *
13
 * If you did not receive a copy of the license and are unable to obtain it
14
 * through the world-wide-web, please send an email
15
 * to <[email protected]> so we can send you a copy immediately.
16
 *
17
 * @category   MageTest
18
 * @package    PhpSpec_MagentoExtension
19
 *
20
 * @copyright  Copyright (c) 2012-2013 MageTest team and contributors.
21
 */
22
namespace MageTest\PhpSpec\MagentoExtension\Extension;
23
24
25
use MageTest\PhpSpec\MagentoExtension\Locator\Magento\AbstractResourceLocator;
26
use PhpSpec\Util\Filesystem;
27
28
class LocatorFactory
29
{
30
    /**
31
     * @var string
32
     */
33
    private $sourceNamespace;
34
35
    /**
36
     * @var string
37
     */
38
    private $specPrefix;
39
40
    /**
41
     * @var string
42
     */
43
    private $sourcePath;
44
45
    /**
46
     * @var string
47
     */
48
    private $specPath;
49
50
    /**
51
     * @var string
52
     */
53
    private $codePool;
54
55
    /**
56
     * @var Filesystem
57
     */
58
    private $filesystem;
59
60
    public function __construct(
61
        $srcNamespace = '',
62
        $specNamespacePrefix = '',
63
        $srcPath = 'src',
64
        $specPath = 'spec',
65
        Filesystem $filesystem = null,
66
        $codePool = null
67
    ) {
68
        $this->sourceNamespace = $srcNamespace;
69
        $this->specPrefix = $specNamespacePrefix;
70
        $this->sourcePath = $srcPath;
71
        $this->specPath = $specPath;
72
        $this->filesystem = $filesystem;
73
        $this->codePool = $codePool;
74
    }
75
76
    /**
77
     * @param string $type
78
     * @return AbstractResourceLocator
79
     */
80
    public function getLocator($type)
81
    {
82
        $className = '\\MageTest\\PhpSpec\\MagentoExtension\\Locator\\Magento\\' . ucfirst($type) . 'Locator';
83
84
        if (!class_exists($className)) {
85
            throw new \RuntimeException("The locator $className does not exist");
86
        }
87
88
        return new $className(
89
            $this->sourceNamespace,
90
            $this->specPrefix,
91
            $this->sourcePath,
92
            $this->specPath,
93
            $this->filesystem,
94
            $this->codePool
95
        );
96
    }
97
}