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