Passed
Pull Request — master (#43)
by Arman
03:54
created

CsrfException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A tokenNotFound() 0 3 1
A tokenNotMatched() 0 3 1
1
<?php
2
3
/**
4
 * Quantum PHP Framework
5
 *
6
 * An open source software development framework for PHP
7
 *
8
 * @package Quantum
9
 * @author Arman Ag. <[email protected]>
10
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
11
 * @link http://quantum.softberg.org/
12
 * @since 2.5.0
13
 */
14
15
namespace Quantum\Exceptions;
16
17
/**
18
 * Class CsrfException
19
 * @package Quantum\Exceptions
20
 */
21
class CsrfException extends \Exception
22
{
23
    /**
24
     * CSRF token not found message
25
     */
26
    const CSRF_TOKEN_NOT_FOUND = 'CSRF Token is missing';
27
28
    /**
29
     * CSRF token not matched message
30
     */
31
    const CSRF_TOKEN_NOT_MATCHED = 'CSRF Token does not matched';
32
33
    /**
34
     * @return \Quantum\Exceptions\CsrfException
35
     */
36
    public static function tokenNotFound(): CsrfException
37
    {
38
        return new static(self::CSRF_TOKEN_NOT_FOUND, E_WARNING);
39
    }
40
41
    /**
42
     * @return \Quantum\Exceptions\CsrfException
43
     */
44
    public static function tokenNotMatched(): CsrfException
45
    {
46
        return new static(self::CSRF_TOKEN_NOT_MATCHED, E_WARNING);
47
    }
48
}
49