Passed
Branch feature__inject_mechanic_in_ce... (9a12b8)
by Robin
06:53
created

Untrained::isTesting()   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 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
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
    /**
21
     * Untrained constructor.
22
     *
23
     * @param Cli           $cli
24
     * @param ConsoleWriter $consoleWriter
25
     * @param ServerBag     $serverBag
26
     */
27 14
    public function __construct(Cli $cli, ConsoleWriter $consoleWriter, ServerBag $serverBag)
28
    {
29 14
        $this->cli = $cli;
30 14
        $this->consoleWriter = $consoleWriter;
31 14
        $this->serverBag = $serverBag;
32 14
    }
33
34
    /**
35
     * Trust the given root certificate file in the Keychain.
36
     *
37
     * @param string $pem
38
     *
39
     * @return void
40
     */
41 1
    public function trustCA($pem)
42
    {
43 1
        $this->iAmNotTrainedTo('trust a CA certificate');
44 1
    }
45
46
    /**
47
     * Trust the given certificate file in the Mac Keychain.
48
     *
49
     * @param string $crt
50
     *
51
     * @return void
52
     */
53 1
    public function trustCertificate($crt)
54
    {
55 1
        $this->iAmNotTrainedTo('trust a certificate');
56 1
    }
57
58
    /**
59
     * Return the User's home directory path.
60
     *
61
     * @return string
62
     */
63 1
    public function getUserHomePath()
64
    {
65 1
        $this->iAmNotTrainedTo('get the users home path');
66 1
    }
67
68
    /**
69
     * Flush the host system DNS cache.
70
     *
71
     * @return void
72
     */
73 1
    public function flushDns()
74
    {
75 1
        $this->iAmNotTrainedTo('flush the DNS');
76 1
    }
77
78
    /**
79
     * Give a nice message about not being trained.
80
     *
81
     * @param $activity
82
     */
83 4
    protected function iAmNotTrainedTo($activity)
84
    {
85 4
        $this->consoleWriter->info("I haven't been trained to {$activity} on this system.");
86 4
        $this->consoleWriter->info('You are welcome to train me and submit a PR.');
87 4
    }
88
}
89