Passed
Pull Request — develop (#2)
by AD
01:23
created

ForbiddenException::setResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
5
 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
6
 *
7
 * Licensed under The MIT License
8
 * For full copyright and license information, please see the LICENSE.txt
9
 * Redistributions of files must retain the above copyright notice.
10
 *
11
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
12
 * @link          https://cakephp.org CakePHP(tm) Project
13
 * @since         1.0.0
14
 * @license       https://opensource.org/licenses/mit-license.php MIT License
15
 */
16
17
namespace Phauthentic\Authorization\Exception;
18
19
/**
20
 * Forbidden Exception
21
 */
22
class ForbiddenException extends Exception
23
{
24
    /**
25
     * {@inheritDoc}
26
     */
27
    protected $code = 403;
28
29
    /**
30
     * {@inheritDoc}
31
     */
32
    protected $messageTemplate = 'Identity is not authorized to perform `%s` on `%s`.';
33
    /**
34
     * Policy check result.
35
     *
36
     * @var \Authorization\Policy\ResultInterface|null
0 ignored issues
show
Bug introduced by
The type Authorization\Policy\ResultInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
37
     */
38
    protected $result;
39
40
    /**
41
     * Returns policy check result if passed to the exception.
42
     *
43
     * @param \Authorization\Policy\ResultInterface|null $result Result
44
     * @return $this
45
     */
46
    public function setResult(?ResultInterface $result)
0 ignored issues
show
Bug introduced by
The type Phauthentic\Authorizatio...ception\ResultInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
47
    {
48
        $this->result = $result;
49
50
        return $this;
51
    }
52
53
    /**
54
     * Returns policy check result if passed to the exception.
55
     *
56
     * @return \Authorization\Policy\ResultInterface|null
57
     */
58
    public function getResult(): ?ResultInterface
59
    {
60
        return $this->result;
61
    }
62
}
63