/
razxc
/
telescope.php
Обзор
Документация
Войти
/
razxc
/
telescope.php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/reaction.php
61 строка
1 KB
Alexandr Haritonov
Initial commit. Telescope 6.0.0
29 мар 2026, 11:23
29 мар 2026, 11:23
02aa6e9
Код
Авторство
О чём код?
<?php require_once __DIR__ . '/../src/Telescope.php'; use razxc\telescope\Telescope as T; T::init(__DIR__ . '/../.telescope.ini', T::MODE_TRACING + T::MODE_DISPLAY + T::MODE_LOG); T::onShutdown(function() { $reportFile = __DIR__ . '/../.telescope-report.html'; T::log(T::buildDetailReport(), $reportFile, 'w+', false); }); const REACTION_EXCEPTION = 'exception'; const REACTION_ERROR = 'error'; const REACTION_FATAL = 'fatal'; const REACTION_MEMORY = 'memory'; if (!empty($_SERVER['argv'])) { // CLI $argv = $_SERVER['argv']; array_shift($argv); $r = current($argv); } else { // HTTP $r = key(@$_GET); } myapp($r); function myapp($reaction) { $r = strtolower($reaction); switch($reaction) { case REACTION_ERROR: $a = $b; break; case REACTION_EXCEPTION: throw new Exception('Exception test'); break; case REACTION_MEMORY: ini_set('memory_limit', '4M'); $a[] = range(1, 200000); break; case REACTION_FATAL: fatalError(); break; default: echo 'No errors. USE KEYS: ' . REACTION_ERROR.', ' . REACTION_EXCEPTION.', ' . REACTION_FATAL.', ' . REACTION_MEMORY; echo PHP_EOL; } }