| @@ -1,9 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Imagify\Traits; |
| 3 | 3 | |
| 4 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); | |
| 5 | - | |
| 6 | 4 | /** |
| 7 | 5 | * Trait to use to connect medias and database. |
| 8 | 6 | * It also cache the results. |
| 9 | 7 | * Classes using that trait must define a protected property $db_class_name (string) containing the media SQL DB class name. |
| @@ -8,9 +6,8 @@ | ||
| 8 | 6 | * It also cache the results. |
| 9 | 7 | * Classes using that trait must define a protected property $db_class_name (string) containing the media SQL DB class name. |
| 10 | 8 | * |
| 11 | 9 | * @since 1.9 |
| 12 | - * @author Grégory Viguier | |
| 13 | 10 | */ |
| 14 | 11 | trait MediaRowTrait { |
| 15 | 12 | |
| 16 | 13 | /** |
| @@ -15,12 +12,10 @@ | ||
| 15 | 12 | |
| 16 | 13 | /** |
| 17 | 14 | * The media SQL data row. |
| 18 | 15 | * |
| 19 | - * @var array | |
| 20 | - * @since 1.9 | |
| 21 | - * @access protected | |
| 22 | - * @author Grégory Viguier | |
| 16 | + * @var ?array | |
| 17 | + * @since 1.9 | |
| 23 | 18 | */ |
| 24 | 19 | protected $row; |
| 25 | 20 | |
| 26 | 21 | /** |
| @@ -25,12 +20,10 @@ | ||
| 25 | 20 | |
| 26 | 21 | /** |
| 27 | 22 | * The media ID. |
| 28 | 23 | * |
| 29 | - * @var int | |
| 30 | - * @since 1.9 | |
| 31 | - * @access protected | |
| 32 | - * @author Grégory Viguier | |
| 24 | + * @var int | |
| 25 | + * @since 1.9 | |
| 33 | 26 | */ |
| 34 | 27 | protected $id; |
| 35 | 28 | |
| 36 | 29 | /** |
| @@ -35,11 +28,9 @@ | ||
| 35 | 28 | |
| 36 | 29 | /** |
| 37 | 30 | * Get the row. |
| 38 | 31 | * |
| 39 | - * @since 1.9 | |
| 40 | - * @access public | |
| 41 | - * @author Grégory Viguier | |
| 32 | + * @since 1.9 | |
| 42 | 33 | * |
| 43 | 34 | * @return array |
| 44 | 35 | */ |
| 45 | 36 | public function get_row() { |
| @@ -62,11 +53,9 @@ | ||
| 62 | 53 | |
| 63 | 54 | /** |
| 64 | 55 | * Update the row. |
| 65 | 56 | * |
| 66 | - * @since 1.9 | |
| 67 | - * @access public | |
| 68 | - * @author Grégory Viguier | |
| 57 | + * @since 1.9 | |
| 69 | 58 | * |
| 70 | 59 | * @param array $data The data to update. |
| 71 | 60 | */ |
| 72 | 61 | public function update_row( $data ) { |
| @@ -81,11 +70,9 @@ | ||
| 81 | 70 | |
| 82 | 71 | /** |
| 83 | 72 | * Delete the row. |
| 84 | 73 | * |
| 85 | - * @since 1.9 | |
| 86 | - * @access public | |
| 87 | - * @author Grégory Viguier | |
| 74 | + * @since 1.9 | |
| 88 | 75 | */ |
| 89 | 76 | public function delete_row() { |
| 90 | 77 | if ( ! $this->db_class_name || $this->id <= 0 ) { |
| 91 | 78 | return; |
| @@ -98,11 +85,9 @@ | ||
| 98 | 85 | |
| 99 | 86 | /** |
| 100 | 87 | * Shorthand to get the DB table instance. |
| 101 | 88 | * |
| 102 | - * @since 1.9 | |
| 103 | - * @access public | |
| 104 | - * @author Grégory Viguier | |
| 89 | + * @since 1.9 | |
| 105 | 90 | * |
| 106 | 91 | * @return \Imagify\DB\DBInterface The DB table instance. |
| 107 | 92 | */ |
| 108 | 93 | public function get_row_db_instance() { |
| @@ -111,11 +96,9 @@ | ||
| 111 | 96 | |
| 112 | 97 | /** |
| 113 | 98 | * Invalidate the row, by setting it to an empty array. |
| 114 | 99 | * |
| 115 | - * @since 1.9 | |
| 116 | - * @access public | |
| 117 | - * @author Grégory Viguier | |
| 100 | + * @since 1.9 | |
| 118 | 101 | * |
| 119 | 102 | * @return array The row. |
| 120 | 103 | */ |
| 121 | 104 | public function invalidate_row() { |
| @@ -125,11 +108,9 @@ | ||
| 125 | 108 | |
| 126 | 109 | /** |
| 127 | 110 | * Reset the row cache. |
| 128 | 111 | * |
| 129 | - * @since 1.9 | |
| 130 | - * @access public | |
| 131 | - * @author Grégory Viguier | |
| 112 | + * @since 1.9 | |
| 132 | 113 | * |
| 133 | 114 | * @return null The row. |
| 134 | 115 | */ |
| 135 | 116 | public function reset_row_cache() { |