Completed
Push — master ( f63aaf...b18312 )
by Alex
05:51
created

PayloadRenderTrait::payload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace AlexMasterov\EquipTwig\Traits;
4
5
use Equip\Payload;
6
7
trait PayloadRenderTrait
8
{
9
    /**
10
     * @return Payload $payload
11
     */
12 2
    protected function payload()
13
    {
14 2
        return new Payload;
15
    }
16
17
    /**
18
     * @param string $template The template name
19
     * @param array  $output   The output produced by the domain layer
20
     *
21
     * @return Payload
22
     */
23 1
    protected function render($template, array $output = [])
24
    {
25 1
        return $this->payload()
26 1
            ->withStatus(Payload::STATUS_OK)
27 1
            ->withSetting('template', $template)
28 1
            ->withOutput($output);
29
    }
30
}
31