Failed Conditions
Push — master ( ac05b5...2858d3 )
by Keoghan
02:49
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
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 6
    public function __construct(Cli $cli, ConsoleWriter $consoleWriter, ServerBag $serverBag)
29
    {
30 6
        $this->cli = $cli;
31 6
        $this->consoleWriter = $consoleWriter;
32 6
        $this->serverBag = $serverBag;
33 6
    }
34
35
    /**
36
     * Trust the given root certificate file in the Keychain.
37
     *
38
     * @param  string  $pem
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
     * @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 1
    protected function iAmNotTrainedTo($activity)
93
    {
94 1
        $this->consoleWriter->info("I haven't been trained to {$activity} on this system.");
95 1
        $this->consoleWriter->info("You are welcome to train me and submit a PR.");
96 1
    }
97
}
98