/** * Registers a service provider. * * @param \Silex\ServiceProviderInterface|ServiceProviderInterface $provider * @param array $values * @return Application */ public function registerService($provider, array $values = array()) { $this->providers[] = $provider; $provider->register($this); foreach ($values as $key => $value) { $this[$key] = $value; } return $this; }
/** * Registers a service provider. * * @param \Cilex\ServiceProviderInterface|\Silex\ServiceProviderInterface $provider * A ServiceProviderInterface instance * @param mixed[] $values * An array of values that customizes the provider * * @return void */ public function register($provider, array $values = array()) { if (!$provider instanceof \Cilex\ServiceProviderInterface && !$provider instanceof \Silex\ServiceProviderInterface) { throw new \InvalidArgumentException('Extensions should implement either Cilex or Silex\' ServiceProviderInterface'); } $provider->register($this); foreach ($values as $key => $value) { $this[$key] = $value; } }
/** * Registers a service provider. * * @param ServiceProviderInterface $provider A ServiceProviderInterface instance * @param array $values An array of values that customizes the provider */ public function register(ServiceProviderInterface $provider, array $values = array()) { foreach ($values as $key => $value) { $this[$key] = $value; } $provider->register($this); }
/** * This will pass all the override parameters into the serviceprovider prior to * creating the instance. This allows service providers to be setup via the additional * array instead of relying on application global state. * @param ServiceProviderInterface $provider * @param array $values * @return $this */ public function registerOverride(ServiceProviderInterface $provider, array $values = array()) { $this->providers[] = $provider; foreach ($values as $key => $value) { $this[$key] = $value; } $provider->register($this); return $this; }