ExecutionInfo   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A toArray() 0 4 1
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
}