UrlBuilder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildUrl() 0 8 2
1
<?php
2
3
namespace Codeat3\FoaasClient;
4
5
class UrlBuilder
6
{
7
    private const API_ENDPOINT = 'https://foaas.com';
8
9
    /**
10
     * Build Api Url.
11
     *
12
     * @param string $method
13
     * @param array $fields
14
     *
15
     * @return string
16
     */
17
    public static function buildUrl(string $method, array $fields = []): string
18
    {
19
        $url = '/'.$method;
20
        if (count($fields) > 0) {
21
            $url .= '/'.implode('/', $fields);
22
        }
23
24
        return self::API_ENDPOINT.$url;
25
    }
26
}
27