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 (#5)
by Scott van
09:49
created

AbstractConfigLocator::getPayloadConfig()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4286
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
/**
3
 * Copyright (c) 2013-2014 eBay Enterprise, Inc.
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the Open Software License (OSL 3.0)
8
 * that is bundled with this package in the file LICENSE.md.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * @copyright   Copyright (c) 2013-2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
13
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
14
 */
15
16
namespace eBayEnterprise\RetailOrderManagement\Payload;
17
18
use eBayEnterprise\RetailOrderManagement\Payload\Exception\UnsupportedPayload;
19
20
/**
21
 * Abstract implementation of a payload locator using an array of config data
22
 * to providing details on how to construct various types of payloads.
23
 */
24
abstract class AbstractConfigLocator implements ILocator
25
{
26
    /**
27
     * Indicates if the locator knows about a specific type of payload.
28
     *
29
     * @param string
30
     * @return bool
31
     */
32
    public function hasPayloadConfig($type)
33
    {
34
        return isset($this->getConfig()[$type]);
35
    }
36
37
    /**
38
     * Get the payload configuration for a specific type of payload.
39
     *
40
     * @param string
41
     * @return array
42
     * @throws UnsupportedPayload
43
     */
44
    public function getPayloadConfig($type)
45
    {
46
        if ($this->hasPayloadConfig($type)) {
47
            return $this->getConfig()[$type];
48
        }
49
        throw new UnsupportedPayload("No configuration found for $type.");
50
    }
51
52
    /**
53
     * Template method for getting the blob of config data.
54
     *
55
     * @return array
56
     */
57
    abstract protected function getConfig();
58
}
59