| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Content; |
| 4 | |
| 5 | use MWUnknownContentModelException; |
| 6 | |
| 7 | interface IContentHandlerFactory { |
| 8 | |
| 9 | /** |
| 10 | * Returns a ContentHandler instance for the given $modelID. |
| 11 | * |
| 12 | * @param string $modelID |
| 13 | * |
| 14 | * @return ContentHandler |
| 15 | * @throws MWUnknownContentModelException If no handler is known for the model ID. |
| 16 | */ |
| 17 | public function getContentHandler( string $modelID ): ContentHandler; |
| 18 | |
| 19 | /** |
| 20 | * Returns a list of defined content models. |
| 21 | * getContentHandler() can be expected to return a ContentHandler for the models returned |
| 22 | * by this method. |
| 23 | * |
| 24 | * @return string[] |
| 25 | */ |
| 26 | public function getContentModels(): array; |
| 27 | |
| 28 | /** |
| 29 | * Returns a list of all serialization formats supported for any of the defined content models. |
| 30 | * @see ContentHandler::getSupportedFormats() |
| 31 | * @return string[] |
| 32 | */ |
| 33 | public function getAllContentFormats(): array; |
| 34 | |
| 35 | /** |
| 36 | * Returns true if $modelID is a defined content model for which getContentHandler() can be |
| 37 | * expected to return a ContentHandler instance. |
| 38 | * @param string $modelID |
| 39 | * |
| 40 | * @return bool |
| 41 | */ |
| 42 | public function isDefinedModel( string $modelID ): bool; |
| 43 | } |