| Conditions | 2 |
| Paths | 2 |
| Total Lines | 27 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 51 | 24 | public function get_customers() { |
|
| 52 | 24 | global $wpdb; |
|
| 53 | |||
| 54 | 24 | $where = '1 = 1'; |
|
| 55 | |||
| 56 | 24 | if ( array_key_exists( 'user_id', $this->args ) ) { |
|
| 57 | 24 | $where .= $wpdb->prepare( ' AND mollie_customer_user.user_id = %d', $this->args['user_id'] ); |
|
| 58 | } |
||
| 59 | |||
| 60 | $query = " |
||
| 61 | SELECT |
||
| 62 | mollie_customer.mollie_id, |
||
| 63 | mollie_customer.test_mode, |
||
| 64 | mollie_customer.name, |
||
| 65 | mollie_customer.email |
||
| 66 | FROM |
||
| 67 | 24 | $wpdb->pronamic_pay_mollie_customer_users AS mollie_customer_user |
|
| 68 | INNER JOIN |
||
| 69 | 24 | $wpdb->pronamic_pay_mollie_customers AS mollie_customer |
|
| 70 | ON mollie_customer_user.customer_id = mollie_customer.id |
||
| 71 | WHERE |
||
| 72 | 24 | $where |
|
| 73 | ; |
||
| 74 | "; |
||
| 75 | |||
| 76 | // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Query is prepared. |
||
| 77 | 24 | return $wpdb->get_results( $query ); |
|
| 78 | } |
||
| 80 |