Completed
Push — 9.0-dev ( bc2bbc...09a935 )
by Radu
02:28
created

OutputTrait::outputCli()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace WebServCo\Framework\Traits;
3
4
trait OutputTrait
5
{
6
    protected $outputLoader;
7
    
8
    final protected function output()
9
    {
10
        return $this->outputLoader;
11
    }
12
    
13
    final protected function outputCli($string, $eol = true)
14
    {
15
        return $this->output()->cli($string, $eol);
16
    }
17
    
18
    protected function outputHtml($data, $pageTemplate, $mainTemplate = null)
19
    {
20
        return new \WebServCo\Framework\Libraries\HttpResponse(
21
            $this->output()->htmlPage($data, $pageTemplate, $mainTemplate),
22
            200,
23
            ['Content-Type' => 'text/html']
24
        );
25
    }
26
    
27
    protected function outputJson($data)
28
    {
29
        return new \WebServCo\Framework\Libraries\HttpResponse(
30
            $this->output()->json($data),
31
            200,
32
            ['Content-Type' => 'application/json']
33
        );
34
    }
35
}
36