Passed
Push — master ( 87ba60...d80a49 )
by Alain
02:43
created

NullView::setBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Bright Nucleus View Component.
4
 *
5
 * @package   BrightNucleus\View
6
 * @author    Alain Schlesser <[email protected]>
7
 * @license   MIT
8
 * @link      http://www.brightnucleus.com/
9
 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
 */
11
12
namespace BrightNucleus\View\View;
13
14
use BrightNucleus\View\Support\NullFindable;
15
use BrightNucleus\View\View;
16
use BrightNucleus\View\ViewBuilder;
17
18
/**
19
 * Class NullView.
20
 *
21
 * @since   0.1.0
22
 *
23
 * @package BrightNucleus\View\View
24
 * @author  Alain Schlesser <[email protected]>
25
 */
26
class NullView implements View, NullFindable
27
{
28
29
    /**
30
     * Check whether the Findable can handle an individual criterion.
31
     *
32
     * @since 0.1.0
33
     *
34
     * @param mixed $criterion Criterion to check.
35
     *
36
     * @return bool Whether the Findable can handle the criterion.
37
     */
38
    public function canHandle($criterion)
39
    {
40
        return true;
41
    }
42
43
    /**
44
     * Render the view.
45
     *
46
     * @since 0.1.0
47
     *
48
     * @param array $context Optional. The context in which to render the view.
49
     * @param bool  $echo    Optional. Whether to echo the output immediately. Defaults to false.
50
     *
51
     * @return string|void Rendered HTML or nothing, depending on $echo argument.
52
     */
53 1
    public function render(array $context = [], $echo = false)
54
    {
55 1
        if ( ! $echo) {
56 1
            return '';
57
        }
58
    }
59
60
    /**
61
     * Render a partial view for a given URI.
62
     *
63
     * @since 0.2.0
64
     *
65
     * @param string      $view    View identifier to create a view for.
66
     * @param array       $context Optional. The context in which to render the view.
67
     * @param string|null $type    Type of view to create.
68
     *
69
     * @return string Rendered HTML content.
70
     */
71
    public function renderPart($view, array $context = [], $type = null)
72
    {
73
        return '';
74
    }
75
76
    /**
77
     * Associate a view builder with this view.
78
     *
79
     * @since 0.2.0
80
     *
81
     * @param ViewBuilder $builder
82
     *
83
     * @return static
84
     */
85
    public function setBuilder(ViewBuilder $builder)
86
    {
87
        return $this;
88
    }
89
}
90