Passed
Pull Request — master (#123)
by Arman
05:42 queued 02:39
created

HttpException   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 46
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A methodNotAvailable() 0 3 1
A unexpectedRequestInitialization() 0 3 1
A contentTypeNotSupported() 0 3 1
A unexpectedResponseInitialization() 0 3 1
A requestNotCreated() 0 3 1
1
<?php
2
3
/**
4
 * Quantum PHP Framework
5
 *
6
 * An open source software development framework for PHP
7
 *
8
 * @package Quantum
9
 * @author Arman Ag. <[email protected]>
10
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
11
 * @link http://quantum.softberg.org/
12
 * @since 2.9.0
13
 */
14
15
namespace Quantum\Exceptions;
16
17
/**
18
 * Class HttpException
19
 * @package Quantum\Exceptions
20
 */
21
class HttpException extends \Exception
22
{
23
    /**
24
     * @return HttpException
25
     * @throws LangException
26
     */
27
    public static function unexpectedRequestInitialization(): HttpException
28
    {
29
        return new static(t('exception.unexpected_request_initialization'), E_WARNING);
30
    }
31
32
    /**
33
     * @return HttpException
34
     * @throws LangException
35
     */
36
    public static function unexpectedResponseInitialization(): HttpException
37
    {
38
        return new static(t('exception.unexpected_response_initialization'), E_WARNING);
39
    }
40
41
    /**
42
     * @return HttpException
43
     * @throws LangException
44
     */
45
    public static function requestNotCreated(): HttpException
46
    {
47
        return new static(t('exception.request_not_created'), E_WARNING);
48
    }
49
50
    /**
51
     * @param string $name
52
     * @return HttpException
53
     * @throws LangException
54
     */
55
    public static function methodNotAvailable(string $name): HttpException
56
    {
57
        return new static(t('exception.method_not_available', $name), E_WARNING);
58
    }
59
60
    /**
61
     * @return static
62
     * @throws LangException
63
     */
64
    public static function contentTypeNotSupported(): HttpException
65
    {
66
        return new static(t('exception.not_supported_content_type'), E_WARNING);
67
    }
68
69
}
70