private function sortPayloadFields()
    {
        if (isset($this->payload->operations)) {
            foreach ($this->payload->operations as $id => $operation) {
                foreach (['request', 'response'] as $opType) {
                    if (isset($operation->{$opType})) {
                        foreach (['headers', 'body'] as $fieldType) {
                            if (is_array($operation->{$opType}->{$fieldType})) {
                                usort(
                                    $operation->{$opType}->{$fieldType},
                                    function ($a, $b) {
                                        return strnatcmp(
                                            isset($a->key) ? $a->key : null,
                                            isset($b->key) ? $b->key : null
                                        );
                                    }
                                );
                            }
                        }
                    }
                }
            }
        }
    }
private function sortPayloadFields()
    {
        if (isset($this->payload->operations)) {
            foreach ($this->payload->operations as $id => $operation) {
                foreach (['request', 'response'] as $opType) {
                    if (isset($operation->{$opType})) {
                        foreach (['headers', 'body'] as $fieldType) {
                            if (is_array($operation->{$opType}->{$fieldType})) {
                                usort(
                                    $operation->{$opType}->{$fieldType},
                                    function ($a, $b) {
                                        return strnatcmp(
                                            isset($a->key) ? $a->key : null,
                                            isset($b->key) ? $b->key : null
                                        );
                                    }
                                );
                            }
                        }
                    }
                }
            }
        }
    }
private function sortPayloadFields ( ) { if ( isset ( $ this -> payload -> operations ) ) { foreach ( $ this -> payload -> operations as $ id => $ operation ) { foreach ( [ 'request' , 'response' ] as $ opType ) { if ( isset ( $ operation -> { $ opType } ) ) { foreach ( [ 'headers' , 'body' ] as $ fieldType ) { if ( is_array ( $ operation -> { $ opType } -> { $ fieldType } ) ) { usort ( $ operation -> { $ opType } -> { $ fieldType } , function ( $ a , $ b ) { return strnatcmp ( isset ( $ a -> key ) ? $ a -> key : null , isset ( $ b -> key ) ? $ b -> key : null ) ; } ) ; } } } } } } }
Sort the fields by keys, so that the user doesn't have to.
Only applies when AutoUpdate is enabled.
Sort the fields by keys so that the user doesn t have to . Only applies when AutoUpdate is enabled .