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.

ApaiIO   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 51
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A runOperation() 0 8 1
A applyResponseTransformer() 0 8 2
1
<?php
2
/*
3
 * Copyright 2016 Jan Eichhorn <[email protected]>
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
namespace ApaiIO;
19
20
use ApaiIO\Configuration\ConfigurationInterface;
21
use ApaiIO\Operations\OperationInterface;
22
23
/**
24
 * ApaiIO Core
25
 * Bundles all components
26
 *
27
 * http://www.amazon.com
28
 *
29
 * @author Jan Eichhorn <[email protected]>
30
 *
31
 * @see https://github.com/Exeu/apai-io/wiki Wiki
32
 * @see https://github.com/Exeu/apai-io Source
33
 */
34
class ApaiIO
35
{
36
    const VERSION = "2.0.0-DEV";
37
38
    /**
39
     * Configuration.
40
     *
41
     * @var ConfigurationInterface
42
     */
43
    protected $configuration;
44
45
    /**
46
     * @param ConfigurationInterface $configuration
47
     */
48 2
    public function __construct(ConfigurationInterface $configuration)
49
    {
50 2
        $this->configuration = $configuration;
51 2
    }
52
53
    /**
54
     * Runs the given operation.
55
     *
56
     * @param OperationInterface $operation The operationobject
57
     *
58
     * @return mixed
59
     */
60 2
    public function runOperation(OperationInterface $operation)
61
    {
62 2
        $request  = $this->configuration->getRequest();
63
64 2
        $response = $request->perform($operation, $this->configuration);
65
66 2
        return $this->applyResponseTransformer($response);
67
    }
68
69
    /**
70
     * Applies a responsetransformer.
71
     *
72
     * @param mixed $response The response of the request
73
     *
74
     * @return mixed
75
     */
76 2
    protected function applyResponseTransformer($response)
77
    {
78 2
        if (null === $responseTransformer = $this->configuration->getResponseTransformer()) {
79 1
            return $response;
80
        }
81
82 1
        return $responseTransformer->transform($response);
83
    }
84
}
85