Issues (4)

src/Chips/Endpoint/Identify.php (1 issue)

Severity
1
<?php
2
/**
3
 * Identify manager
4
 * User: moyo
5
 * Date: 21/11/2017
6
 * Time: 3:35 PM
7
 */
8
9
namespace Carno\Net\Chips\Endpoint;
10
11
use Ramsey\Uuid\Uuid;
12
13
trait Identify
14
{
15
    /**
16
     * @var string
17
     */
18
    private $identify = null;
19
20
    /**
21
     * @return string
22
     */
23
    public function id() : string
24
    {
25
        return $this->identify ?? $this->resetID()->id();
26
    }
27
28
    /**
29
     * @return self
30
     */
31
    public function resetID() : self
32
    {
33
        return $this->assignID(Uuid::uuid4()->toString());
0 ignored issues
show
Deprecated Code introduced by
The function Ramsey\Uuid\UuidInterface::toString() has been deprecated: In ramsey/uuid 4.0.0, this method will be replaced with the __toString() magic method, which is currently available in the Uuid concrete class. The new recommendation is to cast Uuid objects to string, rather than calling `toString()`. ( Ignorable by Annotation )

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

33
        return $this->assignID(/** @scrutinizer ignore-deprecated */ Uuid::uuid4()->toString());

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
34
    }
35
36
    /**
37
     * @param string $id
38
     * @return self
39
     */
40
    public function assignID(string $id) : self
41
    {
42
        $this->identify = $id;
43
        return $this;
44
    }
45
}
46