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
|
|||
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 |
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.