Layout::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 7
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Conia\Boiler;
6
7
class Layout extends Template
8
{
9
    /**
10
     * @psalm-param non-empty-string $path
11
     */
12 8
    public function __construct(
13
        string $path,
14
        protected readonly string $body,
15
        Sections $sections,
16
        ?Engine $engine = null,
17
    ) {
18 8
        parent::__construct($path, $sections, $engine);
19
    }
20
21
    /**
22
     * Used in the layout template to get the content of the wrapped template.
23
     */
24 6
    public function body(): string
25
    {
26 6
        return $this->body;
27
    }
28
29 8
    protected function templateContext(array $context, array $whitelist, bool $autoescape): LayoutContext
30
    {
31 8
        return new LayoutContext($this, $context, $whitelist, $autoescape);
32
    }
33
}
34