ExecutionInfo::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 3
1
<?php
2
namespace Workana\AsyncJobs;
3
4
use Bernard\Queue;
5
6
class ExecutionInfo
7
{
8
    /**
9
     * @var array
10
     */
11
    protected $data;
12
13
    public function __construct(Job $job, Queue $queue, Stopwatch $stopwatch)
14
    {
15
        $this->data = [
16
            'delay' => $job->getDelay(),
17
            'retries' => $job->getRetries(),
18
            'maxRetries' => $job->getMaxRetries(),
19
            'queueName' => (string) $queue,
20
            'preferredQueue' => $job->getPreferredQueueName(),
21
            'executionTime' => $stopwatch->elapsed(),
22
        ];
23
    }
24
25
    /**
26
     * @return array
27
     */
28
    public function toArray()
29
    {
30
        return $this->data;
31
    }
32
}