ViewHelper::isView()   A
last analyzed

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 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/spark/blob/master/LICENSE
6
 * @link       https://github.com/flipbox/spark
7
 */
8
9
namespace flipbox\spark\helpers;
10
11
use flipbox\spark\views\ViewInterface;
12
13
/**
14
 * @author Flipbox Factory <[email protected]>
15
 * @since 1.0.0
16
 */
17
class ViewHelper
18
{
19
    /**
20
     * @param $view
21
     * @return bool
22
     */
23
    public static function isView($view)
24
    {
25
        return $view instanceof ViewInterface;
26
    }
27
28
    /**
29
     * @param $view
30
     * @return bool
31
     */
32
    public static function isViewClass($view)
33
    {
34
        return is_string($view) && is_subclass_of($view, ViewInterface::class);
0 ignored issues
show
Bug introduced by
Due to PHP Bug #53727, is_subclass_of might return inconsistent results on some PHP versions if \flipbox\spark\views\ViewInterface::class can be an interface. If so, you could instead use ReflectionClass::implementsInterface.
Loading history...
35
    }
36
}
37