Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
SearchQueryParseException
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 asStatus
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace CirrusSearch\Parser\QueryStringRegex;
4
5use MediaWiki\Status\Status;
6
7class SearchQueryParseException extends \Exception {
8    /**
9     * @var string
10     */
11    private $messageId;
12
13    /**
14     * @var array
15     */
16    private $params;
17
18    public function __construct( string $messageId, ...$params ) {
19        parent::__construct( $messageId );
20        $this->messageId = $messageId;
21        $this->params = $params;
22    }
23
24    /**
25     * Transform this exception as a Status object containing the message to display to the user
26     * @return Status
27     */
28    public function asStatus(): Status {
29        return Status::newFatal( $this->messageId, ...$this->params );
30    }
31}