ObjectListener::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Cerbero\JsonObjects\Listeners;
4
5
/**
6
 * The object listener.
7
 *
8
 */
9
class ObjectListener extends AbstractListener
10
{
11
    /**
12
     * The callback processing the object.
13
     *
14
     * @var callable
15
     */
16
    protected $callback;
17
18
    /**
19
     * Set the dependencies.
20
     *
21
     * @param callable $callback
22
     */
23 4
    public function __construct(callable $callback)
24
    {
25 4
        $this->callback = $callback;
26 4
    }
27
28
    /**
29
     * Process the given extracted object.
30
     *
31
     * @param array $object
32
     * @return void
33
     */
34 3
    protected function processExtractedObject(array $object): void
35
    {
36 3
        call_user_func($this->callback, $object);
37
    }
38
}
39