src/SyHolloway/MrColor/Extension/Formatter.php
private function guess($value)
    {
        if (is_string($value)) {
            $len = strlen($value);
            if (strpos($value, ' ') === false && strpos($value, ',') === false) {
                if (substr($value, 0, 1) === '#' && ($len === 7 || $len === 4)) {
                    return 'loadHexString';
                } elseif ($len === 6 || $len === 3) {
                    return 'loadHexString';
                }
            } elseif (substr($value, 0, 3) === 'rgb') {
                return 'loadRgbString';
            } elseif (substr($value, 0, 4) === 'rgba') {
                return 'loadRgbString';
            } elseif (substr($value, 0, 3) === 'hsl') {
                return 'loadHslString';
            } elseif (substr($value, 0, 4) === 'hsla') {
                return 'loadHslString';
            }

        }

        //Bad Input
        return false;

    }
private function guess($value)
    {
        if (is_string($value)) {
            $len = strlen($value);
            if (strpos($value, ' ') === false && strpos($value, ',') === false) {
                if (substr($value, 0, 1) === '#' && ($len === 7 || $len === 4)) {
                    return 'loadHexString';
                } elseif ($len === 6 || $len === 3) {
                    return 'loadHexString';
                }
            } elseif (substr($value, 0, 3) === 'rgb') {
                return 'loadRgbString';
            } elseif (substr($value, 0, 4) === 'rgba') {
                return 'loadRgbString';
            } elseif (substr($value, 0, 3) === 'hsl') {
                return 'loadHslString';
            } elseif (substr($value, 0, 4) === 'hsla') {
                return 'loadHslString';
            }

        }

        //Bad Input
        return false;

    }
private function guess ( $ value ) { if ( is_string ( $ value ) ) { $ len = strlen ( $ value ) ; if ( strpos ( $ value , ' ' ) === false && strpos ( $ value , ',' ) === false ) { if ( substr ( $ value , 0 , 1 ) === '#' && ( $ len === 7 || $ len === 4 ) ) { return 'loadHexString' ; } elseif ( $ len === 6 || $ len === 3 ) { return 'loadHexString' ; } } elseif ( substr ( $ value , 0 , 3 ) === 'rgb' ) { return 'loadRgbString' ; } elseif ( substr ( $ value , 0 , 4 ) === 'rgba' ) { return 'loadRgbString' ; } elseif ( substr ( $ value , 0 , 3 ) === 'hsl' ) { return 'loadHslString' ; } elseif ( substr ( $ value , 0 , 4 ) === 'hsla' ) { return 'loadHslString' ; } } //Bad Input return false ; }
Given a subject tries to discover the format,
then return the appropriate method name

@param mixed
@return string|boolean string if found, boolean false if not found
Given a subject tries to discover the format then return the appropriate method name