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

PayloadRenderTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A payload() 0 4 1
A render() 0 7 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