| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | private function buildApiKey(string $key, bool $enabled, ?Chronos $expiresAt = null): ApiKey |
||
| 24 | { |
||
| 25 | $apiKey = new ApiKey($expiresAt); |
||
| 26 | $refObj = new ReflectionObject($apiKey); |
||
| 27 | $keyProp = $refObj->getProperty('key'); |
||
| 28 | $keyProp->setAccessible(true); |
||
| 29 | $keyProp->setValue($apiKey, $key); |
||
| 30 | |||
| 31 | if (! $enabled) { |
||
| 32 | $apiKey->disable(); |
||
| 33 | } |
||
| 34 | |||
| 35 | return $apiKey; |
||
| 36 | } |
||
| 38 |