src/WPametu/API/Rewrite.php
public function rewrite_rules_array( array $rules ){
	    if( !empty($this->classes) ){
            // Normal rewrite rules
            $new_rewrite = [];
            $error_message = [];
            foreach( $this->classes as $class_name ){
                $prefix = $this->get_prefix($class_name);
                /** @var RestBase $class_name */
                if( empty($prefix) ){
                    $error_message[] = sprintf($this->__('<code>%s</code> should have prefix property.'), $class_name);
                    continue;
                }
                // API Rewrite rules
                $new_rewrite[trim($prefix, '/').'(/.*)?$'] = "index.php?{$this->api_class}={$class_name}&{$this->api_vars}=\$matches[1]";
            }
            if( !empty($new_rewrite) ){
                $rules = array_merge($new_rewrite, $rules);
            }
            if( !empty($error_message) ){
                add_action('admin_notices', function() use ($error_message) {
                    printf('<div class="error"><p>%s</p></div>', implode('<br />', $error_message));
                });
            }
        }
        return $rules;
    }
public function rewrite_rules_array( array $rules ){
	    if( !empty($this->classes) ){
            // Normal rewrite rules
            $new_rewrite = [];
            $error_message = [];
            foreach( $this->classes as $class_name ){
                $prefix = $this->get_prefix($class_name);
                /** @var RestBase $class_name */
                if( empty($prefix) ){
                    $error_message[] = sprintf($this->__('<code>%s</code> should have prefix property.'), $class_name);
                    continue;
                }
                // API Rewrite rules
                $new_rewrite[trim($prefix, '/').'(/.*)?$'] = "index.php?{$this->api_class}={$class_name}&{$this->api_vars}=\$matches[1]";
            }
            if( !empty($new_rewrite) ){
                $rules = array_merge($new_rewrite, $rules);
            }
            if( !empty($error_message) ){
                add_action('admin_notices', function() use ($error_message) {
                    printf('<div class="error"><p>%s</p></div>', implode('<br />', $error_message));
                });
            }
        }
        return $rules;
    }
public function rewrite_rules_array ( array $ rules ) { if ( ! empty ( $ this -> classes ) ) { // Normal rewrite rules $ new_rewrite = [ ] ; $ error_message = [ ] ; foreach ( $ this -> classes as $ class_name ) { $ prefix = $ this -> get_prefix ( $ class_name ) ; /** @var RestBase $class_name */ if ( empty ( $ prefix ) ) { $ error_message [ ] = sprintf ( $ this -> __ ( '<code>%s</code> should have prefix property.' ) , $ class_name ) ; continue ; } // API Rewrite rules $ new_rewrite [ trim ( $ prefix , '/' ) . '(/.*)?$' ] = "index.php?{$this->api_class}={$class_name}&{$this->api_vars}=\$matches[1]" ; } if ( ! empty ( $ new_rewrite ) ) { $ rules = array_merge ( $ new_rewrite , $ rules ) ; } if ( ! empty ( $ error_message ) ) { add_action ( 'admin_notices' , function ( ) use ( $ error_message ) { printf ( '<div class="error"><p>%s</p></div>' , implode ( '<br />' , $ error_message ) ) ; } ) ; } } return $ rules ; }
Add rewrite rules.

@param array $rules
@return array
Add rewrite rules .