| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 50 | public function once( $action, $hook, $priority = 10, $accepted_args = 1 ) { |
||
| 51 | $key = md5( serialize( func_get_args() ) ); |
||
| 52 | |||
| 53 | if ( in_array( $key, self::$hooks_completed ) ) { |
||
| 54 | return; |
||
| 55 | } |
||
| 56 | |||
| 57 | self::$hooks_completed[] = $key; |
||
| 58 | add_filter( $action, $hook, $priority, $accepted_args ); |
||
| 59 | } |
||
| 60 | |||
| 62 |
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.