Passed
Push — main ( e6c2b4...31cdf0 )
by Michael
59s queued 13s
created

HandlesCallbacks::beforeParentCalls()   A

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 0
Metric Value
eloc 1
dl 0
loc 3
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
namespace MichaelRubel\ValueObjects\Concerns;
4
5
use Closure;
6
7
trait HandlesCallbacks
8
{
9
    /**
10
     * Callback to hook into parent construct
11
     * before any other call is performed.
12
     *
13
     * @var Closure
14
     */
15
    protected Closure $before;
16
17
    /**
18
     * Set the "before" callback.
19
     *
20
     * @param  Closure  $callback
21
     *
22
     * @return void
23
     */
24 16
    protected function beforeParentCalls(Closure $callback): void
25
    {
26 16
        $this->before = $callback;
27
    }
28
}
29