Completed
Push — master ( d2bebe...b3f5fe )
by Pavel
02:38
created

ContextExtractor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 16
ccs 6
cts 6
cp 1
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 2
    public function extractContext(DestinationInterface $destination)
10
    {
11 2
        return array_map([$this, 'convert'], iterator_to_array($destination));
12
    }
13
14 2
    private function convert($item)
15
    {
16 2
        if ($item instanceof ContextItemInterface) {
17 1
            return $item->getContext();
18
        }
19
20 2
        return $item;
21
    }
22
}
23