Completed
Push — master ( f2de0d...859793 )
by Damien
02:37
created

DispatcherException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 0
dl 0
loc 29
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A notTagged() 0 6 1
A controllerActionDoesNotExist() 0 6 1
A controllerActionDidNotReturnResponse() 0 12 1
1
<?php
2
/**
3
 * Veto.
4
 * PHP Microframework.
5
 *
6
 * @author Damien Walsh <[email protected]>
7
 * @copyright Damien Walsh 2013-2014
8
 * @version 0.1
9
 * @package veto
10
 */
11
namespace Veto\Layer\Dispatcher\Exception;
12
13
/**
14
 * DispatcherException
15
 *
16
 * Represents a problem with the dispatcher layer.
17
 *
18
 * @since 0.4
19
 */
20
class DispatcherException extends \RuntimeException
21
{
22
    public static function notTagged($method, $path)
23
    {
24
        return new self(
25
            sprintf('The request was not tagged by a router: %s %s', $method, $path), 500
26
        );
27
    }
28
29
    public static function controllerActionDoesNotExist($method, $controller)
30
    {
31
        return new self(
32
            sprintf('The controller action %s does not exist for controller %s', $method, $controller), 500
33
        );
34
    }
35
36
    public static function controllerActionDidNotReturnResponse($method, $controller, $actualType)
37
    {
38
        return new self(
39
            sprintf(
40
                'The controller action method %s for controller %s must return an instance of Veto\\HTTP\\Response. ' .
41
                'A %s was returned instead.',
42
                $method,
43
                $controller,
44
                $actualType
45
            ), 500
46
        );
47
    }
48
}
49