Completed
Push — master ( e62d15...82e593 )
by Jean
02:05
created

later()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * File gathering functions
4
 */
5
6
if (! function_exists('type_exists')) {
7
    /**
8
     * Checks if a type is a valid PHP one.
9
     * 
10
     * @param  string $type_name The type name to check
11
     * @return bool   The result
12
     */
13
    function type_exists($type_name)
14
    {
15
        return in_array($type_name, [
16
            "boolean", 
17
            "integer", 
18
            "double", 
19
            "string", 
20
            "array", 
21
            "object", 
22
            "resource", 
23
            "resource (closed)", 
24
            "NULL", 
25
            "unknown type"
26
        ]);
27
    }
28
}
29
30
if (! function_exists('later')) {
31
    /**
32
     * Create a deferred call chain in a functionnal way.
33
     * 
34
     * @param  string $class_type_interface_or_instance The expected target class/type/interface/instance
35
     * @return \JClaveau\Async\DeferredCallChain
36
     */
37
    function later($class_type_interface_or_instance=null)
38
    {
39
        return new \JClaveau\Async\DeferredCallChain(...func_get_args());
0 ignored issues
show
Bug introduced by
func_get_args() is expanded, but the parameter $class_type_interface_or_instance of JClaveau\Async\DeferredCallChain::__construct() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

39
        return new \JClaveau\Async\DeferredCallChain(/** @scrutinizer ignore-type */ ...func_get_args());
Loading history...
40
    }
41
}
42