在php中使用Dynamic classname

I have a file which contains a class. This class extends another class (class1).

I need to extend the class1 multiple times. Here the first lines which create the class.

function your_shipping_method_init() {
        if ( ! class_exists( 'WC_Your_Shipping_Method' ) ) {
            class WC_Your_Shipping_Method extends WC_Shipping_Method {

I have an array which different shipping methods. Thats why I need to load this file a few times.

I tried this:

function your_shipping_method_init() {
            if ( ! class_exists( $classname ) ) {
                class $classname extends WC_Shipping_Method {

Is there a way, to give a class a dynamic name?

Here you can find the whole code:

I can think of only using eval() function:

eval('class $classname extends WC_Shipping_Method { ... }');