| <?php |
|
|
| namespace Kanboard\Core\Group; |
|
|
| |
| |
| |
| |
| |
| |
| class GroupManager |
| { |
| |
| |
| |
| |
| |
| |
| protected $providers = array(); |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function register(GroupBackendProviderInterface $provider) |
| { |
| $this->providers[] = $provider; |
| return $this; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function find($input) |
| { |
| $groups = array(); |
|
|
| foreach ($this->providers as $provider) { |
| $groups = array_merge($groups, $provider->find($input)); |
| } |
|
|
| return $this->removeDuplicates($groups); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| protected function removeDuplicates(array $groups) |
| { |
| $result = array(); |
|
|
| foreach ($groups as $group) { |
| if (! isset($result[$group->getName()])) { |
| $result[$group->getName()] = $group; |
| } |
| } |
|
|
| return array_values($result); |
| } |
| } |
|
|