| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Settings\Source; |
| 4 | |
| 5 | use MediaWiki\Settings\SettingsBuilderException; |
| 6 | |
| 7 | /** |
| 8 | * Implementations of SettingsSource may additionally implement SettingsIncludeLocator |
| 9 | * as well, to provide support for relative include locations. For instance, a |
| 10 | * SettingsSource that loads a file may provide support for includes to be |
| 11 | * specified relative to the location of that file. |
| 12 | * |
| 13 | * @since 1.38 |
| 14 | * @stable to implement |
| 15 | */ |
| 16 | interface SettingsIncludeLocator { |
| 17 | |
| 18 | /** |
| 19 | * This method defines how a relative reference to the location of |
| 20 | * another settings source is interpreted. |
| 21 | * |
| 22 | * It tries to make $location absolute by interpreting it as |
| 23 | * relative to the location of the SettingsSource it originates from. |
| 24 | * |
| 25 | * Implementation are "best effort". If a location cannot be made |
| 26 | * absolute, it may be returned as-is. Implementations are also free |
| 27 | * to throw a SettingsBuilderException to indicate that the given |
| 28 | * include location is not supported in this context. |
| 29 | * |
| 30 | * @param string $location |
| 31 | * |
| 32 | * @return string |
| 33 | * @throws SettingsBuilderException if the given location cannot be used |
| 34 | * as an include by the current source. |
| 35 | */ |
| 36 | public function locateInclude( string $location ): string; |
| 37 | } |