Completed
Push — master ( 05d77e...ee005d )
by Pavel
06:28
created

ContextExtractor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 16
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A extractContext() 0 4 1
A convert() 0 8 2
1
<?php
2
3
namespace Bankiru\Seo\Context;
4
5
use Bankiru\Seo\DestinationInterface;
6
7
final class ContextExtractor
8
{
9 1
    public function extractContext(DestinationInterface $destination)
10
    {
11 1
        return array_map([$this, 'convert'], iterator_to_array($destination));
12
    }
13
14 1
    private function convert($item)
15
    {
16 1
        if ($item instanceof ContextItemInterface) {
17
            return $item->getContext();
18
        }
19
20 1
        return $item;
21
    }
22
}
23