CallbackWorker::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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