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