Encoder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 20
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 14 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PSR7SessionEncodeDecode;
6
7
final class Encoder implements EncoderInterface
8
{
9
    /**
10
     * {@inheritDoc}
11
     */
12 4
    public function __invoke(array $sessionData): string
13
    {
14 4
        if (empty($sessionData)) {
15 1
            return '';
16
        }
17
18 3
        $encodedData = '';
19
20 3
        foreach ($sessionData as $key => $value) {
21 3
            $encodedData .= $key . '|' . serialize($value);
22
        }
23
24 3
        return $encodedData;
25
    }
26
}
27