Code Duplication    Length = 37-37 lines in 2 locations

src/onepay/MagicPropertiesTrait.php 1 location

@@ 16-52 (lines=37) @@
13
 * @author Vuong Minh <[email protected]>
14
 * @since 1.0
15
 */
16
trait MagicPropertiesTrait
17
{
18
    /**
19
     * @inheritdoc
20
     * @throws \yii\base\UnknownPropertyException
21
     */
22
    public function __get($name)
23
    {
24
        try {
25
            return parent::__get($name);
26
        } catch (\yii\base\UnknownPropertyException $e) {
27
            if (isset($this["vpc_$name"])) {
28
                return $this["vpc_$name"];
29
            } else {
30
                throw $e;
31
            }
32
        }
33
    }
34
35
    /**
36
     * @inheritdoc
37
     * @throws \yii\base\UnknownPropertyException
38
     */
39
    public function __set($name, $value)
40
    {
41
        try {
42
            parent::__set($name, $value);
43
        } catch (\yii\base\UnknownPropertyException $e) {
44
            if (isset($this["vpc_$name"])) {
45
                $this["vpc_$name"] = $value;
46
            } else {
47
                throw $e;
48
            }
49
        }
50
    }
51
52
}
53

src/vnpayment/MagicPropertiesTrait.php 1 location

@@ 16-52 (lines=37) @@
13
 * @author Vuong Minh <[email protected]>
14
 * @since 1.0
15
 */
16
trait MagicPropertiesTrait
17
{
18
    /**
19
     * @inheritdoc
20
     * @throws \yii\base\UnknownPropertyException
21
     */
22
    public function __get($name)
23
    {
24
        try {
25
            return parent::__get($name);
26
        } catch (\yii\base\UnknownPropertyException $e) {
27
            if (isset($this["vnp_$name"])) {
28
                return $this["vnp_$name"];
29
            } else {
30
                throw $e;
31
            }
32
        }
33
    }
34
35
    /**
36
     * @inheritdoc
37
     * @throws \yii\base\UnknownPropertyException
38
     */
39
    public function __set($name, $value)
40
    {
41
        try {
42
            parent::__set($name, $value);
43
        } catch (\yii\base\UnknownPropertyException $e) {
44
            if (isset($this["vnp_$name"])) {
45
                $this["vnp_$name"] = $value;
46
            } else {
47
                throw $e;
48
            }
49
        }
50
    }
51
52
}
53