Test Failed
Push — master ( 0e8283...90a3be )
by Alain
05:03
created

NullView::getContext()   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 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php declare(strict_types=1);
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-2017 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): bool
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 Rendered HTML.
52
     */
53 1
    public function render(array $context = [], bool $echo = false): string
54
    {
55 1
        return '';
56 1
    }
57
58
    /**
59
     * Render a partial view (or section) for a given URI.
60
     *
61
     * @since 0.2.0
62
     *
63
     * @param string      $view    View identifier to create a view for.
64
     * @param array       $context Optional. The context in which to render the view.
65
     * @param string|null $type    Type of view to create.
66
     *
67
     * @return string Rendered HTML content.
68
     */
69
    public function section(string $view, array $context = [], $type = null): string
70
    {
71
        return '';
72
    }
73
74
    /**
75
     * Get the entire array of contextual data.
76
     *
77
     * @since 0.4.0
78
     *
79
     * @return array Array of contextual data.
80
     */
81
    public function getContext(): array
82
    {
83
        return [];
84
    }
85
86
    /**
87
     * Associate a view builder with this view.
88
     *
89
     * @since 0.2.0
90
     *
91
     * @param ViewBuilder $builder
92
     *
93
     * @return View
94
     */
95
    public function setBuilder(ViewBuilder $builder): View
96
    {
97
        return $this;
98
    }
99
}
100