Passed
Pull Request — master (#9)
by Pavel
11:27
created

AccessDeniedException::rolesNeeded()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
ccs 0
cts 9
cp 0
rs 9.6666
cc 1
eloc 5
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Bankiru\Api\Rpc\Exception;
4
5
class AccessDeniedException extends \RuntimeException implements RpcException
6
{
7
    /**
8
     * @param string[] $roles
9
     *
10
     * @return static
11
     */
12
    public static function rolesNeeded(array $roles)
13
    {
14
        return new static(
15
            sprintf(
16
                'Insufficient privileges: required one of %s role to access this method',
17
                implode(', ', $roles)
18
            )
19
        );
20
    }
21
}
22