public static function fromString($size, $unit = 'px', $separator = ' x ')
    {
        if (is_string($size)) {
            $matches = [];
            $pattern = Regex::getSizePattern($separator);

            if ((bool)preg_match($pattern, $size, $matches)) {
                $width = (int)$matches[1];
                $height = (int)$matches[2];
                $sizeObject = new self($width, $height, $unit);

                return $sizeObject->setSeparator($separator);
            }
        }

        return null;
    }