MediaWiki
master
PHPErrorReporter.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Rest\Reporter
;
4
5
use
MediaWiki\Rest\Handler
;
6
use
MediaWiki\Rest\RequestInterface
;
7
use Throwable;
8
13
class
PHPErrorReporter
implements
ErrorReporter
{
14
16
private
$level;
17
21
public
function
__construct
( $level = E_USER_WARNING ) {
22
$this->level = $level;
23
}
24
30
public
function
reportError
( Throwable $error, ?
Handler
$handler,
RequestInterface
$request ) {
31
$firstLine = preg_split(
'#$#m'
, (
string
)$error, 0 )[0];
32
trigger_error( $firstLine, $this->level );
33
}
34
35
}
MediaWiki\Rest\Handler
Base class for REST route handlers.
Definition
Handler.php:25
MediaWiki\Rest\Reporter\PHPErrorReporter
Error reporter based on php's native trigger_error() method.
Definition
PHPErrorReporter.php:13
MediaWiki\Rest\Reporter\PHPErrorReporter\__construct
__construct( $level=E_USER_WARNING)
Definition
PHPErrorReporter.php:21
MediaWiki\Rest\Reporter\PHPErrorReporter\reportError
reportError(Throwable $error, ?Handler $handler, RequestInterface $request)
Definition
PHPErrorReporter.php:30
MediaWiki\Rest\Reporter\ErrorReporter
An ErrorReporter internally reports an error that happened during the handling of a request.
Definition
ErrorReporter.php:15
MediaWiki\Rest\RequestInterface
A request interface similar to PSR-7's ServerRequestInterface.
Definition
RequestInterface.php:39
MediaWiki\Rest\Handler
Copyright (C) 2011-2020 Wikimedia Foundation and others.
Definition
ActionModuleBasedHandler.php:3
MediaWiki\Rest\Reporter
Definition
ErrorReporter.php:3
includes
Rest
Reporter
PHPErrorReporter.php
Generated on Sat Dec 14 2024 01:25:49 for MediaWiki by
1.10.0