DirectKeyAccessTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMapping() 0 3 1
A hasMatchingKey() 0 3 1
1
<?php
2
3
namespace Maiorano\ObjectHydrator\Strategies;
4
5
use Maiorano\ObjectHydrator\Mappings\HydrationMappingInterface;
6
7
trait DirectKeyAccessTrait
8
{
9
    /**
10
     * @param string $key
11
     *
12
     * @return bool
13
     */
14 9
    public function hasMatchingKey(string $key): bool
15
    {
16 9
        return isset($this->mappings[$key]);
17
    }
18
19
    /**
20
     * @param string $key
21
     *
22
     * @return HydrationMappingInterface
23
     */
24 13
    public function getMapping(string $key): HydrationMappingInterface
25
    {
26 13
        return $this->mappings[$key];
27
    }
28
}
29