Completed
Push — master ( 67e168...53226a )
by Jean
02:28
created

spl_object_id()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
if ( ! function_exists('spl_object_id')) {
4
    /**
5
     * @see https://secure.php.net/manual/en/function.spl-object-id.php
6
     * This method doesn't exist before PHP 7.2.0
7
     */
8
    function spl_object_id($object)
9
    {
10
        ob_start();
11
        var_dump($object); // object(foo)#INSTANCE_ID (0) { }
1 ignored issue
show
Security Debugging Code introduced by
var_dump($object) looks like debug code. Are you sure you do not want to remove it?
Loading history...
12
        return preg_replace('~.+#(\d+).+~s', '$1', ob_get_clean());
13
    }
14
}
15
16
function type_exists($type_name)
17
{
18
    return in_array($type_name, [
19
        "boolean", 
20
        "integer", 
21
        "double", 
22
        "string", 
23
        "array", 
24
        "object", 
25
        "resource", 
26
        "resource (closed)", 
27
        "NULL", 
28
        "unknown type"
29
    ]);
30
}
31