Zval::isRef()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 13
ccs 10
cts 10
cp 1
rs 9.9332
cc 3
nc 2
nop 2
crap 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