interfaces
2 years ago
repository-aborts-trait.php
2 years ago
repository-dynamic-items-it.php
2 years ago
repository-item-dynamic-id.php
2 years ago
repository-item-instance-trait.php
2 years ago
repository-item-with-class.php
2 years ago
repository-pattern-trait.php
2 years ago
repository-static-item-it.php
2 years ago
repository-aborts-trait.php
52 lines
| 1 | <?php // phpcs:ignore Internal.Exception |
| 2 | |
| 3 | namespace JFB_Components\Repository; |
| 4 | |
| 5 | use Jet_Form_Builder\Exceptions\Repository_Exception; |
| 6 | |
| 7 | // If this file is called directly, abort. |
| 8 | if ( ! defined( 'WPINC' ) ) { |
| 9 | die; |
| 10 | } |
| 11 | |
| 12 | trait Repository_Aborts_Trait { |
| 13 | |
| 14 | // phpcs:disable PSR2.Methods.MethodDeclaration.Underscore |
| 15 | |
| 16 | /** |
| 17 | * @throws Repository_Exception |
| 18 | */ |
| 19 | final public function _rep_abort_this() { |
| 20 | throw ( new Repository_Exception( 'replace this...' ) )->set_code( $this->_rep_abort_this_code() ); |
| 21 | } |
| 22 | |
| 23 | final public function _rep_abort_this_code() { |
| 24 | return 1; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * @throws Repository_Exception |
| 29 | */ |
| 30 | final public function _rep_abort_all() { |
| 31 | throw ( new Repository_Exception( 'replace this...' ) )->set_code( $this->_rep_abort_all_code() ); |
| 32 | } |
| 33 | |
| 34 | final public function _rep_abort_all_code() { |
| 35 | return 2; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * @throws Repository_Exception |
| 40 | */ |
| 41 | final public function _rep_abort_and_die() { |
| 42 | throw ( new Repository_Exception( 'replace this...' ) )->set_code( $this->_rep_abort_and_die_code() ); |
| 43 | } |
| 44 | |
| 45 | final public function _rep_abort_and_die_code() { |
| 46 | return 3; |
| 47 | } |
| 48 | |
| 49 | // phpcs:enable PSR2.Methods.MethodDeclaration.Underscore |
| 50 | |
| 51 | } |
| 52 |