Passed
Push — master ( 3c5f34...4a3ec6 )
by Asmir
01:27 queued 50s
created

SerializationHelper::__unserialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Metadata;
6
7
trait SerializationHelper
8
{
9
    /**
10
     * @deprecated Use serializeToArray
11
     *
12
     * @return string
13
     */
14
    public function serialize()
15
    {
16
        return serialize($this->serializeToArray());
0 ignored issues
show
Bug introduced by
The method serializeToArray() does not exist on Metadata\SerializationHelper. Did you maybe mean serialize()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
        return serialize($this->/** @scrutinizer ignore-call */ serializeToArray());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
17
    }
18
19
    /**
20
     * @deprecated Use unserializeFromArray
21
     *
22
     * @param string $str
23
     *
24
     * @return void
25
     */
26
    public function unserialize($str)
27
    {
28
        $this->unserializeFromArray(unserialize($str));
0 ignored issues
show
Bug introduced by
The method unserializeFromArray() does not exist on Metadata\SerializationHelper. Did you maybe mean serialize()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        $this->/** @scrutinizer ignore-call */ 
29
               unserializeFromArray(unserialize($str));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
    }
30
31
    public function __serialize(): array
32
    {
33
        return $this->serializeToArray();
34
    }
35
36
    public function __unserialize(array $data): void
37
    {
38
        $this->unserializeFromArray($data);
39
    }
40
}
41