1 | <?php |
||||
2 | |||||
3 | namespace ByTIC\Hello\Models\Clients; |
||||
4 | |||||
5 | use ByTIC\Hello\Utility\RandomHelper; |
||||
6 | use League\OAuth2\Server\Entities\ClientEntityInterface; |
||||
7 | use League\OAuth2\Server\Entities\Traits\ClientTrait; |
||||
8 | use League\OAuth2\Server\Entities\Traits\EntityTrait; |
||||
9 | |||||
10 | /** |
||||
11 | * Class Token |
||||
12 | * @package ByTIC\Hello\Models\Clients |
||||
13 | */ |
||||
14 | class Client extends \Nip\Records\Record implements ClientEntityInterface |
||||
15 | { |
||||
16 | 1 | use ClientTrait; |
|||
17 | 1 | use EntityTrait; |
|||
18 | 1 | use Traits\ClientHasGrantsTrait; |
|||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
19 | 1 | use Traits\ClientHasSecretTrait; |
|||
20 | 1 | use Traits\ClientHasRedirectTrait; |
|||
21 | |||||
22 | 20 | public function __construct() |
|||
23 | { |
||||
24 | 20 | $this->setIdentifier(RandomHelper::generateIdentifier()); |
|||
25 | 20 | $this->setSecret(RandomHelper::generateToken()); |
|||
26 | 20 | } |
|||
27 | |||||
28 | /** |
||||
29 | * @inheritDoc |
||||
30 | */ |
||||
31 | 10 | public function writeData($data = false) |
|||
32 | { |
||||
33 | 10 | parent::writeData($data); |
|||
34 | |||||
35 | 10 | if (isset($data['grant_types']) && !empty($data['grant_types'])) { |
|||
36 | 2 | $this->initGrantsFromDb($data['grant_types']); |
|||
37 | } |
||||
38 | |||||
39 | 10 | if (isset($data['identifier']) && !empty($data['identifier'])) { |
|||
40 | 1 | $this->initIdentifierFromDb($data['identifier']); |
|||
41 | } |
||||
42 | 10 | } |
|||
43 | |||||
44 | /** |
||||
45 | * @inheritDoc |
||||
46 | */ |
||||
47 | 20 | public function setIdentifier($identifier) |
|||
48 | { |
||||
49 | 20 | $this->setDataValue('identifier', $identifier); |
|||
0 ignored issues
–
show
The function
ByTIC\DataObjects\AbstractDto::setDataValue() has been deprecated: use
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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. ![]() |
|||||
50 | 20 | $this->identifier = $identifier; |
|||
51 | 20 | } |
|||
52 | |||||
53 | /** |
||||
54 | * @param null $data |
||||
0 ignored issues
–
show
|
|||||
55 | */ |
||||
56 | 1 | public function initIdentifierFromDb($data = null) |
|||
57 | { |
||||
58 | 1 | $data = $data === null ? $this->_data['identifier'] : $data; |
|||
0 ignored issues
–
show
The property
_data does not exist on ByTIC\Hello\Models\Clients\Client . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
59 | 1 | if (!empty($data)) { |
|||
60 | 1 | $this->setIdentifier($data); |
|||
61 | } |
||||
62 | 1 | } |
|||
63 | |||||
64 | /** |
||||
65 | * @param mixed $name |
||||
66 | */ |
||||
67 | 4 | public function setName($name) |
|||
68 | { |
||||
69 | 4 | $this->name = $name; |
|||
70 | 4 | parent::setDataValue('name', $name); |
|||
0 ignored issues
–
show
The function
ByTIC\DataObjects\Legacy...nsTrait::setDataValue() has been deprecated: use
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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. ![]() |
|||||
71 | 4 | } |
|||
72 | } |
||||
73 |