is_iterable()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
nc 2
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
if (!function_exists('spl_object_id')) {
3
    /**
4
     * @see https://secure.php.net/manual/en/function.spl-object-id.php
5
     * This method doesn't exist before PHP 7.2.0
6
     */
7
    function spl_object_id($object)
8
    {
9
        ob_start();
10
        var_dump($object); // object(foo)#INSTANCE_ID (0) { }
0 ignored issues
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...
11
        return preg_replace('~.+#(\d+).+~s', '$1', ob_get_clean());
12
    }
13
}
14
15
if (!function_exists('is_iterable')) {
16
    /**
17
     * @see https://github.com/symfony/polyfill-php71/commit/36004d119352f4506398032259a08e4ca9607285
18
     * This method doesn't exist before PHP 7.1.0
19
     */
20
    function is_iterable($object)
21
    {
22
        return is_array($object) || $object instanceof \Traversable;
23
    }
24
}
25