Completed
Push — master ( 6f1f11...46af25 )
by Gaël
01:59
created

ApiError   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 14
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A responseError() 0 4 1
1
<?php
2
3
namespace DansMaCulotte\Newsletter\Exceptions;
4
5
use Exception;
6
use Throwable;
7
/**
8
 * Class ApiError
9
 * @package DansMaCulotte\Newsletter\Exceptions;
10
 */
11
class ApiError extends Exception
12
{
13
    /**
14
     * @param string $error
15
     * @param string $name
16
     * @param int $code
17
     * @param Throwable|null $previous
18
     * @return ApiError
19
     */
20
    public static function responseError(string $error, string $name, $code = 0, Throwable $previous = null)
21
    {
22
        return new static("{$name} returned an error: {$error}", $code, $previous);
23
    }
24
}
25