SSH2Password   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
ccs 6
cts 6
cp 1
wmc 2
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A authenticate() 0 4 1
1
<?php
2
3
namespace Dazzle\SSH\Auth;
4
5
use Dazzle\SSH\SSH2AuthInterface;
6
7
/**
8
 * Password based SSH2 authentication
9
 */
10
class SSH2Password implements SSH2AuthInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $username;
16
17
    /**
18
     * @var string
19
     */
20
    protected $password;
21
22
    /**
23
     * @param string $username The authentication username
24
     * @param string $password The authentication password
25
     */
26 5
    public function __construct($username, $password)
27
    {
28 5
        $this->username = $username;
29 5
        $this->password = $password;
30 5
    }
31
32
    /**
33
     * @override
34
     * @inheritDoc
35
     */
36 3
    public function authenticate($conn)
37
    {
38 3
        return @ssh2_auth_password($conn, $this->username, $this->password);
39
    }
40
}
41