protected function parsePattern($pattern)
    {
        $parts = [
            'min' => '[0-5]?\d',
            'hour' => '[01]?\d|2[0-3]',
            'day' => '0?[1-9]|[12]\d|3[01]',
            'month' => '[1-9]|1[012]',
            'dow' => '[0-7]',
            'year' => '20([0-9]{2})',
        ];

        $regex = [];
        foreach (array_slice($parts, 0, 5) as $name => $number) {
            $range = '('.$number.')(-('.$number.'))?';
            $regex[$name] = '(?P<'.$name.'>(\*(\/\d+)?|'.$range.'(,'.$range.')*))';
        }
        $range = '('.$parts['year'].')(-('.$parts['year'].'))?';
        $regexYear = '( (?P<year>(\*(\/\d+)?|'.$range.'(,'.$range.')*)))?';

        $regex = '/^'.implode('([\s\t]+)', $regex).$regexYear.'$/';
        preg_match($regex, $pattern, $matches);

        return array_intersect_key($matches, $parts);
    }
protected function parsePattern($pattern)
    {
        $parts = [
            'min' => '[0-5]?\d',
            'hour' => '[01]?\d|2[0-3]',
            'day' => '0?[1-9]|[12]\d|3[01]',
            'month' => '[1-9]|1[012]',
            'dow' => '[0-7]',
            'year' => '20([0-9]{2})',
        ];

        $regex = [];
        foreach (array_slice($parts, 0, 5) as $name => $number) {
            $range = '('.$number.')(-('.$number.'))?';
            $regex[$name] = '(?P<'.$name.'>(\*(\/\d+)?|'.$range.'(,'.$range.')*))';
        }
        $range = '('.$parts['year'].')(-('.$parts['year'].'))?';
        $regexYear = '( (?P<year>(\*(\/\d+)?|'.$range.'(,'.$range.')*)))?';

        $regex = '/^'.implode('([\s\t]+)', $regex).$regexYear.'$/';
        preg_match($regex, $pattern, $matches);

        return array_intersect_key($matches, $parts);
    }
protected function parsePattern ( $ pattern ) { $ parts = [ 'min' => '[0-5]?\d' , 'hour' => '[01]?\d|2[0-3]' , 'day' => '0?[1-9]|[12]\d|3[01]' , 'month' => '[1-9]|1[012]' , 'dow' => '[0-7]' , 'year' => '20([0-9]{2})' , ] ; $ regex = [ ] ; foreach ( array_slice ( $ parts , 0 , 5 ) as $ name => $ number ) { $ range = '(' . $ number . ')(-(' . $ number . '))?' ; $ regex [ $ name ] = '(?P<' . $ name . '>(\*(\/\d+)?|' . $ range . '(,' . $ range . ')*))' ; } $ range = '(' . $ parts [ 'year' ] . ')(-(' . $ parts [ 'year' ] . '))?' ; $ regexYear = '( (?P<year>(\*(\/\d+)?|' . $ range . '(,' . $ range . ')*)))?' ; $ regex = '/^' . implode ( '([\s\t]+)' , $ regex ) . $ regexYear . '$/' ; preg_match ( $ regex , $ pattern , $ matches ) ; return array_intersect_key ( $ matches , $ parts ) ; }
Parse the pattern into a rule for every property.

@param string $pattern

@return string[]

@throws \InvalidArgumentException
Parse the pattern into a rule for every property .