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.

SimpleMessageCallback   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 2
cbo 0
dl 0
loc 46
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A onSuccess() 0 4 1
A onFailure() 0 4 1
A getResult() 0 4 1
A getException() 0 4 1
1
<?php
2
/*
3
 * Copyright (c) 2014 Janos Szurovecz
4
 *
5
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
6
 * this software and associated documentation files (the "Software"), to deal in
7
 * the Software without restriction, including without limitation the rights to
8
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
 * of the Software, and to permit persons to whom the Software is furnished to do
10
 * so, subject to the following conditions:
11
 *
12
 * The above copyright notice and this permission notice shall be included in all
13
 * copies or substantial portions of the Software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
 * SOFTWARE.
22
 */
23
24
namespace predaddy\messagehandling\util;
25
26
use Exception;
27
use predaddy\messagehandling\MessageCallback;
28
29
/**
30
 * Simple {@link MessageCallback} which holds all hold the last result and exception.
31
 * Always overwrites the existing values!
32
 *
33
 * @package predaddy\messagehandling\util
34
 * @author Janos Szurovecz <[email protected]>
35
 */
36
final class SimpleMessageCallback implements MessageCallback
37
{
38
    /**
39
     * @var mixed|null
40
     */
41
    private $result;
42
43
    /**
44
     * @var Exception|null
45
     */
46
    private $exception;
47
48
    /**
49
     * @param mixed $result
50
     * @return void
51
     */
52
    public function onSuccess($result)
53
    {
54
        $this->result = $result;
55
    }
56
57
    /**
58
     * @param Exception $exception
59
     * @return void
60
     */
61
    public function onFailure(Exception $exception)
62
    {
63
        $this->exception = $exception;
64
    }
65
66
    /**
67
     * @return mixed|null
68
     */
69
    public function getResult()
70
    {
71
        return $this->result;
72
    }
73
74
    /**
75
     * @return Exception|null
76
     */
77
    public function getException()
78
    {
79
        return $this->exception;
80
    }
81
}
82