Passed
Pull Request — master (#23)
by Keoghan
02:43
created

Untrained::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace App\Support\Mechanics;
4
5
6
use App\Support\Console\ConsoleWriter;
7
use App\Support\Console\ServerBag;
8
use App\Support\Contracts\Cli;
9
10
class Untrained implements Mechanic
11
{
12
    /** @var Cli */
13
    protected $cli;
14
15
    /** @var ConsoleWriter */
16
    protected $consoleWriter;
17
18
    /** @var ServerBag */
19
    protected $serverBag;
20
21
    /**
22
     * Untrained constructor.
23
     *
24
     * @param Cli $cli
25
     * @param ConsoleWriter $consoleWriter
26
     * @param ServerBag $serverBag
27
     */
28
    public function __construct(Cli $cli, ConsoleWriter $consoleWriter, ServerBag $serverBag)
29
    {
30
        $this->cli = $cli;
31
        $this->consoleWriter = $consoleWriter;
32
        $this->serverBag = $serverBag;
33
    }
34
35
    /**
36
     * Trust the given root certificate file in the Keychain.
37
     *
38
     * @param  string  $pem
39
     * @return void
40
     */
41
    public function trustCA($pem)
42
    {
43
        $this->iAmNotTrainedTo('trust a CA certificate');
44
    }
45
46
    /**
47
     * Trust the given certificate file in the Mac Keychain.
48
     *
49
     * @param  string  $crt
50
     * @return void
51
     */
52
    public function trustCertificate($crt)
53
    {
54
        $this->iAmNotTrainedTo('trust a certificate');
55
    }
56
57
    /**
58
     * Return the User's home directory path
59
     *
60
     * @return string
61
     */
62
    public function getUserHomePath()
63
    {
64
        $this->iAmNotTrainedTo('get the users home path');
65
    }
66
67
    /**
68
     * Flush the host system DNS cache
69
     *
70
     * @return void
71
     */
72
    public function flushDns()
73
    {
74
        $this->iAmNotTrainedTo('flush the DNS');
75
    }
76
77
    /**
78
     * Check if we're running in test mode
79
     *
80
     * @return bool
81
     */
82
    public function isTesting()
83
    {
84
        return running_tests();
85
    }
86
87
    /**
88
     * Give a nice message about not being trained
89
     *
90
     * @param $activity
91
     */
92
    protected function iAmNotTrainedTo($activity)
93
    {
94
        $this->consoleWriter->info("I haven't been trained to {$activity} on this system.");
95
        $this->consoleWriter->info("You are welcome to train me and submit a PR.");
96
    }
97
}
98