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

BadMethodCallException::createMissingCall()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 6
cp 0
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
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