Completed
Push — master ( d05a4b...d896c9 )
by Jonathan
01:23
created

HardcodedUserPlugin::login()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 2
1
<?php
2
3
namespace Vectorface\Tests\Auth\Helpers;
4
5
use Vectorface\Auth\Auth;
6
use Vectorface\Auth\Plugin\BaseAuthPlugin;
7
8
/**
9
 * An auth plugin that hard-codes username/password foo/bar.
10
 */
11
class HardcodedUserPlugin extends BaseAuthPlugin
12
{
13
    /**
14
     * Auth plugin hook to be fired on login.
15
     *
16
     * @param string $username
17
     * @param string $password
18
     * @return int
19
     */
20
    public function login($username, $password)
21
    {
22
        return ($username === 'foo' && $password === 'bar') ? Auth::RESULT_SUCCESS : Auth::RESULT_FAILURE;
23
    }
24
}
25