public static function fromString(string $value)
    {
        $locale = preg_split('/-|_/', $value, 2);
        $language = null;
        $culture = null;

        if (isset($locale[0])) {
            $language = $locale[0];
        }

        if (isset($locale[1])) {
            $culture = $locale[1];
        }

        return new static($language, $culture);
    }
public static function fromString(string $value)
    {
        $locale = preg_split('/-|_/', $value, 2);
        $language = null;
        $culture = null;

        if (isset($locale[0])) {
            $language = $locale[0];
        }

        if (isset($locale[1])) {
            $culture = $locale[1];
        }

        return new static($language, $culture);
    }
public static function fromString ( string $ value ) { $ locale = preg_split ( '/-|_/' , $ value , 2 ) ; $ language = null ; $ culture = null ; if ( isset ( $ locale [ 0 ] ) ) { $ language = $ locale [ 0 ] ; } if ( isset ( $ locale [ 1 ] ) ) { $ culture = $ locale [ 1 ] ; } return new static ( $ language , $ culture ) ; }
Parses the given string and returns its Locale representation.

@param string $value The value to parse.
@return Locale The Locale representation of the given value or a null value.
Parses the given string and returns its Locale representation .