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
5class SearchQueryParseException extends \Exception {
6    /**
7     * @var string
8     */
9    private $messageId;
10
11    /**
12     * @var array
13     */
14    private $params;
15
16    public function __construct( string $messageId, ...$params ) {
17        parent::__construct( $messageId );
18        $this->messageId = $messageId;
19        $this->params = $params;
20    }
21
22    /**
23     * Transform this exception as a Status object containing the message to display to the user
24     * @return \Status
25     */
26    public function asStatus(): \Status {
27        return \Status::newFatal( $this->messageId, ...$this->params );
28    }
29}