-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathphpmnd.src
More file actions
executable file
·61 lines (49 loc) · 1.5 KB
/
Copy pathphpmnd.src
File metadata and controls
executable file
·61 lines (49 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env php
<?php
use Povils\PHPMND\Console\Application;
use Povils\PHPMND\Container;
if (\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) === false) {
echo \PHP_EOL . 'PHPMND may only be invoked from a command line, got "' . \PHP_SAPI . '"' . \PHP_EOL;
exit(1);
}
if (\version_compare('7.4.0', \PHP_VERSION, '>')) {
\fwrite(
\STDERR,
\sprintf(
'This version of PHPMND is supported on PHP 7.4.' . \PHP_EOL .
'You are using PHP %s%s.' . \PHP_EOL,
\PHP_VERSION,
\defined('PHP_BINARY') ? ' (' . \PHP_BINARY . ')' : ''
)
);
exit(1);
}
// PHPMND autoloading
(static function (): void {
if (\file_exists($autoload = __DIR__ . '/../../../autoload.php')) {
// Is installed via Composer
include_once $autoload;
return;
}
if (\file_exists($autoload = __DIR__ . '/../vendor/autoload.php')) {
// Is installed locally
include_once $autoload;
return;
}
\fwrite(
\STDERR,
<<<'ERROR'
You need to set up the project dependencies using Composer:
$ composer install
You can learn all about Composer on https://getcomposer.org/.
ERROR
);
throw new RuntimeException('Unable to find the Composer autoloader.');
})();
// Project (third-party) autoloading
(static function (): void {
if (\file_exists($autoload = \getcwd() . '/vendor/autoload.php')) {
include_once $autoload;
}
})();
(new Application(Container::create()))->run();