protected function parseDataAttribute(string $dataAttribute) : Generator
    {
        $matches = [];
        preg_match_all('/([a-zA-Z]+)([^|]*)/', $dataAttribute, $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            $name    = $match[1];
            $options = [];

            if (isset($match[2])) {
                $allOptions = explode(',', $match[2]);
                foreach ($allOptions as $option) {
                    $option = explode(':', $option);
                    if (! isset($option[0], $option[1])) {
                        continue;
                    }

                    $options[trim($option[0], ' {}\'\"')] = trim($option[1], ' {}\'\"');
                }
            }

            yield $name => $options;
        }
    }
protected function parseDataAttribute(string $dataAttribute) : Generator
    {
        $matches = [];
        preg_match_all('/([a-zA-Z]+)([^|]*)/', $dataAttribute, $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            $name    = $match[1];
            $options = [];

            if (isset($match[2])) {
                $allOptions = explode(',', $match[2]);
                foreach ($allOptions as $option) {
                    $option = explode(':', $option);
                    if (! isset($option[0], $option[1])) {
                        continue;
                    }

                    $options[trim($option[0], ' {}\'\"')] = trim($option[1], ' {}\'\"');
                }
            }

            yield $name => $options;
        }
    }
protected function parseDataAttribute ( string $ dataAttribute ) : Generator { $ matches = [ ] ; preg_match_all ( '/([a-zA-Z]+)([^|]*)/' , $ dataAttribute , $ matches , PREG_SET_ORDER ) ; foreach ( $ matches as $ match ) { $ name = $ match [ 1 ] ; $ options = [ ] ; if ( isset ( $ match [ 2 ] ) ) { $ allOptions = explode ( ',' , $ match [ 2 ] ) ; foreach ( $ allOptions as $ option ) { $ option = explode ( ':' , $ option ) ; if ( ! isset ( $ option [ 0 ] , $ option [ 1 ] ) ) { continue ; } $ options [ trim ( $ option [ 0 ] , ' {}\'\"' ) ] = trim ( $ option [ 1 ] , ' {}\'\"' ) ; } } yield $ name => $ options ; } }
Parse data attribute value for validators, filters and options
Parse data attribute value for validators filters and options