BasicURLParser::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace LunixRESTBasics\APIRequest\URLParser;
3
4
use LunixREST\RequestFactory\URLParser\RegexURLParser\RegexURLParser;
5
6
/**
7
 * A basic URL parser. Expects URLS in the format:
8
 * /VERSION/APIKEY/ENDPOINT_NAME[/INSTANCE_ID].EXTENSION[?QUERY_STRING]
9
 * Class BasicURLParser
10
 * @package LunixRESTBasics\APIRequest\URLParser
11
 */
12
class BasicURLParser extends RegexURLParser
13
{
14
    private const URL_PATTERN = "@/(?<version>[^/]*)/(?<apiKey>[^/]*)/(?<endpoint>[^/.]*)(?:/(?<element>[^.]*))?.(?<acceptableExtension>[^/]*)/?@";
15
16
    /**
17
     * BasicURLParser constructor.
18
     */
19 4
    public function __construct()
20
    {
21 4
        parent::__construct(self::URL_PATTERN, new GuzzleMIMEProvider());
22 4
    }
23
}
24