CallbackMetadataEnricher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A enrich() 0 3 1
A __construct() 0 3 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/metadata project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Metadata;
10
11
use Closure;
12
13
final class CallbackMetadataEnricher implements MetadataEnricherInterface
14
{
15
    private Closure $callable;
16
17 2
    public function __construct(Closure $callable)
18
    {
19 2
        $this->callable = $callable;
20 2
    }
21
22 2
    public function enrich(MetadataInterface $metadata): MetadataInterface
23
    {
24 2
        return ($this->callable)($metadata);
25
    }
26
}
27