| 1 |
<?php |
| 2 |
declare( strict_types = 1 ); |
| 3 |
|
| 4 |
namespace Wikimedia\Parsoid\Config; |
| 5 |
|
| 6 |
use InvalidArgumentException; |
| 7 |
|
| 8 |
/** |
| 9 |
* Page content data object |
| 10 |
*/ |
| 11 |
abstract class PageContent { |
| 12 |
|
| 13 |
/** |
| 14 |
* Return the roles available in this page |
| 15 |
* @return string[] |
| 16 |
*/ |
| 17 |
abstract public function getRoles(): array; |
| 18 |
|
| 19 |
/** |
| 20 |
* Determine whether the page contains a role |
| 21 |
* @param string $role |
| 22 |
* @return bool |
| 23 |
*/ |
| 24 |
abstract public function hasRole( string $role ): bool; |
| 25 |
|
| 26 |
/** |
| 27 |
* Fetch the content model for a role |
| 28 |
* @param string $role |
| 29 |
* @return string |
| 30 |
* @throws InvalidArgumentException if the role doesn't exist |
| 31 |
*/ |
| 32 |
abstract public function getModel( string $role ): string; |
| 33 |
|
| 34 |
/** |
| 35 |
* Fetch the content format for a role |
| 36 |
* @param string $role |
| 37 |
* @return string |
| 38 |
* @throws InvalidArgumentException if the role doesn't exist |
| 39 |
*/ |
| 40 |
abstract public function getFormat( string $role ): string; |
| 41 |
|
| 42 |
/** |
| 43 |
* Fetch the content for a role |
| 44 |
* @param string $role |
| 45 |
* @return string |
| 46 |
* @throws InvalidArgumentException if the role doesn't exist |
| 47 |
*/ |
| 48 |
abstract public function getContent( string $role ): string; |
| 49 |
|
| 50 |
} |