private static function extractDateCriteria($key, array $criteria)
    {
        $date = (!empty($criteria[$key])) ? $criteria[$key] : null;

        if (is_string($date)) {
            $date = \DateTime::createFromFormat('Y-m-d', $date);
        }

        if (false === $date) {
            throw new InvalidArgumentException(sprintf('Invalid date/time format provided "%s", expected "%s", or instance of \DateTime class.', $criteria[$key], 'Y-m-d'));
        }

        return $date;
    }
private static function extractDateCriteria($key, array $criteria)
    {
        $date = (!empty($criteria[$key])) ? $criteria[$key] : null;

        if (is_string($date)) {
            $date = \DateTime::createFromFormat('Y-m-d', $date);
        }

        if (false === $date) {
            throw new InvalidArgumentException(sprintf('Invalid date/time format provided "%s", expected "%s", or instance of \DateTime class.', $criteria[$key], 'Y-m-d'));
        }

        return $date;
    }
private static function extractDateCriteria ( $ key , array $ criteria ) { $ date = ( ! empty ( $ criteria [ $ key ] ) ) ? $ criteria [ $ key ] : null ; if ( is_string ( $ date ) ) { $ date = \ DateTime :: createFromFormat ( 'Y-m-d' , $ date ) ; } if ( false === $ date ) { throw new InvalidArgumentException ( sprintf ( 'Invalid date/time format provided "%s", expected "%s", or instance of \DateTime class.' , $ criteria [ $ key ] , 'Y-m-d' ) ) ; } return $ date ; }
Extract date from filter criterias.

@param string $key Criteria name.
@param array $criteria Filter criterias.
@return \DateTime|null Extracted date criteria.
Extract date from filter criterias .