Custom::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 4
cts 4
cp 1
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Swader\Diffbot\Api;
4
5
use Swader\Diffbot\Abstracts\Api;
6
7
class Custom extends Api
8
{
9
    /** @var string API URL to which to send the request */
10
    protected $apiUrl = 'https://api.diffbot.com/v3';
11
12 6
    public function __construct($url, $name)
13
    {
14
15
        /*
16
        @todo Throw exception for invalid names.
17
        Diffbot HQ will provide regex for invalid chars in API names. Once
18
        done, modify this case to throw exceptions for invalid ones, and write
19
        test cases.
20
21
        Note that all API names with ? and / in their name currently fail to
22
        execute in the Diffbot test runner, so it's questionable whether they're
23
        even supposed to be supported.
24
        */
25
26 6
        parent::__construct($url);
27 6
        $this->apiUrl .= '/' . trim($name);
28 6
    }
29
}
30