Middle   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 7 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Fixture\Innmind\Compose\Stack;
5
6
use Fixture\Innmind\Compose\Stack;
7
8
final class Middle implements Stack
9
{
10
    private $stack;
11
    private $text;
12
13
    public function __construct(Stack $stack, string $text = 'middle')
14
    {
15
        $this->stack = $stack;
16
        $this->text = $text;
17
    }
18
19
    public function __invoke(): string
20
    {
21
        return sprintf(
22
            '%s|%s|%s',
23
            $this->text,
24
            ($this->stack)(),
25
            $this->text
26
        );
27
    }
28
}
29