Middle::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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