| Conditions | 4 |
| Paths | 6 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 50 | 51 | public function __construct(string $type, array $payload = null, string $messageId = null, float $created = null, float $executeAt = null, int $retries = 0) |
|
| 51 | { |
||
| 52 | $this->messageId = $messageId; |
||
| 53 | if (!$messageId) { |
||
| 54 | try { |
||
| 55 | 42 | $this->messageId = Uuid::uuid4()->toString(); |
|
| 56 | } catch (\Exception $e) { |
||
| 57 | 42 | $this->messageId = rand(10000, 99999999); |
|
|
|
|||
| 58 | } |
||
| 59 | |||
| 60 | } |
||
| 61 | $this->created = $created; |
||
| 62 | if (!$created) { |
||
| 63 | 39 | $this->created = microtime(true); |
|
| 64 | } |
||
| 65 | 39 | $this->type = $type; |
|
| 66 | $this->payload = $payload; |
||
| 67 | $this->executeAt = $executeAt; |
||
| 68 | $this->retries = $retries; |
||
| 69 | } |
||
| 70 | |||
| 119 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.