Test Failed
Branch feature__set_up_scrutinizer (ea6624)
by Robin
06:04 queued 02:46
created

Untrained::trustCertificate()   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 1
crap 2
1
<?php
2
3
namespace App\Support\Mechanics;
4
5
6
use App\Support\Console\ConsoleWriter;
7
use App\Support\Mechanics\Mechanic;
8
9
class Untrained implements Mechanic
10
{
11
    /** @var array */
12
    protected $commands = [];
13
14
    /** @var ConsoleWriter */
15
    protected $console;
16
17
    /**
18
     * Untrained constructor.
19
     *
20
     * @param \App\Support\Console\ConsoleWriter $console
21
     */
22 50
    public function __construct(ConsoleWriter $console)
23
    {
24 50
        $this->console = $console;
25 50
    }
26
27
    /**
28
     * Trust the given root certificate file in the Keychain.
29
     *
30
     * @param  string  $pem
31
     * @return void
32
     */
33 1
    public function trustCA($pem)
34
    {
35 1
        $this->iAmNotTrainedTo('trust a CA certificate');
36 1
    }
37
38
    /**
39
     * Trust the given certificate file in the Mac Keychain.
40
     *
41
     * @param  string  $crt
42
     * @return void
43
     */
44
    public function trustCertificate($crt)
45
    {
46
        $this->iAmNotTrainedTo('trust a certificate');
47
    }
48
49
    /**
50
     * Return the User's home directory path
51
     *
52
     * @return string
53
     */
54
    public function getUserHomePath()
55
    {
56
        $this->iAmNotTrainedTo('get the users home path');
57
    }
58
59
    /**
60
     * Check if we're running in test mode
61
     *
62
     * @return bool
63
     */
64
    public function isTesting()
65
    {
66
        return running_tests();
67
    }
68
69
    /**
70
     * Return commands we've run
71
     *
72
     * @return mixed
73
     */
74
    public function getCommands()
75
    {
76
        return $this->commands;
77
    }
78
79
    /**
80
     * Give a nice message about not being trained
81
     *
82
     * @param $activity
83
     */
84 1
    protected function iAmNotTrainedTo($activity)
85
    {
86 1
        $this->console->info("I haven't been trained to {$activity} on this system.");
87 1
        $this->console->info("You are welcome to train me and submit a PR.");
88 1
    }
89
}
90