public static function createBySizeName(string $name): self
    {
        $registeredImageSizes = get_intermediate_image_sizes();
        $additionalImageSizes = wp_get_additional_image_sizes();

        Assert::oneOf(
            $name,
            $registeredImageSizes,
            "{$name} size not found on WordPress registered sizes."
        );

        if ($additionalImageSizes[$name] ?? false) {
            return new self(
                (int)$additionalImageSizes[$name]['width'],
                (int)$additionalImageSizes[$name]['height']
            );
        }

        return new self(
            (int)get_option("{$name}_size_w", null),
            (int)get_option("{$name}_size_h", null)
        );
    }
public static function createBySizeName(string $name): self
    {
        $registeredImageSizes = get_intermediate_image_sizes();
        $additionalImageSizes = wp_get_additional_image_sizes();

        Assert::oneOf(
            $name,
            $registeredImageSizes,
            "{$name} size not found on WordPress registered sizes."
        );

        if ($additionalImageSizes[$name] ?? false) {
            return new self(
                (int)$additionalImageSizes[$name]['width'],
                (int)$additionalImageSizes[$name]['height']
            );
        }

        return new self(
            (int)get_option("{$name}_size_w", null),
            (int)get_option("{$name}_size_h", null)
        );
    }
public static function createBySizeName ( string $ name ) : self { $ registeredImageSizes = get_intermediate_image_sizes ( ) ; $ additionalImageSizes = wp_get_additional_image_sizes ( ) ; Assert :: oneOf ( $ name , $ registeredImageSizes , "{$name} size not found on WordPress registered sizes." ) ; if ( $ additionalImageSizes [ $ name ] ?? false ) { return new self ( ( int ) $ additionalImageSizes [ $ name ] [ 'width' ] , ( int ) $ additionalImageSizes [ $ name ] [ 'height' ] ) ; } return new self ( ( int ) get_option ( "{$name}_size_w" , null ) , ( int ) get_option ( "{$name}_size_h" , null ) ) ; }
Create a Size Instance by string WordPress style

@param string $name
@return Size
@throws InvalidArgumentException
Create a Size Instance by string WordPress style