<?php

namespace PHPNative\Tailwind\Parser;

class MediaQuery
{

    public static function parse(string $style): ?\PHPNative\Tailwind\Style\MediaQueryEnum
    {
        preg_match_all("/^(sm|md|lg|xl|2xl)\:(.*)/", $style, $output_array);
        if (count($output_array[0]) > 0) {
            $query = strtolower(strrev($output_array[1][0]));
            return \PHPNative\Tailwind\Style\MediaQueryEnum::{$query};
        }

        return null;
    }
}