CallbackWorker   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 23
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of Transfer.
5
 *
6
 * For the full copyright and license information, please view the LICENSE file located
7
 * in the root directory.
8
 */
9
10
namespace Transfer\Worker;
11
12
/**
13
 * Worker implementation with callback support.
14
 */
15
class CallbackWorker implements WorkerInterface
16
{
17
    /**
18
     * @var callback
19
     */
20
    protected $callback;
21
22
    /**
23
     * @param callback
24
     */
25 7
    public function __construct($callback)
26
    {
27 7
        $this->callback = $callback;
28 7
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33 6
    public function handle($object)
34
    {
35 6
        return call_user_func_array($this->callback, array($object));
36
    }
37
}
38