Test Failed
Pull Request — master (#68)
by Keoghan
05:43
created

Untrained::isUsingDefaultHostAddress()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace App\Support\Mechanics;
4
5
use App\Support\Console\ConsoleWriter;
6
use App\Support\Console\ServerBag;
7
use App\Support\Contracts\Cli;
8
9
class Untrained implements Mechanic
10
{
11
    /** @var Cli */
12
    protected $cli;
13
14
    /** @var ConsoleWriter */
15
    protected $consoleWriter;
16
17
    /** @var ServerBag */
18
    protected $serverBag;
19
20
    /** @var string $hostAddress Address for Host */
21
    protected $hostAddress = '127.0.0.1';
22
23
    /**
24
     * Untrained constructor.
25
     *
26
     * @param Cli           $cli
27
     * @param ConsoleWriter $consoleWriter
28
     * @param ServerBag     $serverBag
29
     */
30 128
    public function __construct(Cli $cli, ConsoleWriter $consoleWriter, ServerBag $serverBag)
31
    {
32 128
        $this->cli = $cli;
33 128
        $this->consoleWriter = $consoleWriter;
34 128
        $this->serverBag = $serverBag;
35 128
    }
36
37
    /**
38
     * Trust the given root certificate file in the Keychain.
39
     *
40
     * @param string $pem
41
     *
42
     * @return void
43
     */
44 1
    public function trustCA($pem)
45
    {
46 1
        $this->iAmNotTrainedTo('trust a CA certificate');
47 1
    }
48
49
    /**
50
     * Trust the given certificate file in the Mac Keychain.
51
     *
52
     * @param string $crt
53
     *
54
     * @return void
55
     */
56 1
    public function trustCertificate($crt)
57
    {
58 1
        $this->iAmNotTrainedTo('trust a certificate');
59 1
    }
60
61
    /**
62
     * Return the User's home directory path.
63
     *
64
     * @return string
65
     */
66 1
    public function getUserHomePath()
67
    {
68 1
        $this->iAmNotTrainedTo('get the users home path');
69 1
    }
70
71
    /**
72
     * Flush the host system DNS cache.
73
     *
74
     * @return void
75
     */
76 1
    public function flushDns()
77
    {
78 1
        $this->iAmNotTrainedTo('flush the DNS');
79 1
    }
80
81
    /**
82
     * Give a nice message about not being trained.
83
     *
84
     * @param $activity
85
     */
86 7
    protected function iAmNotTrainedTo($activity)
87
    {
88 7
        $this->consoleWriter->info("I haven't been trained to {$activity} on this system.");
89 7
        $this->consoleWriter->info('You are welcome to train me and submit a PR.');
90 7
    }
91
92
    /**
93
     * Setup networking for Porter.
94
     *
95
     * @return void
96
     */
97 2
    public function setupNetworking()
98
    {
99 2
        $this->iAmNotTrainedTo('set up special networking for Porter');
100 2
    }
101
102
    /**
103
     * Restore networking for Porter.
104
     *
105
     * @return void
106
     */
107 1
    public function restoreNetworking()
108
    {
109 1
        $this->iAmNotTrainedTo('restore special networking for Porter');
110 1
    }
111
112
    /**
113
     * Get Host IP for Porter.
114
     *
115
     * @return string
116
     */
117 2
    public function getHostAddress()
118
    {
119 2
        return $this->hostAddress;
120
    }
121
122
    /**
123
     * Does a porter domain resolve to the Host Address.
124
     *
125
     * @return bool
126
     */
127
    public function isUsingHostAddress()
128
    {
129
        $this->iAmNotTrainedTo('determine if we are using the Host Address for Porter');
130
    }
131
132
    /**
133
     * Does a porter domain resolve to 127.0.0.1.
134
     *
135
     * @return bool
136
     */
137
    public function isUsingDefaultHostAddress()
138
    {
139
        $this->iAmNotTrainedTo('determine if we are using the Default Host Address for Porter');
140
    }
141
}
142