BindingNotAcceptedException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 21
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A forBindingClass() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the puli/discovery package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Puli\Discovery\Api\Type;
13
14
use Exception;
15
use RuntimeException;
16
17
/**
18
 * Thrown when a binding type does not accept a binding.
19
 *
20
 * @since  1.0
21
 *
22
 * @author Bernhard Schussek <[email protected]>
23
 */
24
class BindingNotAcceptedException extends RuntimeException
25
{
26
    /**
27
     * Creates a new exception.
28
     *
29
     * @param string         $typeName     The name of the binding type.
30
     * @param string         $bindingClass The class name of the binding.
31
     * @param Exception|null $cause        The exception that caused this
32
     *                                     exception.
33
     *
34
     * @return static The created exception.
35
     */
36 6
    public static function forBindingClass($typeName, $bindingClass, Exception $cause = null)
37
    {
38 6
        return new static(sprintf(
39 6
            'The type "%s" does accept bindings of class "%s".',
40
            $typeName,
41
            $bindingClass
42 6
        ), 0, $cause);
43
    }
44
}
45