| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 5 |
| Lines | 13 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 78 | View Code Duplication | private static function instantiate( $classname ) { |
|
| 79 | |||
| 80 | if ( ! class_exists( $classname ) ) |
||
| 81 | return new \WP_Error( 'hmbkp_invalid_type_error', sprintf( __( 'Argument 1 for %s must be a valid class', 'backupwordpress' ) ), __METHOD__ ); |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @var HMBKP_Service |
||
| 85 | */ |
||
| 86 | $class = new $classname( self::instance()->schedule ); |
||
| 87 | |||
| 88 | return $class; |
||
| 89 | |||
| 90 | } |
||
| 91 | |||
| 93 |
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.