| 1 |
<?php |
| 2 |
/** |
| 3 |
* Repository: Interface |
| 4 |
* |
| 5 |
* @package SimplePay |
| 6 |
* @subpackage Core |
| 7 |
* @copyright Copyright (c) 2022, Sandhills Development, LLC |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 4.4.5 |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace SimplePay\Core\Repository; |
| 13 |
|
| 14 |
use SimplePay\Vendor\BerlinDB\Database\Base as BerlinDbQuery; |
| 15 |
|
| 16 |
/** |
| 17 |
* RepositoryInterface interface. |
| 18 |
* |
| 19 |
* @since 4.4.5 |
| 20 |
*/ |
| 21 |
interface RepositoryInterface { |
| 22 |
|
| 23 |
/** |
| 24 |
* Retrieves a single item. |
| 25 |
* |
| 26 |
* @since 4.4.5 |
| 27 |
* |
| 28 |
* @param int $id Item ID. |
| 29 |
* @return null|\SimplePay\Core\Model\ModelInterface |
| 30 |
*/ |
| 31 |
public function get( $id ); |
| 32 |
|
| 33 |
/** |
| 34 |
* Retrieves a single item by a column. |
| 35 |
* |
| 36 |
* @since 4.4.5 |
| 37 |
* |
| 38 |
* @param string $column_name Colum name. |
| 39 |
* @param int|string $column_value Column value. |
| 40 |
* @return null|\SimplePay\Core\Model\ModelInterface |
| 41 |
*/ |
| 42 |
public function get_by( $column_name, $column_value ); |
| 43 |
|
| 44 |
/** |
| 45 |
* Adds a single item. |
| 46 |
* |
| 47 |
* @since 4.4.5 |
| 48 |
* |
| 49 |
* @param array<mixed> $data Item data. |
| 50 |
* @return null|\SimplePay\Core\Model\ModelInterface |
| 51 |
*/ |
| 52 |
public function add( $data ); |
| 53 |
|
| 54 |
/** |
| 55 |
* Updates a single item. |
| 56 |
* |
| 57 |
* @since 4.4.5 |
| 58 |
* |
| 59 |
* @param int $id Item ID. |
| 60 |
* @param array<mixed> $data Item data. |
| 61 |
* @return null|\SimplePay\Core\Model\ModelInterface |
| 62 |
*/ |
| 63 |
public function update( $id, $data ); |
| 64 |
|
| 65 |
/** |
| 66 |
* Deletes a single item. |
| 67 |
* |
| 68 |
* @since 4.4.5 |
| 69 |
* |
| 70 |
* @param int $id Item ID. |
| 71 |
* @return null|\SimplePay\Core\Model\ModelInterface |
| 72 |
*/ |
| 73 |
public function delete( $id ); |
| 74 |
|
| 75 |
/** |
| 76 |
* Queries for items given a set of criteria. |
| 77 |
* |
| 78 |
* @since 4.4.5 |
| 79 |
* |
| 80 |
* @param array<mixed> $args Query arguments. |
| 81 |
* @return array<\SimplePay\Core\Model\ModelInterface> List of models queried. |
| 82 |
*/ |
| 83 |
public function query( $args = array() ); |
| 84 |
|
| 85 |
/** |
| 86 |
* Counts items given a set of criteria. |
| 87 |
* |
| 88 |
* @since 4.4.5 |
| 89 |
* |
| 90 |
* @param array<mixed> $args Query arguments. |
| 91 |
* @return int The number of results. |
| 92 |
*/ |
| 93 |
public function count( $args = array() ); |
| 94 |
|
| 95 |
} |
| 96 |
|