SimpleSaveAggregateCallback::save()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace Governor\Framework\Repository;
10
11
use Governor\Framework\Domain\AggregateRootInterface;
12
use Governor\Framework\UnitOfWork\SaveAggregateCallbackInterface;
13
14
/**
15
 * Description of SimpleSaveAggregateCallback
16
 *
17
 * @author david
18
 */
19
class SimpleSaveAggregateCallback implements SaveAggregateCallbackInterface
20
{
21
22
    private $closure;
23
24 25
    public function __construct(\Closure $closure)
25
    {
26 25
        $this->closure = $closure;
27 25
    }
28
29 9
    public function save(AggregateRootInterface $aggregate)
30
    {
31 9
        $cb = $this->closure;
32 9
        $cb($aggregate);
33 9
    }
34
35
}
36