providers); } /** * @param ProviderInterface $provider */ public function register(ProviderInterface $provider) { $this->providers[$provider->getId()] = $provider; } /** * @param $id * @return bool */ public function has($id) { return isset($this->providers[$id]); } /** * @param $id * @return ProviderInterface */ public function get($id) { if (!isset($this->providers[$id])) { throw new InvalidArgumentException(sprintf('Unable to find provider %s', $id)); } return $this->providers[$id]; } public function count() { return count($this->providers); } }