Completed
Branch develop (6fd611)
by Quentin
02:32
created

InvalidGrantException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
ccs 4
cts 4
cp 1
cc 1
eloc 3
nc 1
nop 4
crap 1
1
<?php
2
3
namespace Majora\Component\OAuth\Exception;
4
5
use Majora\Component\OAuth\Entity\LoginAttempt;
6
7
/**
8
 * Custom exception class which have to be thrown into GrantExtensions
9
 * when given LoginAttempt is invalid.
10
 */
11
class InvalidGrantException extends \InvalidArgumentException
12
{
13
    /**
14
     * @var LoginAttempt
15
     */
16
    protected $loginAttempt;
17
18
    /**
19
     * Construct.
20
     *
21
     * @param LoginAttempt $loginAttempt
22
     */
23 4
    public function __construct(LoginAttempt $loginAttempt, $message = '', $code = null, \Exception $previous = null)
24
    {
25 4
        parent::__construct($message, $code, $previous);
26
27 4
        $this->loginAttempt = $loginAttempt;
28 4
    }
29
30
    /**
31
     * Return denied LoginAttempt object.
32
     *
33
     * @return LoginAttempt
34
     */
35 2
    public function getLoginAttempt()
36
    {
37 2
        return $this->loginAttempt;
38
    }
39
}
40