BadTargetTypeException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
/**
4
 * BadTargetTypeException
5
 *
6
 * @package php-deferred-callchain
7
 * @author  Jean Claveau
8
 */
9
namespace JClaveau\Async\Exceptions;
10
11
use JClaveau\Async\DeferredCallChain;
12
use LogicException;
13
/**
14
 * Thrown when applying a deferred call chain on a target which is not
15
 * of the expected type.
16
 */
17
class BadTargetTypeException extends LogicException
18
{
19
    /**
20
     * Constructor.
21
     * 
22
     * @param DeferredCallChain $callchain
23
     * @param mixed             $expected_target The expected type
24
     * @param mixed             $target
25
     */
26
    public function __construct(DeferredCallChain $callchain, $expected_target, $target)
27
    {
28
        $this->message = "You are trying to define a target of type " . gettype($target) . " for the {$callchain} allowing only: " . $expected_target;
29
    }
30
}