Completed
Push — master ( c73d62...76a557 )
by lan tian
8s
created

CheckFramework   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 2 Features 0
Metric Value
wmc 5
c 2
b 2
f 0
lcom 0
cbo 0
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A is() 0 10 2
A isLaravel() 0 13 3
1
<?php
2
3
namespace Toplan\PhpSms;
4
5
class CheckFramework
6
{
7
    public static function is($name)
8
    {
9
        $name = ucfirst(strtolower(trim("$name")));
10
        $staticMethod = 'is' . $name;
11
        if (method_exists(new self(), $staticMethod)) {
12
            return self::$staticMethod();
13
        }
14
15
        return false;
16
    }
17
18
    public static function isLaravel()
19
    {
20
        if (function_exists('app')) {
21
            try {
22
                $laravel = app();
23
24
                return (bool) $laravel::VERSION;
25
            } catch (\Exception $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
26
            }
27
        }
28
29
        return false;
30
    }
31
}
32