/** * Restricts the search by modified time. * @param string "[operator] [date]" example: >1978-01-23 * @param mixed * @return Finder provides a fluent interface */ public function date($operator, $date = NULL) { if (func_num_args() === 1) { // in $operator is predicate if (!preg_match('#^(?:([=<>!]=?|<>)\\s*)?(.+)$#i', $operator, $matches)) { throw new \InvalidArgumentException('Invalid date predicate format.'); } list(, $operator, $date) = $matches; $operator = $operator ? $operator : '='; } $date = Tools::createDateTime($date)->format('U'); return $this->filter(function ($file) use($operator, $date) { return Tools::compare($file->getMTime(), $operator, $date); }); }