-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
40 lines (30 loc) · 1.06 KB
/
bootstrap.php
File metadata and controls
40 lines (30 loc) · 1.06 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
<?php
declare(strict_types=1);
use Bakame\Stackwatch\Console\Stackwatch;
use Bakame\Stackwatch\Environment;
use Symfony\Component\Console\Output\StreamOutput;
if (is_file(__DIR__ . '/vendor/autoload.php')) {
require __DIR__ . '/vendor/autoload.php';
} elseif (is_file(__DIR__ . '/../../autoload.php')) {
require __DIR__ . '/../../autoload.php';
} else {
fwrite(STDERR, 'Cannot find the vendor directory, have you executed composer install?' . PHP_EOL);
fwrite(STDERR,'See https://getcomposer.org to get Composer.' . PHP_EOL);
exit(1);
}
if (!class_exists(StreamOutput::class)) {
fwrite(STDERR, 'The symfony/console package is required to use the command line.'.PHP_EOL);
exit(1);
}
if ('cli' !== PHP_SAPI) {
fwrite(STDERR, 'This script must be run from the command line.'.PHP_EOL);
exit(1);
}
Stackwatch::setMemoryLimit($argv);
$stderr = new StreamOutput(STDERR);
return new Stackwatch(
stdout: new StreamOutput(STDOUT),
stderr: $stderr,
logger: Stackwatch::resolveLogger($argv, $stderr),
environment: Environment::current()
);