/** * A basic usage of error_log * See http://php.net/manual/en/function.error-log.php to configure it; **/ public function __construct($level = DEBUG, int $message_type = 0, string $destination = null, string $extra_headers = null) { $this->setBaseLevel($level); Memory::events()->on(LOG, function (string $level, string $message) use($message_type, $destination, $extra_headers) { if ($this->isLoggable($level)) { error_log($message, $message_type, $destination, $extra_headers); } }); }
public function __construct($scope) { $this->scope = $scope; Memory::events()->on(ON, function () { $this->isLocked = false; }); Memory::events()->on(STOP, function () { $this->eventAction = false; $this->isLocked = true; }); }
public function redirect($location, array $args = []) { if (false === stripos($location, '/')) { $url = new UrlHelper(); $url->setArguments(array_merge(['url' => $location], $args)); $location = $url->render(); } Memory::get(HTTP)->set(HEADER, ['Location' => $location]); Memory::get(HTTP)->set(CODE, 302); Memory::events()->emit(END, ['content' => '']); Memory::events()->emit(STOP); }
public function log(string $level, string $message, array $context = []) { $time = date('d/m/Y ~ G\\:i '); Memory::events()->emit(LOG, ['level' => $level, 'message' => $time . '[' . $level . '] ' . $message, 'context' => $context]); }
public function __construct() { Memory::events()->on('stop::rendering', function () { $this->outlets = []; }); }