ViewHelper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 20
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isView() 0 4 1
A isViewClass() 0 4 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