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

CheckFramework::is()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 2 Features 0
Metric Value
c 2
b 2
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 1
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