| Conditions | 4 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 14 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | View Code Duplication | public function get_account( $use_transient = true ) { |
|
| 18 | $transient_key = 'yikes_eme_account'; |
||
| 19 | $transient = get_transient( $transient_key ); |
||
| 20 | if ( false !== $transient && $use_transient ) { |
||
| 21 | return $transient; |
||
| 22 | } |
||
| 23 | |||
| 24 | $response = $this->maybe_return_error( $this->get_from_api() ); |
||
| 25 | if ( ! is_wp_error( $response ) ) { |
||
| 26 | set_transient( $transient_key, $response, HOUR_IN_SECONDS ); |
||
| 27 | } |
||
| 28 | |||
| 29 | return $response; |
||
| 30 | } |
||
| 31 | } |
||
| 32 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.