providers[] = $provider; return $this; } /** * Find a group from a search query * * @access public * @param string $input * @return GroupProviderInterface[] */ public function find($input) { $groups = array(); foreach ($this->providers as $provider) { $groups = array_merge($groups, $provider->find($input)); } return $this->removeDuplicates($groups); } /** * Remove duplicated groups * * @access private * @param array $groups * @return GroupProviderInterface[] */ private function removeDuplicates(array $groups) { $result = array(); foreach ($groups as $group) { if (! isset($result[$group->getName()])) { $result[$group->getName()] = $group; } } return $result; } }