src/Matchers/DateMatch.php
protected static function datesWithSeparators($password)
    {
        $dates = [];
        foreach (static::findAll($password, static::DATE_RX_YEAR_SUFFIX) as $captures) {
            $date = [
                'day' => (int) $captures[1]['token'],
                'month' => (int) $captures[3]['token'],
                'year' => (int) $captures[4]['token'],
                'sep' => $captures[2]['token'],
                'begin' => $captures[0]['begin'],
                'end' => $captures[0]['end'],
            ];
            $dates[] = $date;
        }
        foreach (static::findAll($password, static::DATE_RX_YEAR_PREFIX) as $captures) {
            $date = [
                'day' => (int) $captures[4]['token'],
                'month' => (int) $captures[3]['token'],
                'year' => (int) $captures[1]['token'],
                'sep' => $captures[2]['token'],
                'begin' => $captures[0]['begin'],
                'end' => $captures[0]['end'],
            ];
            $dates[] = $date;
        }

        $results = [];
        foreach ($dates as $candidate) {
            $date = static::checkDate($candidate['day'], $candidate['month'], $candidate['year']);

            if (false === $date) {
                continue;
            }
            list($day, $month, $year) = $date;

            $results[] = [
                'pattern' => 'date',
                'begin' => $candidate['begin'],
                'end' => $candidate['end'],
                'token' => substr($password, $candidate['begin'], $candidate['begin'] + $candidate['end'] - 1),
                'separator' => $candidate['sep'],
                'day' => $day,
                'month' => $month,
                'year' => $year,
            ];
        }

        return $results;
    }
protected static function datesWithSeparators($password)
    {
        $dates = [];
        foreach (static::findAll($password, static::DATE_RX_YEAR_SUFFIX) as $captures) {
            $date = [
                'day' => (int) $captures[1]['token'],
                'month' => (int) $captures[3]['token'],
                'year' => (int) $captures[4]['token'],
                'sep' => $captures[2]['token'],
                'begin' => $captures[0]['begin'],
                'end' => $captures[0]['end'],
            ];
            $dates[] = $date;
        }
        foreach (static::findAll($password, static::DATE_RX_YEAR_PREFIX) as $captures) {
            $date = [
                'day' => (int) $captures[4]['token'],
                'month' => (int) $captures[3]['token'],
                'year' => (int) $captures[1]['token'],
                'sep' => $captures[2]['token'],
                'begin' => $captures[0]['begin'],
                'end' => $captures[0]['end'],
            ];
            $dates[] = $date;
        }

        $results = [];
        foreach ($dates as $candidate) {
            $date = static::checkDate($candidate['day'], $candidate['month'], $candidate['year']);

            if (false === $date) {
                continue;
            }
            list($day, $month, $year) = $date;

            $results[] = [
                'pattern' => 'date',
                'begin' => $candidate['begin'],
                'end' => $candidate['end'],
                'token' => substr($password, $candidate['begin'], $candidate['begin'] + $candidate['end'] - 1),
                'separator' => $candidate['sep'],
                'day' => $day,
                'month' => $month,
                'year' => $year,
            ];
        }

        return $results;
    }
protected static function datesWithSeparators ( $ password ) { $ dates = [ ] ; foreach ( static :: findAll ( $ password , static :: DATE_RX_YEAR_SUFFIX ) as $ captures ) { $ date = [ 'day' => ( int ) $ captures [ 1 ] [ 'token' ] , 'month' => ( int ) $ captures [ 3 ] [ 'token' ] , 'year' => ( int ) $ captures [ 4 ] [ 'token' ] , 'sep' => $ captures [ 2 ] [ 'token' ] , 'begin' => $ captures [ 0 ] [ 'begin' ] , 'end' => $ captures [ 0 ] [ 'end' ] , ] ; $ dates [ ] = $ date ; } foreach ( static :: findAll ( $ password , static :: DATE_RX_YEAR_PREFIX ) as $ captures ) { $ date = [ 'day' => ( int ) $ captures [ 4 ] [ 'token' ] , 'month' => ( int ) $ captures [ 3 ] [ 'token' ] , 'year' => ( int ) $ captures [ 1 ] [ 'token' ] , 'sep' => $ captures [ 2 ] [ 'token' ] , 'begin' => $ captures [ 0 ] [ 'begin' ] , 'end' => $ captures [ 0 ] [ 'end' ] , ] ; $ dates [ ] = $ date ; } $ results = [ ] ; foreach ( $ dates as $ candidate ) { $ date = static :: checkDate ( $ candidate [ 'day' ] , $ candidate [ 'month' ] , $ candidate [ 'year' ] ) ; if ( false === $ date ) { continue ; } list ( $ day , $ month , $ year ) = $ date ; $ results [ ] = [ 'pattern' => 'date' , 'begin' => $ candidate [ 'begin' ] , 'end' => $ candidate [ 'end' ] , 'token' => substr ( $ password , $ candidate [ 'begin' ] , $ candidate [ 'begin' ] + $ candidate [ 'end' ] - 1 ) , 'separator' => $ candidate [ 'sep' ] , 'day' => $ day , 'month' => $ month , 'year' => $ year , ] ; } return $ results ; }
Find dates with separators in a password.

@param string $password

@return array
Find dates with separators in a password .