Completed
Push — master ( bdbfd8...7102d7 )
by Ashley
01:28
created

BadMethodCallException::throw()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 9
cts 9
cp 1
rs 9.2
c 0
b 0
f 0
cc 4
eloc 9
nc 8
nop 3
crap 4
1
<?php
2
3
namespace Clarkeash\Converter\Exceptions;
4
5
class BadMethodCallException extends \BadMethodCallException
6
{
7 3
    public static function throw($method, $class, $via = null)
8
    {
9 3
        if (is_object($class)) {
10 3
            $class = get_class($class);
11
        }
12
13 3
        $message = sprintf('Method: %s does not exist on class: %s', $method, $class);
14
15 3
        if (is_object($via)) {
16 2
            $via = get_class($via);
17
        }
18
19 3
        if ($via) {
20 2
            $message .= sprintf(' via: %s', $via);
21
        }
22
23 3
        throw new BadMethodCallException($message);
24
    }
25
}
26