Passed
Pull Request — master (#56)
by Anatoly
04:25
created

MethodNotAllowedException::getAllowedMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * It's free open-source software released under the MIT License.
5
 *
6
 * @author Anatoly Fenric <[email protected]>
7
 * @copyright Copyright (c) 2018, Anatoly Fenric
8
 * @license https://github.com/sunrise-php/http-router/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/http-router
10
 */
11
12
namespace Sunrise\Http\Router\Exception;
13
14
/**
15
 * Import functions
16
 */
17
use function implode;
18
19
/**
20
 * MethodNotAllowedException
21
 */
22
class MethodNotAllowedException extends Exception
23
{
24
25
    /**
26
     * Gets allowed methods
27
     *
28
     * @return string[]
29
     */
30 5
    public function getAllowedMethods() : array
31
    {
32 5
        return $this->fromContext('allowed', []);
33
    }
34
35
    /**
36
     * Gets joined allowed methods
37
     *
38
     * @return string
39
     */
40 1
    public function getJoinedAllowedMethods() : string
41
    {
42 1
        return implode(',', $this->getAllowedMethods());
43
    }
44
}
45