Completed
Push — master ( 8eb315...5aaba6 )
by Changwan
04:29
created

Job   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 70%

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 34
ccs 7
cts 10
cp 0.7
rs 10
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A read() 0 4 1
A delete() 0 4 1
1
<?php
2
namespace Wandu\Q;
3
4
use Wandu\Q\Contracts\Adapter;
5
use Wandu\Q\Contracts\AdapterJob;
6
use Wandu\Q\Contracts\Serializer;
7
8
class Job
9
{
10
    /** @var \Wandu\Q\Contracts\Adapter */
11
    protected $adapter;
12
    
13
    /** @var \Wandu\Q\Contracts\Serializer */
14
    protected $serializer;
15
    
16
    /** @var \Wandu\Q\Contracts\AdapterJob */
17
    protected $job;
18
    
19 2
    public function __construct(Adapter $adapter, Serializer $serializer, AdapterJob $job)
20
    {
21 2
        $this->adapter = $adapter;
22 2
        $this->serializer = $serializer;
23 2
        $this->job = $job;
24 2
    }
25
26
    /**
27
     * @return mixed
28
     */
29 2
    public function read()
30
    {
31 2
        return $this->serializer->unserialize($this->job->payload());
32
    }
33
34
    /**
35
     * @return void
36
     */
37
    public function delete()
38
    {
39
        $this->adapter->remove($this->job);
40
    }
41
}
42