Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Flow\Block; |
| 4 | |
| 5 | use Flow\Model\UUID; |
| 6 | use MediaWiki\Context\IContextSource; |
| 7 | |
| 8 | interface Block { |
| 9 | /** |
| 10 | * @param IContextSource $context |
| 11 | * @param string $action |
| 12 | */ |
| 13 | public function init( IContextSource $context, $action ); |
| 14 | |
| 15 | /** |
| 16 | * Perform validation of data model |
| 17 | * |
| 18 | * @param array $data |
| 19 | * @return bool True if data model is valid |
| 20 | */ |
| 21 | public function onSubmit( array $data ); |
| 22 | |
| 23 | /** |
| 24 | * Write updates to storage |
| 25 | */ |
| 26 | public function commit(); |
| 27 | |
| 28 | /** |
| 29 | * Render the API output of this Block. |
| 30 | * Templating is provided for convenience |
| 31 | * |
| 32 | * @param array $options |
| 33 | * @return array |
| 34 | */ |
| 35 | public function renderApi( array $options ); |
| 36 | |
| 37 | /** |
| 38 | * @return string Unique name among all blocks on an object |
| 39 | */ |
| 40 | public function getName(); |
| 41 | |
| 42 | /** |
| 43 | * @return UUID |
| 44 | */ |
| 45 | public function getWorkflowId(); |
| 46 | |
| 47 | /** |
| 48 | * Returns an array of all error types encountered in this block. The values |
| 49 | * in the returned array can be used to pass to getErrorMessage() or |
| 50 | * getErrorExtra() to respectively fetch the specific error message or |
| 51 | * additional details. |
| 52 | * |
| 53 | * @return array |
| 54 | */ |
| 55 | public function getErrors(); |
| 56 | |
| 57 | /** |
| 58 | * Checks if any errors have occurred in the block (no argument), or if a |
| 59 | * specific error has occurred (argument being the error type) |
| 60 | * |
| 61 | * @param string|null $type |
| 62 | * @return bool |
| 63 | */ |
| 64 | public function hasErrors( $type = null ); |
| 65 | |
| 66 | /** |
| 67 | * Returns true if the block can render the requested action, or false |
| 68 | * otherwise. |
| 69 | * |
| 70 | * @param string $action |
| 71 | * @return bool |
| 72 | */ |
| 73 | public function canRender( $action ); |
| 74 | } |