/** * Returns filter function * @return Closure */ public function getClosure() { $operator = $this->_operator; $trackCount = $this->_value; return function ($entry) use($operator, $trackCount) { $entryTrackCount = $entry->getTrackCount(); return ComparisonHelper::compareValues((int) $entryTrackCount, (int) $trackCount, $operator); }; }
/** * Returns filter function * @return Closure */ public function getClosure() { if ($this->_value === null) { throw new InvalidArgumentException('Filter Exception: no parameter was provided.'); } $operator = $this->_operator; $date = date_parse($this->_value); return function ($entry) use($operator, $date) { $entryDate = date_parse($entry->getReleaseDate()); return ComparisonHelper::compareValues($entryDate, $date, $operator); }; }