1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace crocodicstudio\crudbooster\commands; |
4
|
|
|
|
5
|
|
|
class RequirementChecker |
6
|
|
|
{ |
7
|
|
|
|
8
|
|
|
private $requirements = true; |
9
|
|
|
|
10
|
|
|
function check() |
11
|
|
|
{ |
12
|
|
|
$this->info('System Requirements Checking:'); |
|
|
|
|
13
|
|
|
$this->checkLaravelVersion(); |
14
|
|
|
$this->checkPHPversion(); |
15
|
|
|
$this->chechExtension('mbstring'); |
16
|
|
|
$this->chechExtension('openssl'); |
17
|
|
|
$this->chechExtension('pdo'); |
18
|
|
|
$this->chechExtension('tokenizer'); |
19
|
|
|
$this->chechExtension('xml'); |
20
|
|
|
$this->chechExtension('gd'); |
21
|
|
|
$this->chechExtension('fileinfo'); |
22
|
|
|
$this->checkWritableFolders(); |
23
|
|
|
|
24
|
|
|
return $this->requirements; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
private function checkPHPversion() |
28
|
|
|
{ |
29
|
|
|
if (version_compare(phpversion(), '5.6.0', '>=')) { |
30
|
|
|
$this->info('PHP Version (>= 5.6.*): [Good]'); |
31
|
|
|
} else { |
32
|
|
|
$this->info('PHP Version (>= 5.6.*): [Bad] Yours: '.phpversion()); |
33
|
|
|
$this->requirements = false; |
34
|
|
|
} |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
private function checkLaravelVersion() |
38
|
|
|
{ |
39
|
|
|
$laravel = app(); |
|
|
|
|
40
|
|
|
if ($laravel::VERSION >= 5.3) { |
41
|
|
|
$this->info('Laravel Version (>= 5.3.*): [Good]'); |
42
|
|
|
return true; |
43
|
|
|
} |
44
|
|
|
$this->info('Laravel Version (>= 5.3.*): [Bad]'); |
45
|
|
|
return $this->requirements = false; |
46
|
|
|
|
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
private function checkWritableFolders() |
50
|
|
|
{ |
51
|
|
|
if (is_writable(base_path('public'))) { |
|
|
|
|
52
|
|
|
$this->info('public dir is writable: [Good]'); |
53
|
|
|
return true; |
54
|
|
|
} |
55
|
|
|
$this->info('public dir is writable: [Bad]'); |
56
|
|
|
return $this->requirements = false; |
57
|
|
|
|
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param $extension |
62
|
|
|
* @return true |
63
|
|
|
*/ |
64
|
|
|
private function chechExtension($extension) |
65
|
|
|
{ |
66
|
|
|
if (! extension_loaded($extension)) { |
67
|
|
|
$this->info($extension.' extension: [Bad]'); |
68
|
|
|
return $this->requirements = false; |
|
|
|
|
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
$this->info($extension.' extension: [Good]'); |
72
|
|
|
return true; |
73
|
|
|
} |
74
|
|
|
} |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.