Passed
Pull Request — master (#224)
by Michele
02:15
created

Website   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 49
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getBaseUrl() 0 3 1
A isUnsafe() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Pickle
7
 *
8
 *
9
 * @license
10
 *
11
 * New BSD License
12
 *
13
 * Copyright © 2015-2015, Pickle community. All rights reserved.
14
 *
15
 * Redistribution and use in source and binary forms, with or without
16
 * modification, are permitted provided that the following conditions are met:
17
 *     * Redistributions of source code must retain the above copyright
18
 *       notice, this list of conditions and the following disclaimer.
19
 *     * Redistributions in binary form must reproduce the above copyright
20
 *       notice, this list of conditions and the following disclaimer in the
21
 *       documentation and/or other materials provided with the distribution.
22
 *     * Neither the name of the Hoa nor the names of its contributors may be
23
 *       used to endorse or promote products derived from this software without
24
 *       specific prior written permission.
25
 *
26
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
30
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
 * POSSIBILITY OF SUCH DAMAGE.
37
 */
38
39
namespace Pickle\Base\Pecl;
40
41
class Website
42
{
43
    /**
44
     * The port to be used for the test web server.
45
     *
46
     * @var int
47
     */
48
    public const TEST_PORT = 50123;
49
50
    /**
51
     * The base URL of the PECL website to be used.
52
     *
53
     * @var string
54
     *
55
     * @example 'https://pecl.php.net'
56
     * @example 'https://127.0.0.1:50123'
57
     */
58
    private $baseUrl;
59
60
    /**
61
     * Should we allow unsafe connections to the PECL website?
62
     *
63
     * @var bool
64
     */
65
    private $unsafe;
66
67
    public function __construct(string $baseUrl, bool $unsafe)
68
    {
69
        $this->baseUrl = $baseUrl;
70
        $this->unsafe = $unsafe;
71
    }
72
73
    /**
74
     * Get the base URL of the PECL website to be used.
75
     *
76
     * @example 'https://pecl.php.net'
77
     * @example 'https://127.0.0.1:50123'
78
     */
79
    public function getBaseUrl(): string
80
    {
81
        return $this->baseUrl;
82
    }
83
84
    /**
85
     * Should we allow unsafe connections to the PECL website?
86
     */
87
    public function isUnsafe(): bool
88
    {
89
        return $this->unsafe;
90
    }
91
}
92
93
/* vim: set tabstop=4 shiftwidth=4 expandtab: fdm=marker */
94