Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
36 / 36 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
_HttpXData | |
100.00% |
36 / 36 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
getLocalXCodes | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
1 | |||
getXMessageTemplates | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | /** |
4 | * @author: Doug Wilbourne (dougwilbourne@gmail.com) |
5 | * @noinspection PhpCSValidationInspection |
6 | */ |
7 | declare(strict_types=1); |
8 | |
9 | namespace pvc\http\err; |
10 | |
11 | use pvc\err\XDataAbstract; |
12 | |
13 | /** |
14 | * Class _ParserXData |
15 | */ |
16 | class _HttpXData extends XDataAbstract |
17 | { |
18 | |
19 | public function getLocalXCodes(): array |
20 | { |
21 | return [ |
22 | CurlInitException::class => 1000, |
23 | InvalidPortNumberException::class => 1001, |
24 | InvalidQuerystringParamNameException::class => 1002, |
25 | InvalidQueryEncodingException::class => 1003, |
26 | InvalidQuerystringException::class => 1004, |
27 | MimeTypeCdnException::class => 1005, |
28 | MimeTypesJsonDecodingException::class => 1006, |
29 | MimeTypesUnreadableStreamException::class => 1007, |
30 | UnknownMimeTypeDetectedException::class => 1009, |
31 | ClientRuntimeException::class => 1010, |
32 | InvalidUrlException::class => 1012, |
33 | DetectMimeTypeResourceException::class => 1014, |
34 | InvalidResourceException::class => 1015, |
35 | InvalidStreamHandleException::class => 1016, |
36 | InvalidHttpVerbException::class => 1017, |
37 | InvalidConnectionTimeoutException::class => 1018, |
38 | ]; |
39 | } |
40 | |
41 | public function getXMessageTemplates(): array |
42 | { |
43 | return [ |
44 | CurlInitException::class => 'curl_init call failed and returned false instead of a curl handle.', |
45 | InvalidPortNumberException::class => 'invalid port number specified - must be an positive int or a string of digits', |
46 | InvalidQuerystringParamNameException::class => 'Invalid querystring param name: must start with a letter and be only alphanumeric or underscore', |
47 | InvalidQueryEncodingException::class => 'Invalid query encoding specified - see the php documentation for build_http_query', |
48 | InvalidQuerystringException::class => 'Invalid querystring.', |
49 | MimeTypeCdnException::class => 'runtime exception: cdn ${cdn} containing mime types in not currently available.', |
50 | MimeTypesJsonDecodingException::class => 'Error decoding json string into MimeTypes object.', |
51 | MimeTypesUnreadableStreamException::class => 'Unable to read stream or unable to detect mime type of sdtream.', |
52 | UnknownMimeTypeDetectedException::class => 'Unknown mime type detected from php function mime_content_type in stream.', |
53 | InvalidUrlException::class => 'Invalid url ${badUrl} could not be parsed.', |
54 | ClientRuntimeException::class => 'Unable to connect to ${url}.', |
55 | InvalidConnectionTimeoutException::class => 'Invalid connection timeout ${badTimeout} - must be > 0.', |
56 | DetectMimeTypeResourceException::class => 'First arrgument to detect method must be either a filename or a resource (e.g. stream)', |
57 | InvalidResourceException::class => 'Invalid resource: either is not a resource or resource has already been closed.', |
58 | InvalidStreamHandleException::class => 'Resource is not a handle to a stream resource.', |
59 | InvalidHttpVerbException::class => 'Invalid HTTP verb ${badHttpVerb} provided.', |
60 | ]; |
61 | } |
62 | } |