1 | <?php |
||
24 | class CurlClient implements ClientInterface |
||
25 | { |
||
26 | /** |
||
27 | * The URI for this service |
||
28 | * The minfraud.maxmind.com hostname automatically picks the data center geographically |
||
29 | * closest to you. In some cases, this data center may not be the one |
||
30 | * that provides you with the best service. You can explicitly try the |
||
31 | * following hostnames to see which one provides the best performance for you: |
||
32 | * @see https://minfraud.maxmind.com/minfraud/chargeback. |
||
33 | */ |
||
34 | const HOSTNAME_DEFAULT = 'https://minfraud.maxmind.com/minfraud/chargeback'; |
||
35 | const HOSTNAME_US_EAST = 'https://minfraud-us-east.maxmind.com/minfraud/chargeback'; |
||
36 | const HOSTNAME_US_WEST = 'https://minfraud-us-west.maxmind.com/minfraud/chargeback'; |
||
37 | const HOSTNAME_EU_WEST = 'https://minfraud-eu-west.maxmind.com/minfraud/chargeback'; |
||
38 | |||
39 | /** |
||
40 | * @var Credential |
||
41 | */ |
||
42 | private $credential; |
||
43 | /** |
||
44 | * @var Curl |
||
45 | */ |
||
46 | private $curl; |
||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | private $hostname; |
||
51 | |||
52 | /** |
||
53 | * @param Credential $credential |
||
54 | * @param Curl $curl |
||
55 | */ |
||
56 | 24 | public function __construct(Credential $credential, Curl $curl = null) |
|
64 | |||
65 | /** |
||
66 | * @param int $seconds |
||
67 | * |
||
68 | * @return CurlClient |
||
69 | */ |
||
70 | 1 | public function setConnectTimeout($seconds) |
|
76 | |||
77 | /** |
||
78 | * @param string $seconds |
||
79 | * |
||
80 | * @return CurlClient |
||
81 | */ |
||
82 | 1 | public function setTimeout($seconds) |
|
88 | |||
89 | /** |
||
90 | * @param string $hostname |
||
91 | * |
||
92 | * @return CurlClient |
||
93 | */ |
||
94 | 2 | public function setHostname($hostname) |
|
107 | |||
108 | /** |
||
109 | * @param Chargeback $chargeback |
||
110 | * |
||
111 | * @throws ExceptionAbstract |
||
112 | * @throws RuntimeException |
||
113 | * |
||
114 | * @return bool |
||
115 | */ |
||
116 | 3 | public function report(Chargeback $chargeback) |
|
137 | |||
138 | /** |
||
139 | * @param mixed $content |
||
140 | * |
||
141 | * @return boolean |
||
142 | */ |
||
143 | 7 | protected function isValidMaxMindResponse($content) |
|
155 | |||
156 | /** |
||
157 | * @param string $code |
||
158 | * @param string $message |
||
159 | * |
||
160 | * @return ExceptionAbstract |
||
161 | */ |
||
162 | 12 | protected function getMaxMindExceptionByCodeAndMessage($code, $message) |
|
188 | } |
||
189 |