ApiError   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 12
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A responseError() 0 3 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