public static function splitShorthand($shorthand) {
        $rule = null;
        $message = '';
        $opts = array();

        // rule:o1,o2,o3
        // rule:o1,o2:The message here!
        if (strpos($shorthand, ':') !== false) {
            $parts = explode(':', $shorthand, 3);
            $rule = $parts[0];

            if (!empty($parts[1])) {
                $opts = $parts[1];

                if (strpos($opts, ',') !== false) {
                    $opts = explode(',', $opts);
                } else {
                    $opts = array($opts);
                }
            }

            if (!empty($parts[2])) {
                $message = $parts[2];
            }

        // rule
        } else {
            $rule = $shorthand;
        }

        return array(
            'rule' => $rule,
            'message' => $message,
            'options' => $opts
        );
    }
public static function splitShorthand($shorthand) {
        $rule = null;
        $message = '';
        $opts = array();

        // rule:o1,o2,o3
        // rule:o1,o2:The message here!
        if (strpos($shorthand, ':') !== false) {
            $parts = explode(':', $shorthand, 3);
            $rule = $parts[0];

            if (!empty($parts[1])) {
                $opts = $parts[1];

                if (strpos($opts, ',') !== false) {
                    $opts = explode(',', $opts);
                } else {
                    $opts = array($opts);
                }
            }

            if (!empty($parts[2])) {
                $message = $parts[2];
            }

        // rule
        } else {
            $rule = $shorthand;
        }

        return array(
            'rule' => $rule,
            'message' => $message,
            'options' => $opts
        );
    }
public static function splitShorthand ( $ shorthand ) { $ rule = null ; $ message = '' ; $ opts = array ( ) ; // rule:o1,o2,o3 // rule:o1,o2:The message here! if ( strpos ( $ shorthand , ':' ) !== false ) { $ parts = explode ( ':' , $ shorthand , 3 ) ; $ rule = $ parts [ 0 ] ; if ( ! empty ( $ parts [ 1 ] ) ) { $ opts = $ parts [ 1 ] ; if ( strpos ( $ opts , ',' ) !== false ) { $ opts = explode ( ',' , $ opts ) ; } else { $ opts = array ( $ opts ) ; } } if ( ! empty ( $ parts [ 2 ] ) ) { $ message = $ parts [ 2 ] ; } // rule } else { $ rule = $ shorthand ; } return array ( 'rule' => $ rule , 'message' => $ message , 'options' => $ opts ) ; }
Split a shorthand rule into multiple parts.

@param string $shorthand
@return array
Split a shorthand rule into multiple parts .