Docker::install()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Fabrica\Tools\Docker;
4
5
use Fabrica\Tools\Bash;
6
7
/**
8
 * Docker Class
9
 *
10
 * @class Mysql
11
 */
12
class Docker
13
{
14
15
    protected $local = false;
16
17
    public function __construct($bash = false)
18
    {
19
        $this->local = $bash;
20
        if (!$this->local) {
21
            $this->local = new Bash();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Fabrica\Tools\Bash() of type object<Fabrica\Tools\Bash> is incompatible with the declared type boolean of property $local.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
22
        }
23
    }
24
25
    /**
26
     * # This script is meant for quick & easy install via:
27
     * #   $ curl -fsSL https://get.docker.com -o get-docker.sh
28
     * #   $ sh get-docker.sh
29
     * #
30
     * # For test builds (ie. release candidates):
31
     * #   $ curl -fsSL https://test.docker.com -o test-docker.sh
32
     * #   $ sh test-docker.sh
33
     * #
34
     * # NOTE: Make sure to verify the contents of the script
35
     * #       you downloaded matches the contents of install.sh
36
     * #       located at https://github.com/docker/docker-install
37
     * #       before executing.
38
     * #
39
     * # Git commit from https://github.com/docker/docker-install when
40
     * # the script was uploaded (Should only be modified by upload job):
41
     * SCRIPT_COMMIT_SHA=2f4ae48
42
     */
43
    public function install()
44
    {
45
        $this->local->exec(
0 ignored issues
show
Bug introduced by
The method exec cannot be called on $this->local (of type boolean).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
46
            'curl -fsSL https://get.docker.com -o get-docker.sh'.' && '.
47
            'sh get-docker.sh && rm sh get-docker.sh'
48
        );
49
    }
50
51
    public function installNow($bash = false)
52
    {
53
        return (new self($bash))->install();
54
    }
55
}
56