Completed
Push — master ( 95511f...afa343 )
by Peter
08:54 queued 05:54
created

ResponseException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 23
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A failed() 0 4 1
A invalidResponse() 0 4 1
1
<?php
2
3
/**
4
 * AnimeDb package.
5
 *
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2011, Peter Gribanov
8
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
9
 */
10
11
namespace AnimeDb\Bundle\ShikimoriBrowserBundle\Service\Exception;
12
13
class ResponseException extends \RuntimeException
14
{
15
    /**
16
     * @param string     $host
17
     * @param \Exception $previous
18
     *
19
     * @return ResponseException
20
     */
21 5
    public static function failed($host, \Exception $previous)
22
    {
23 5
        return new self(sprintf('Failed to query the server "%s"', $host), $previous->getCode(), $previous);
24
    }
25
26
    /**
27
     * @param string $host
28
     *
29
     * @return ResponseException
30
     */
31 5
    public static function invalidResponse($host)
32
    {
33 5
        return new self(sprintf('Invalid response from the server "%s"', $host));
34
    }
35
}
36