/** * @param AuthConfig $config * @param FactoryInterface $factory * @return UserSourceInterface */ public function userSource(AuthConfig $config, FactoryInterface $factory) { if (empty($config->userSource())) { throw new AuthException("User source is not set"); } return $factory->make($config->userSource()); }
/** * @return UserSourceInterface */ private function userSource() { if (empty($this->userSource)) { //Lazy loading $this->userSource = $this->factory->make($this->config->userSource()); } return $this->userSource; }