/** * Filters the provided array of themes based on the search. * @param SearchTheme $search * The search to filter the themes by, *(not null not empty). * @param array $themes * The array of Theme objects to be filtered, *(not null not empty). * @return array * The array containing all themes that respect the search. */ protected function filterThemes(SearchTheme $search, array $themes) { //TODO: to implement also the actual filtering. $filtered = $themes; foreach ($search->getOrderedBy() as $column) { if ($column === $search->NAME) { $filtered = $this->sort($filtered, 'getName', $column->isOrderAscending()); } else { if ($column === $search->DESIGNER) { $filtered = $this->sort($filtered, 'getDesigner', $column->isOrderAscending()); } else { if ($column === $search->VERSION) { $filtered = $this->sort($filtered, 'getVersion', $column->isOrderAscending()); } else { if ($column === $search->MINOR_NEWSCOOP_VERSION) { $filtered = $this->sort($filtered, 'getMinorNewscoopVersion', $column->isOrderAscending()); } } } } } return $filtered; }