Completed
Pull Request — master (#33)
by Yann
03:02
created

BadMethodCallException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 49
ccs 10
cts 16
cp 0.625
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createMissingChannel() 0 9 1
A createMissingMessage() 0 9 1
A createMissingCall() 0 10 1
1
<?php
2
3
namespace Yokai\MessengerBundle\Exception;
4
5
use BadMethodCallException as BaseException;
6
7
/**
8
 * @author Yann Eugoné <[email protected]>
9
 */
10
class BadMethodCallException extends BaseException implements ExceptionInterface
11
{
12
    /**
13
     * @param string $methodThatShouldBeCalled
14
     * @param string $methodCalled
15
     *
16
     * @return BadMethodCallException
17
     */
18
    public static function createMissingCall($methodThatShouldBeCalled, $methodCalled)
19
    {
20
        return new self(
21
            sprintf(
22
                'The "%s" method must be called before calling "%s".',
23
                $methodThatShouldBeCalled,
24
                $methodCalled
25
            )
26
        );
27
    }
28
29
    /**
30
     * @param string $channel
31
     *
32
     * @return BadMethodCallException
33
     */
34 1
    public static function createMissingChannel($channel)
35
    {
36 1
        return new self(
37 1
            sprintf(
38 1
                'The "%s" channel was never registered.',
39 1
                $channel
40
            )
41
        );
42
    }
43
44
    /**
45
     * @param string $message
46
     *
47
     * @return BadMethodCallException
48
     */
49 1
    public static function createMissingMessage($message)
50
    {
51 1
        return new self(
52 1
            sprintf(
53 1
                'The "%s" channel was never registered.',
54 1
                $message
55
            )
56
        );
57
    }
58
}
59