| 1 |
<?php |
| 2 |
namespace Imagify\WriteFile; |
| 3 |
|
| 4 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
| 5 |
|
| 6 |
/** |
| 7 |
* Interface to add and remove contents to a file. |
| 8 |
* |
| 9 |
* @since 1.9 |
| 10 |
* @author Grégory Viguier |
| 11 |
*/ |
| 12 |
interface WriteFileInterface { |
| 13 |
|
| 14 |
/** |
| 15 |
* Add new contents to the file. |
| 16 |
* |
| 17 |
* @since 1.9 |
| 18 |
* @access public |
| 19 |
* @author Grégory Viguier |
| 20 |
* |
| 21 |
* @return bool|\WP_Error True on success. A \WP_Error object on error. |
| 22 |
*/ |
| 23 |
public function add(); |
| 24 |
|
| 25 |
/** |
| 26 |
* Remove the related contents from the file. |
| 27 |
* |
| 28 |
* @since 1.9 |
| 29 |
* @access public |
| 30 |
* @author Grégory Viguier |
| 31 |
* |
| 32 |
* @return bool|\WP_Error True on success. A \WP_Error object on error. |
| 33 |
*/ |
| 34 |
public function remove(); |
| 35 |
|
| 36 |
/** |
| 37 |
* Get the path to the file. |
| 38 |
* |
| 39 |
* @since 1.9 |
| 40 |
* @access public |
| 41 |
* @author Grégory Viguier |
| 42 |
* |
| 43 |
* @return string |
| 44 |
*/ |
| 45 |
public function get_file_path(); |
| 46 |
|
| 47 |
/** |
| 48 |
* Tell if the file is writable. |
| 49 |
* |
| 50 |
* @since 1.9 |
| 51 |
* @access public |
| 52 |
* @author Grégory Viguier |
| 53 |
* |
| 54 |
* @return bool|\WP_Error True if writable. A \WP_Error object if not. |
| 55 |
*/ |
| 56 |
public function is_file_writable(); |
| 57 |
|
| 58 |
/** |
| 59 |
* Get new contents to write into the file. |
| 60 |
* |
| 61 |
* @since 1.9 |
| 62 |
* @access public |
| 63 |
* @author Grégory Viguier |
| 64 |
* |
| 65 |
* @return string |
| 66 |
*/ |
| 67 |
public function get_new_contents(); |
| 68 |
} |
| 69 |
|