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

ContextExtractor::convert()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 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