<?php

namespace dynamicimages\helpers;

enum dynamicimages_tool
{
    case RESIZE;
    case CROP;
    case ROTATE;
    case FLIP;
    case FILTER;

    public static function tryFrom(string $param): ?dynamicimages_tool
    {
        return match (strtoupper($param)) {
            'RESIZE' => dynamicimages_tool::RESIZE,
            'CROP' => dynamicimages_tool::CROP,
            'ROTATE' => dynamicimages_tool::ROTATE,
            'FLIP' => dynamicimages_tool::FLIP,
            'FILTER' => dynamicimages_tool::FILTER,
            default => null,
        };
    }

    public function equals(dynamicimages_tool $param): bool
    {
        return $this === $param;
    }

}
