IsCallable   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 2
dl 0
loc 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
1
<?php
2
/**
3
 * File was created 29.05.2015 21:06
4
 *
5
 * @author Karsten J. Gerber <[email protected]>
6
 */
7
8
namespace PeekAndPoke\Component\Psi\Psi;
9
10
use PeekAndPoke\Component\Psi\UnaryFunction;
11
12
/**
13
 * IsCallable checks if the given value is a callable.
14
 *
15
 * This is true when the value is:
16
 *
17
 * - a Closure
18
 * - an anonymous function
19
 * - a class that implements the __invoke function
20
 *
21
 * @see    IsCallableIsNotCallableTest
22
 *
23
 * @author Karsten J. Gerber <[email protected]>
24
 */
25
class IsCallable implements UnaryFunction
26
{
27
    /**
28
     * @param mixed $input
29
     *
30
     * @return bool
31
     */
32 8
    public function __invoke($input)
33
    {
34 8
        return is_callable($input);
35
    }
36
}
37