| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace JFB_Components\Repository\Interfaces; |
| 5 |
|
| 6 |
use Jet_Form_Builder\Exceptions\Repository_Exception; |
| 7 |
use JFB_Components\Repository\Repository_Item_Dynamic_Id; |
| 8 |
use JFB_Components\Repository\Repository_Item_Instance_Trait; |
| 9 |
use JFB_Components\Repository\Repository_Static_Item_It; |
| 10 |
|
| 11 |
interface Repository_Pattern_Interface { |
| 12 |
|
| 13 |
public function rep_instances(): array; |
| 14 |
|
| 15 |
public function rep_save_fails(): bool; |
| 16 |
|
| 17 |
public function rep_install( $instances = array() ); |
| 18 |
|
| 19 |
public function rep_allow_rewrite(); |
| 20 |
|
| 21 |
public function rep_install_item_soft( $item_trait ); |
| 22 |
|
| 23 |
/** |
| 24 |
* @param $item_trait |
| 25 |
* @param $item_key |
| 26 |
*/ |
| 27 |
public function rep_run_install_flow( string $item_key, $item_trait ); |
| 28 |
|
| 29 |
/** |
| 30 |
* @param $item_trait |
| 31 |
* |
| 32 |
* @return $this |
| 33 |
* @throws Repository_Exception |
| 34 |
*/ |
| 35 |
public function rep_install_item( $item_trait ); |
| 36 |
|
| 37 |
public function rep_before_install_item( $item ); |
| 38 |
|
| 39 |
public function rep_after_install( $item ); |
| 40 |
|
| 41 |
public function rep_after_install_item( $item ); |
| 42 |
|
| 43 |
public function rep_get_items(): array; |
| 44 |
|
| 45 |
/** |
| 46 |
* @return \Generator |
| 47 |
* @since 3.1.0 |
| 48 |
*/ |
| 49 |
public function rep_generate_items(): \Generator; |
| 50 |
|
| 51 |
public function rep_get_values(): array; |
| 52 |
|
| 53 |
public function rep_get_keys(): array; |
| 54 |
|
| 55 |
|
| 56 |
/** |
| 57 |
* @param $class_or_slug |
| 58 |
* |
| 59 |
* @return mixed |
| 60 |
* @throws Repository_Exception |
| 61 |
*/ |
| 62 |
public function rep_get_item( $class_or_slug ); |
| 63 |
|
| 64 |
public function rep_get_item_or_die( $slug ); |
| 65 |
|
| 66 |
/** |
| 67 |
* @param $slug |
| 68 |
* |
| 69 |
* @return mixed |
| 70 |
* @throws Repository_Exception |
| 71 |
*/ |
| 72 |
public function rep_clone_item( $slug ); |
| 73 |
|
| 74 |
public function rep_clone_item_or_die( $slug ); |
| 75 |
|
| 76 |
/** |
| 77 |
* @param $item |
| 78 |
* |
| 79 |
* @param string $slug |
| 80 |
* |
| 81 |
* @throws Repository_Exception |
| 82 |
*/ |
| 83 |
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed |
| 84 |
public function rep_item_check( $item, $slug = '' ); |
| 85 |
|
| 86 |
public function rep_isset_item( $slug ); |
| 87 |
|
| 88 |
/** |
| 89 |
* @param $slug |
| 90 |
* |
| 91 |
* @return void |
| 92 |
* @throws Repository_Exception |
| 93 |
*/ |
| 94 |
public function rep_throw_if_undefined( $slug ); |
| 95 |
|
| 96 |
public function rep_die_if_undefined( $slug ); |
| 97 |
|
| 98 |
/** |
| 99 |
* @param $item_trait |
| 100 |
* |
| 101 |
* @throws Repository_Exception |
| 102 |
*/ |
| 103 |
public function rep_throw_if_cant_rewrite( $item_trait ); |
| 104 |
|
| 105 |
// phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
| 106 |
public function _rep_save_fail( Repository_Exception $exception ); |
| 107 |
|
| 108 |
/** |
| 109 |
* @return array |
| 110 |
*/ |
| 111 |
// phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
| 112 |
public function _rep_get_fails(): array; |
| 113 |
|
| 114 |
/** |
| 115 |
* @since 3.1.0 |
| 116 |
* |
| 117 |
* @param string|Repository_Item_Instance_Trait|Repository_Item_Dynamic_Id|Repository_Static_Item_It $item_trait |
| 118 |
*/ |
| 119 |
public function rep_remove( $item_trait ); |
| 120 |
|
| 121 |
public function rep_clear(); |
| 122 |
} |
| 123 |
|