Passed
Push — master ( 921f98...8e8597 )
by Alain
02:39
created

NullView::canHandle()   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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
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\Findable;
15
use BrightNucleus\View\Support\NullObject;
16
17
/**
18
 * Class NullView.
19
 *
20
 * @since   0.1.0
21
 *
22
 * @package BrightNucleus\View\View
23
 * @author  Alain Schlesser <[email protected]>
24
 */
25
class NullView implements ViewInterface, NullObject, Findable
26
{
27
28
    /**
29
     * Check whether the Findable can handle an individual criterion.
30
     *
31
     * @since 0.1.0
32
     *
33
     * @param mixed $criterion Criterion to check.
34
     *
35
     * @return bool Whether the Findable can handle the criterion.
36
     */
37
    public function canHandle($criterion)
38
    {
39
        return true;
40
    }
41
42
    /**
43
     * Render the view.
44
     *
45
     * @since 0.1.0
46
     *
47
     * @param array $context Optional. The context in which to render the view.
48
     * @param bool  $echo    Optional. Whether to echo the output immediately. Defaults to false.
49
     *
50
     * @return string|void Rendered HTML or nothing, depending on $echo argument.
51
     */
52 1
    public function render(array $context = [], $echo = false)
53
    {
54 1
        if (! $echo) {
55 1
            return '';
56
        }
57
    }
58
}
59