CanRenderTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
dl 0
loc 30
ccs 6
cts 8
cp 0.75
rs 10
c 1
b 0
f 1
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A render() 0 3 1
A output() 0 7 2
1
<?php
2
3
namespace ByTIC\Assets\Assets\Asset\Traits;
4
5
use ByTIC\Assets\Assets\Asset\AssetRenderer;
6
7
/**
8
 * Trait CanRenderTrait
9
 * @package ByTIC\Assets\Assets\Asset\Traits
10
 */
11
trait CanRenderTrait
12
{
13
    protected $output = null;
14
15
    /**
16
     * @return string
17
     */
18
    public function __toString()
19
    {
20
        return $this->render();
21
    }
22
23
    /**
24
     * @return string
25
     */
26 1
    public function output()
27
    {
28 1
        if ($this->output === null) {
29 1
            $this->output = $this->render();
30
        }
31
32 1
        return $this->output;
33
    }
34
35
    /**
36
     * @return string
37
     */
38 1
    protected function render()
39
    {
40 1
        return AssetRenderer::for($this);
41
    }
42
}
43