Completed
Push — master ( bbb6c4...cfbe4b )
by Tobias
03:51 queued 02:30
created

Options   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 3
A getHost() 0 4 1
A getCertificatePath() 0 4 1
A getPrimaryUrl() 0 4 1
A getApiVersion() 0 4 1
1
<?php
2
3
/**
4
 * FreeIPA library for PHP
5
 * Copyright (C) 2015-2019 Tobias Sette <[email protected]>
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Lesser General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
declare(strict_types=1);
21
22
namespace Gnumoksha\FreeIpa;
23
24
class Options
25
{
26
    private $host;
27
    private $certificatePath;
28
    private $primaryUrl;
29
    private $apiVersion;
30
31
    public function __construct(
32
        string $host,
33
        string $certificatePath,
34
        string $primaryUrl = null,
35
        string $apiVersion = null
36
    ) {
37
        if ($primaryUrl === null) {
38
            $primaryUrl = sprintf('https://%s/ipa', $host);
39
        }
40
        if ($apiVersion === null) {
41
            $apiVersion = '2.233';
42
        }
43
44
        $this->host            = $host;
45
        $this->certificatePath = $certificatePath;
46
        $this->primaryUrl      = $primaryUrl;
47
        $this->apiVersion      = $apiVersion;
48
    }
49
50
    public function getHost(): string
51
    {
52
        return $this->host;
53
    }
54
55
    public function getCertificatePath(): string
56
    {
57
        return $this->certificatePath;
58
    }
59
60
    public function getPrimaryUrl(): string
61
    {
62
        return $this->primaryUrl;
63
    }
64
65
    public function getApiVersion(): ?string
66
    {
67
        return $this->apiVersion;
68
    }
69
}
70