| Conditions | 8 |
| Paths | 8 |
| Total Lines | 60 |
| Code Lines | 36 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 72 |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 78 | public function admin_notice_tld_test() { |
||
| 79 | if ( has_filter( 'pronamic_pay_omnikassa_2_merchant_return_url' ) ) { |
||
| 80 | return; |
||
| 81 | } |
||
| 82 | |||
| 83 | $screen = get_current_screen(); |
||
|
1 ignored issue
–
show
|
|||
| 84 | |||
| 85 | if ( null === $screen ) { |
||
|
1 ignored issue
–
show
|
|||
| 86 | return; |
||
| 87 | } |
||
| 88 | |||
| 89 | if ( 'pronamic_gateway' !== $screen->id ) { |
||
| 90 | return; |
||
| 91 | } |
||
| 92 | |||
| 93 | $host = wp_parse_url( home_url( '/' ), PHP_URL_HOST ); |
||
| 94 | |||
| 95 | if ( is_array( $host ) ) { |
||
| 96 | return; |
||
| 97 | } |
||
| 98 | |||
| 99 | if ( '.test' !== substr( $host, -5 ) ) { |
||
| 100 | return; |
||
| 101 | } |
||
| 102 | |||
| 103 | $post_id = get_the_ID(); |
||
| 104 | |||
| 105 | if ( empty( $post_id ) ) { |
||
| 106 | return; |
||
| 107 | } |
||
| 108 | |||
| 109 | $gateway_id = get_post_meta( $post_id, '_pronamic_gateway_id', true ); |
||
| 110 | |||
| 111 | if ( 'rabobank-omnikassa-2' !== $gateway_id ) { |
||
| 112 | return; |
||
| 113 | } |
||
| 114 | |||
| 115 | $class = 'notice notice-error'; |
||
| 116 | $message = sprintf( |
||
| 117 | /* translators: 1: Pronamic Pay, 2: Documentation link, 3: <code>.test</code> */ |
||
| 118 | __( '%1$s — <a href="%2$s">OmniKassa 2 does not accept payments from %3$s environments</a>.', 'pronamic_ideal' ), |
||
| 119 | sprintf( |
||
| 120 | '<strong>%s</strong>', |
||
| 121 | __( 'Pronamic Pay', 'pronamic_ideal' ) |
||
| 122 | ), |
||
| 123 | 'https://github.com/wp-pay-gateways/omnikassa-2/tree/develop/documentation#merchantreturnurl-is-not-a-valid-web-address', |
||
| 124 | '<code>.test</code>' |
||
| 125 | ); |
||
| 126 | |||
| 127 | printf( |
||
| 128 | '<div class="%1$s"><p>%2$s</p></div>', |
||
| 129 | esc_attr( $class ), |
||
| 130 | wp_kses( |
||
| 131 | $message, |
||
| 132 | array( |
||
| 133 | 'a' => array( |
||
| 134 | 'href' => true, |
||
| 135 | ), |
||
| 136 | 'code' => array(), |
||
| 137 | 'strong' => array(), |
||
| 138 | ) |
||
| 176 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths