SSH2Agent::authenticate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 4
cp 0
crap 2
1
<?php
2
3
namespace Dazzle\SSH\Auth;
4
5
use Dazzle\SSH\SSH2AuthInterface;
6
7
/**
8
 * Agent based SSH2 authentication
9
 */
10
class SSH2Agent implements SSH2AuthInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $username;
16
17
    /**
18
     * Constructor
19
     *
20
     * @param string $username The authentication username
21
     */
22 2
    public function __construct($username)
23
    {
24 2
        $this->username = $username;
25 2
    }
26
27
    /**
28
     * @override
29
     * @inheritDoc
30
     */
31
    public function authenticate($conn)
32
    {
33
        return @ssh2_auth_agent(
34
            $conn,
35
            $this->username
36
        );
37
    }
38
}
39