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

Zval   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A isRef() 0 13 3
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