InvalidFactomApiConfig   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 10
c 1
b 1
f 0
lcom 1
cbo 0
dl 0
loc 82
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A noCurlFound() 0 4 1
A noUrlDefined() 0 4 1
A noCertificateDefined() 0 4 1
A noSecureUrlDefined() 0 4 1
A noCertificateExists() 0 4 1
A noUsernameDefined() 0 4 1
A noPasswordDefined() 0 4 1
A invalidMethodCalled() 0 4 1
A invalidApiResponse() 0 4 1
A emptyApiResponse() 0 4 1
1
<?php
2
3
namespace AdrianMejias\FactomApi\Exceptions;
4
5
use Exception;
6
7
class InvalidFactomApiConfig extends Exception
8
{
9
    /**
10
     * @return static
11
     */
12
    public static function noCurlFound()
13
    {
14
        return new static('The Factom API integration requires the cURL extension, please see http://curl.haxx.se/docs/install.html to install it');
15
    }
16
17
    /**
18
     * @return static
19
     */
20
    public static function noUrlDefined()
21
    {
22
        return new static('The Factom API requires a url to connect to');
23
    }
24
25
    /**
26
     * @return static
27
     */
28
    public static function noCertificateDefined()
29
    {
30
        return new static('When enabling SSL configuration, you must ensure to define a certificate');
31
    }
32
33
    /**
34
     * @return static
35
     */
36
    public static function noSecureUrlDefined()
37
    {
38
        return new static('When defining a certificate, you must ensure the host is using HTTPS');
39
    }
40
41
    /**
42
     * @return static
43
     */
44
    public static function noCertificateExists()
45
    {
46
        return new static('Can\'t find provided certificate file');
47
    }
48
49
    /**
50
     * @return static
51
     */
52
    public static function noUsernameDefined()
53
    {
54
        return new static('You must provide a password with a username');
55
    }
56
57
    /**
58
     * @return static
59
     */
60
    public static function noPasswordDefined()
61
    {
62
        return new static('You must provide a username with a password');
63
    }
64
65
    /**
66
     * @return static
67
     */
68
    public static function invalidMethodCalled()
69
    {
70
        return new static('Supplied method must match GET or POST');
71
    }
72
73
    /**
74
     * @return static
75
     */
76
    public static function invalidApiResponse(string $error, string $action)
77
    {
78
        return new static('Received error "'.$error.'" when hitting "'.$action.'" within the Factom API');
79
    }
80
81
    /**
82
     * @return static
83
     */
84
    public static function emptyApiResponse(string $action)
85
    {
86
        return new static('Received an empty response when hitting "'.$action.'" within the Factom API');
87
    }
88
}
89