TikiWiki/tiki-manager

View on GitHub
src/Libs/Host/SSHWrapperAdapter.php

Summary

Maintainability
A
0 mins
Test Coverage

__construct accesses the super-global variable $_ENV.
Open

    public function __construct($host, $user, $port)
    {
        $this->host = $host;
        $this->user = $user;
        $this->port = $port ?: 22;
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

runCommands accesses the super-global variable $_ENV.
Open

    public function runCommands($commands, $output = false)
    {
        $key = $_ENV['SSH_KEY'];
        $config = $_ENV['SSH_CONFIG'];

Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

runCommand accesses the super-global variable $_ENV.
Open

    public function runCommand($command, $options = [])
    {
        $cwd = !empty($options['cwd']) ? $options['cwd'] : $this->location;
        $env = !empty($options['env']) ? $options['env'] : $this->env;

Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getCommandPrefix accesses the super-global variable $_ENV.
Open

    private function getCommandPrefix($options = [])
    {
        $options['-i'] = !empty($options['pubkey']) ? $options['pubkey'] : $_ENV['SSH_KEY'];
        $options['-F'] = !empty($options['config']) ? $options['config'] : $_ENV['SSH_CONFIG'];
        $options['-p'] = !empty($options['port']) ? $options['port'] : $this->port;
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getCommandPrefix accesses the super-global variable $_ENV.
Open

    private function getCommandPrefix($options = [])
    {
        $options['-i'] = !empty($options['pubkey']) ? $options['pubkey'] : $_ENV['SSH_KEY'];
        $options['-F'] = !empty($options['config']) ? $options['config'] : $_ENV['SSH_CONFIG'];
        $options['-p'] = !empty($options['port']) ? $options['port'] : $this->port;
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

__construct accesses the super-global variable $_ENV.
Open

    public function __construct($host, $user, $port)
    {
        $this->host = $host;
        $this->user = $user;
        $this->port = $port ?: 22;
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

runCommands accesses the super-global variable $_ENV.
Open

    public function runCommands($commands, $output = false)
    {
        $key = $_ENV['SSH_KEY'];
        $config = $_ENV['SSH_CONFIG'];

Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

runCommands accesses the super-global variable $_ENV.
Open

    public function runCommands($commands, $output = false)
    {
        $key = $_ENV['SSH_KEY'];
        $config = $_ENV['SSH_CONFIG'];

Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The method runCommands has a boolean flag argument $output, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function runCommands($commands, $output = false)
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid unused private methods such as 'getHost'.
Open

    private function getHost()
    {
        return $this->host;
    }
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'getEnv'.
Open

    private function getEnv()
    {
        return $this->env;
    }
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'getPort'.
Open

    private function getPort()
    {
        return $this->port;
    }
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'getLocation'.
Open

    private function getLocation()
    {
        return $this->location;
    }
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'getUser'.
Open

    private function getUser()
    {
        return $this->user;
    }
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

There are no issues that match your filters.

Category
Status