Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
PathConflict
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Rest\PathTemplateMatcher;
4
5use Exception;
6
7/**
8 * @newable
9 */
10class PathConflict extends Exception {
11    /** @var string */
12    public $newTemplate;
13    /** @var mixed */
14    public $newUserData;
15    /** @var string */
16    public $existingTemplate;
17    /** @var mixed */
18    public $existingUserData;
19
20    /**
21     * @stable to call
22     *
23     * @param string $template
24     * @param mixed $userData
25     * @param array $existingNode
26     */
27    public function __construct( $template, $userData, $existingNode ) {
28        $this->newTemplate = $template;
29        $this->newUserData = $userData;
30        $this->existingTemplate = $existingNode['template'];
31        $this->existingUserData = $existingNode['userData'];
32        parent::__construct( "Unable to add path template \"$template\" since it conflicts " .
33            "with the existing template \"{$this->existingTemplate}\"" );
34    }
35}