MapboxRequest::url()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 10
c 1
b 0
f 0
nc 4
nop 3
dl 0
loc 18
ccs 10
cts 10
cp 1
crap 3
rs 9.9332
1
<?php
2
3
namespace Bakerkretzmar\LaravelMapbox;
4
5
abstract class MapboxRequest
6
{
7
    protected $dataset_id;
8
9
    protected $feature_id;
10
11
    protected $tileset;
12
13
    protected $upload_id;
14
15 36
    protected function url(string $endpoint, string $id = null, array $options = [])
16
    {
17
        $segments = [
18 36
            config('laravel-mapbox.url'),
19 36
            $endpoint,
20 36
            config('laravel-mapbox.version'),
21 36
            config('laravel-mapbox.username'),
22
        ];
23
24 36
        if ($id) {
25 28
            $segments[] = $id;
26
        }
27
28 36
        if (! empty($options)) {
29 20
            $segments = array_merge($segments, $options);
30
        }
31
32 36
        return 'https://' . implode('/', $segments) . '?access_token=' . config('laravel-mapbox.token');
33
    }
34
}
35