-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbenchmark.php
More file actions
27 lines (22 loc) · 735 Bytes
/
Copy pathbenchmark.php
File metadata and controls
27 lines (22 loc) · 735 Bytes
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
<?php
declare(strict_types=1);
use DI\ContainerBuilder;
use Hyperized\Benchmark\Benchmark;
use Hyperized\Benchmark\Report\ReportWriter;
require __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
$builder = new ContainerBuilder();
$builder->addDefinitions([
ReportWriter::class => \DI\create(ReportWriter::class)
->constructor(__DIR__ . DIRECTORY_SEPARATOR . 'reports'),
]);
$container = $builder->build();
try {
$benchmark = $container->get(Benchmark::class);
$benchmark->execute();
} catch (\Throwable $e) {
if (\php_sapi_name() === 'cli') {
\fwrite(STDERR, $e->getMessage() . "\n");
exit(1);
}
echo '<pre>' . \htmlspecialchars($e->getMessage(), ENT_QUOTES | ENT_HTML5) . '</pre>';
}