Completed
Push — master ( b677af...f25cae )
by duan
01:57
created

Zval::isRefto()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 11
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 2
crap 12
1
<?php
2
3
4
namespace Yiranzai\Tools;
5
6
/**
7
 * Class Zval
8
 * @package Yiranzai\Tools
9
 */
10
class Zval
11
{
12
    /**
13
     * Determine if two variables have a reference relationship
14
     *
15
     * @param $left
16
     * @param $right
17
     * @return bool
18
     */
19 3
    public static function isRef(&$left, &$right): bool
20
    {
21 3
        $temp = $left;
22 3
        if (is_object($left) || is_array($left)) {
23 3
            $left  = 'test';
24 3
            $isRef = $right === 'test';
25 3
            $left  = $temp;
26
        } else {
27 3
            $left  = [];
28 3
            $isRef = $right === [];
29 3
            $left  = $temp;
30
        }
31 3
        return $isRef;
32
    }
33
}
34