src/CloudTrail/LogFileIterator.php
private function applyDateFilter($objectsIterator, $startDate, $endDate)
    {
        // If either a start or end date was provided, filter out dates that
        // don't match the date range.
        if ($startDate || $endDate) {
            $fn = function ($object) use ($startDate, $endDate) {
                if (!preg_match('/[0-9]{8}T[0-9]{4}Z/', $object['Key'], $m)) {
                    return false;
                }
                $date = strtotime($m[0]);

                return (!$startDate || $date >= $startDate)
                    && (!$endDate || $date <= $endDate);
            };
            $objectsIterator = new \CallbackFilterIterator($objectsIterator, $fn);
        }

        return $objectsIterator;
    }
private function applyDateFilter($objectsIterator, $startDate, $endDate)
    {
        // If either a start or end date was provided, filter out dates that
        // don't match the date range.
        if ($startDate || $endDate) {
            $fn = function ($object) use ($startDate, $endDate) {
                if (!preg_match('/[0-9]{8}T[0-9]{4}Z/', $object['Key'], $m)) {
                    return false;
                }
                $date = strtotime($m[0]);

                return (!$startDate || $date >= $startDate)
                    && (!$endDate || $date <= $endDate);
            };
            $objectsIterator = new \CallbackFilterIterator($objectsIterator, $fn);
        }

        return $objectsIterator;
    }
private function applyDateFilter ( $ objectsIterator , $ startDate , $ endDate ) { // If either a start or end date was provided, filter out dates that // don't match the date range. if ( $ startDate || $ endDate ) { $ fn = function ( $ object ) use ( $ startDate , $ endDate ) { if ( ! preg_match ( '/[0-9]{8}T[0-9]{4}Z/' , $ object [ 'Key' ] , $ m ) ) { return false ; } $ date = strtotime ( $ m [ 0 ] ) ; return ( ! $ startDate || $ date >= $ startDate ) && ( ! $ endDate || $ date <= $ endDate ) ; } ; $ objectsIterator = new \ CallbackFilterIterator ( $ objectsIterator , $ fn ) ; } return $ objectsIterator ; }
Applies an iterator filter to restrict the ListObjects result set to the
specified date range.

@param \Iterator $objectsIterator
@param int       $startDate
@param int       $endDate

@return \Iterator
Applies an iterator filter to restrict the ListObjects result set to the specified date range .