Completed
Push — master ( 0e3a66...27a5b1 )
by Dmitry
13:54
created

UnsetArrayValue::__set_state()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 2
cp 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
namespace yii\helpers;
9
10
/**
11
 * Object that represents the removal of array value while performing [[ArrayHelper::merge()]].
12
 *
13
 * Usage example:
14
 *
15
 * ```php
16
 * $array1 = [
17
 *     'ids' => [
18
 *         1,
19
 *     ],
20
 *     'validDomains' => [
21
 *         'example.com',
22
 *         'www.example.com',
23
 *     ],
24
 * ];
25
 *
26
 * $array2 = [
27
 *     'ids' => [
28
 *         2,
29
 *     ],
30
 *     'validDomains' => new \yii\helpers\UnsetArrayValue(),
31
 * ];
32
 *
33
 * $result = \yii\helpers\ArrayHelper::merge($array1, $array2);
34
 * ```
35
 *
36
 * The result will be
37
 *
38
 * ```php
39
 * [
40
 *     'ids' => [
41
 *         1,
42
 *         2,
43
 *     ],
44
 * ]
45
 * ```
46
 *
47
 * @author Robert Korulczyk <[email protected]>
48
 * @since 2.0.10
49
 */
50
class UnsetArrayValue
51
{
52
    /**
53
     * Restores class state after using `var_export()`.
54
     *
55
     * @param array $state
56
     * @return UnsetArrayValue
57
     * @see var_export()
58
     * @since 2.0.16
59
     */
60
    public static function __set_state($state)
61
    {
62
        return new self();
63
    }
64
}
65