Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
ParsingFailure
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getMessageSpecification
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\PageTranslation;
5
6use RuntimeException;
7
8/**
9 * Represents any kind of failure to parse a translatable page source code.
10 *
11 * This is an internal exception that includes information to produce translated error messages, but
12 * actually displaying them to users is handled by MediaWiki core.
13 *
14 * @author Niklas Laxström
15 * @license GPL-2.0-or-later
16 * @since 2020.08
17 */
18class ParsingFailure extends RuntimeException {
19    /**
20     * @var array
21     * @phan-var non-empty-array
22     */
23    private $messageSpec;
24
25    /**
26     * @param string $message
27     * @param array $messageSpec
28     * @phan-param non-empty-array $messageSpec
29     */
30    public function __construct( string $message, array $messageSpec ) {
31        parent::__construct( $message );
32        $this->messageSpec = $messageSpec;
33    }
34
35    /**
36     * @return array
37     * @phan-return non-empty-array
38     */
39    public function getMessageSpecification(): array {
40        return $this->messageSpec;
41    }
42}