Completed
Push — master ( c894bb...4464ce )
by Yassir
11s
created

ForwardingRule::setStandardHttpsRules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the DigitalOceanV2 library.
5
 *
6
 * (c) Antoine Corcy <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace DigitalOceanV2\Entity;
13
14
/**
15
 * @author Jacob Holmes <[email protected]>
16
 */
17
class ForwardingRule extends AbstractEntity
18
{
19
    /**
20
     * @var string
21
     */
22
    public $entryProtocol;
23
24
    /**
25
     * @var int
26
     */
27
    public $entryPort;
28
29
    /**
30
     * @var string
31
     */
32
    public $targetProtocol;
33
34
    /**
35
     * @var int
36
     */
37
    public $targetPort;
38
39
    /**
40
     * @var string
41
     */
42
    public $certificateId;
43
44
    /**
45
     * @var string
46
     */
47
    public $tlsPassthrough;
48
49
    /**
50
     * @return $this
51
     */
52
    public function setStandardHttpRules()
53
    {
54
        $this->entryProtocol = 'http';
55
        $this->targetProtocol = 'http';
56
        $this->entryPort = 80;
57
        $this->targetPort = 80;
58
59
        return $this;
60
    }
61
62
    /**
63
     * @return $this
64
     */
65
    public function setStandardHttpsRules()
66
    {
67
        $this->entryProtocol = 'https';
68
        $this->targetProtocol = 'https';
69
        $this->entryPort = 443;
70
        $this->targetPort = 443;
71
        $this->tlsPassthrough = true;
0 ignored issues
show
Documentation Bug introduced by
The property $tlsPassthrough was declared of type string, but true is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
72
73
        return $this;
74
    }
75
}
76