1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
/** |
4
|
|
|
* Minotaur |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
7
|
|
|
* use this file except in compliance with the License. You may obtain a copy of |
8
|
|
|
* the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
14
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
15
|
|
|
* License for the specific language governing permissions and limitations under |
16
|
|
|
* the License. |
17
|
|
|
* |
18
|
|
|
* @copyright 2015-2017 Appertly |
19
|
|
|
* @license Apache-2.0 |
20
|
|
|
*/ |
21
|
|
|
namespace Minotaur\Net\Exception; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Exception for network misconfiguration |
25
|
|
|
*/ |
26
|
|
|
class Misconfigured extends Unreachable |
27
|
|
|
{ |
28
|
|
|
private const ERRORS = [ |
29
|
|
|
CURLE_SSL_ENGINE_NOTFOUND, CURLE_OUT_OF_MEMORY, |
30
|
|
|
CURLE_SSL_ENGINE_SETFAILED, CURLE_READ_ERROR, CURLE_BAD_FUNCTION_ARGUMENT, |
31
|
|
|
CURLE_BAD_PASSWORD_ENTERED, CURLE_UNSUPPORTED_PROTOCOL, CURLE_LIBRARY_NOT_FOUND, |
32
|
|
|
CURLE_URL_MALFORMAT, CURLE_MALFORMAT_USER, CURLE_URL_MALFORMAT_USER, |
33
|
|
|
CURLE_FAILED_INIT, CURLE_FUNCTION_NOT_FOUND, CURLE_SSL_CERTPROBLEM, |
34
|
|
|
CURLE_FILE_COULDNT_READ_FILE, CURLE_SSL_CIPHER, CURLE_FILESIZE_EXCEEDED |
35
|
|
|
]; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Determines whether the code returned from cURL is one this class supports. |
39
|
|
|
* |
40
|
|
|
* @param $code - The code |
41
|
|
|
* @return - whether this class should be used |
|
|
|
|
42
|
|
|
*/ |
43
|
|
|
public static function isUsable(int $code) : bool |
44
|
|
|
{ |
45
|
|
|
return in_array($code, self::ERRORS, true); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.