Cookiebot_CLI_Command.php
1 month ago
Output_Adapter.php
1 month ago
WP_CLI_Output_Adapter.php
1 month ago
Output_Adapter.php
38 lines
| 1 | <?php |
| 2 | |
| 3 | namespace cybot\cookiebot\cli; |
| 4 | |
| 5 | /** |
| 6 | * Abstraction over WP_CLI output so the CLI command class is unit-testable. |
| 7 | * |
| 8 | * @since 4.8.0 |
| 9 | */ |
| 10 | interface Output_Adapter { |
| 11 | |
| 12 | /** |
| 13 | * Print a success message and return (or exit, depending on adapter). |
| 14 | * |
| 15 | * @param string $message |
| 16 | * @return void |
| 17 | */ |
| 18 | public function success( $message ); |
| 19 | |
| 20 | /** |
| 21 | * Print an error message. Production adapter exits non-zero. |
| 22 | * |
| 23 | * @param string $message |
| 24 | * @return void |
| 25 | */ |
| 26 | public function error( $message ); |
| 27 | |
| 28 | /** |
| 29 | * Print structured data in the requested format ('json', 'yaml', 'table', 'csv'). |
| 30 | * |
| 31 | * @param array $items List of associative arrays. |
| 32 | * @param array $fields Column ordering for table format. |
| 33 | * @param string $format One of: table, json, yaml, csv. |
| 34 | * @return void |
| 35 | */ |
| 36 | public function format_items( $items, $fields, $format ); |
| 37 | } |
| 38 |