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.

ContainerException::fromPrevious()   B
last analyzed

Complexity

Conditions 5
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 9
cts 9
cp 1
rs 8.8571
cc 5
eloc 7
nc 2
nop 2
crap 5
1
<?php
2
3
namespace Acclimate\Container\Exception;
4
5
use Interop\Container\Exception\ContainerException as InteropContainerException;
6
7
/**
8
 * An error occurred when trying to retrieve an entry from the container
9
 */
10
class ContainerException extends \RuntimeException implements InteropContainerException
11
{
12
    /**
13
     * @var string The message template. Allowed variables are {error} and {id}
14
     */
15
    protected static $template = 'An {error} occurred when attempting to retrieve the "{id}" entry from the container.';
16
17
    /**
18
     * Creates a ContainerException by using the information from the previous exception
19
     *
20
     * @param string|mixed $id
21
     * @param \Exception $prev
22
     *
23
     * @return ContainerException
24
     */
25 4
    public static function fromPrevious($id, \Exception $prev = null)
26
    {
27 4
        $message = strtr(static::$template, array(
28 4
            '{id}'    => (is_string($id) || method_exists($id, '__toString')) ? $id : '?',
29 4
            '{error}' => $prev ? get_class($prev) : 'error',
30 4
        ));
31
32 4
        if ($prev) {
33 1
            $message .= ' Message: ' . $prev->getMessage();
34 1
        }
35
36 4
        return new static($message, 0, $prev);
37
    }
38
}
39