11<?php
2- /**
3- * Monero payments admin list.
4- *
5- * @package Monero_Gateway
6- */
2+ /** WooCommerce admin list for Monero payments. */
73
84if ( ! defined ( 'ABSPATH ' ) ) {
95 exit ;
1511 require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php ' ;
1612}
1713
18- /**
19- * Lists orders using the Monero gateway.
20- */
14+ /** List-table implementation for Monero orders. */
2115class Monero_Gateway_Admin_Payments_List extends WP_List_Table {
2216 private const VIEWS = array (
2317 'pending ' => array ( 'watching ' , 'partial ' , 'underpaid ' , 'mempool ' , 'unconfirmed ' , 'confirming ' , 'locked ' ),
@@ -26,9 +20,7 @@ class Monero_Gateway_Admin_Payments_List extends WP_List_Table {
2620 'expired ' => array ( 'expired ' ),
2721 );
2822
29- /**
30- * Number of orders displayed per page.
31- */
23+ /** Orders displayed per page. */
3224 const PER_PAGE = 20 ;
3325
3426 public static function status_values_for_view ( $ view ) {
@@ -56,9 +48,7 @@ private function query_args_for_view( $view ) {
5648 return $ args ;
5749 }
5850
59- /**
60- * Set up the list table.
61- */
51+ /** Configure the list table. */
6252 public function __construct () {
6353 parent ::__construct (
6454 array (
@@ -69,11 +59,7 @@ public function __construct() {
6959 );
7060 }
7161
72- /**
73- * Get the table columns.
74- *
75- * @return array<string, string>
76- */
62+ /** Return table columns. */
7763 public function get_columns () {
7864 return array (
7965 'order ' => __ ( 'Order ' , 'monero_gateway ' ),
@@ -87,9 +73,7 @@ public function get_columns() {
8773 );
8874 }
8975
90- /**
91- * Prepare the current page of orders.
92- */
76+ /** Prepare the current page of orders. */
9377 public function prepare_items () {
9478 $ current_page = max ( 1 , $ this ->get_pagenum () );
9579 $ results = wc_get_orders (
@@ -129,13 +113,7 @@ public function get_views() {
129113 return $ views ;
130114 }
131115
132- /**
133- * Render a column value.
134- *
135- * @param WC_Order $order Order being displayed.
136- * @param string $column_name Column name.
137- * @return void
138- */
116+ /** Render a column value. */
139117 public function column_default ( $ order , $ column_name ) {
140118 switch ( $ column_name ) {
141119 case 'order ' :
@@ -177,11 +155,7 @@ public function column_default( $order, $column_name ) {
177155 }
178156 }
179157
180- /**
181- * Render the order and payment statuses.
182- *
183- * @param WC_Order $order Order being displayed.
184- */
158+ /** Render order and payment statuses. */
185159 private function render_status ( $ order ) {
186160 $ order_status = wc_get_order_status_name ( $ order ->get_status () );
187161 $ payment_status = $ this ->get_meta_string ( $ order , '_monero_payment_status ' );
@@ -192,11 +166,7 @@ private function render_status( $order ) {
192166 }
193167 }
194168
195- /**
196- * Render a shortened payment address.
197- *
198- * @param string $address Payment address.
199- */
169+ /** Render a shortened payment address. */
200170 private function render_address ( $ address ) {
201171 if ( '' === $ address ) {
202172 echo esc_html ( '— ' );
@@ -214,20 +184,12 @@ private function render_address( $address ) {
214184 );
215185 }
216186
217- /**
218- * Render a scalar value or a placeholder.
219- *
220- * @param string $value Value to render.
221- */
187+ /** Render a scalar value or placeholder. */
222188 private function render_value ( $ value ) {
223189 echo '' !== $ value ? esc_html ( $ value ) : esc_html ( '— ' );
224190 }
225191
226- /**
227- * Render transaction IDs stored as JSON or comma-separated text.
228- *
229- * @param mixed $stored_txids Stored transaction IDs.
230- */
192+ /** Render stored transaction IDs. */
231193 private function render_txids ( $ stored_txids ) {
232194 $ txids = $ this ->parse_txids ( $ stored_txids );
233195
@@ -244,12 +206,7 @@ private function render_txids( $stored_txids ) {
244206 }
245207 }
246208
247- /**
248- * Parse transaction IDs from order meta.
249- *
250- * @param mixed $stored_txids Stored transaction IDs.
251- * @return string[]
252- */
209+ /** Parse transaction IDs from order metadata. */
253210 private function parse_txids ( $ stored_txids ) {
254211 if ( is_array ( $ stored_txids ) ) {
255212 $ txids = $ stored_txids ;
@@ -267,35 +224,23 @@ private function parse_txids( $stored_txids ) {
267224 return array_values ( array_filter ( $ txids , 'strlen ' ) );
268225 }
269226
270- /**
271- * Get scalar order meta as a string.
272- *
273- * @param WC_Order $order Order being displayed.
274- * @param string $key Meta key.
275- * @return string
276- */
227+ /** Read scalar order metadata. */
277228 private function get_meta_string ( $ order , $ key ) {
278229 $ value = $ order ->get_meta ( $ key );
279230
280231 return is_scalar ( $ value ) ? (string ) $ value : '' ;
281232 }
282233
283- /**
284- * Message shown when no orders match.
285- */
234+ /** Render the empty-list message. */
286235 public function no_items () {
287236 esc_html_e ( 'No Monero payments found. ' , 'monero_gateway ' );
288237 }
289238}
290239
291- /**
292- * Register and render the Monero payments page.
293- */
240+ /** Register and render the Monero payments page. */
294241class Monero_Gateway_Admin_Payments {
295242
296- /**
297- * Register the WooCommerce submenu page.
298- */
243+ /** Register the WooCommerce submenu. */
299244 public static function register_menu () {
300245 add_submenu_page (
301246 'woocommerce ' ,
@@ -307,9 +252,7 @@ public static function register_menu() {
307252 );
308253 }
309254
310- /**
311- * Render the payments page.
312- */
255+ /** Render the payments page. */
313256 public static function render_page () {
314257 if ( ! current_user_can ( 'manage_woocommerce ' ) ) {
315258 return ;
0 commit comments