Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/service locator #665

Open
wants to merge 9 commits into
base: master
from

ServiceLocator - rename entry to subscriber, cleanup

  • Loading branch information...
falkenhawk committed May 30, 2019
commit 7a71a1f0b84b2ec54befbda698e4d4358ba51de1
@@ -19,29 +19,29 @@ class ServiceLocator implements ContainerInterface
/**
* @var ContainerInterface
*/
protected $container;
private $container;
/**
* Name of an entry to which this service locator instance belongs to.
* @var string
* @var array
*/
protected $entry;
private $services = [];
/**
* @var array
* Name of a class to which this service locator instance belongs to.
* @var string|null
*/
protected $services = [];
private $subscriber;
/**
* Constructor.
* @param ContainerInterface $container
* @param array $services
* @param string|null $entry Name of an entry to which this service locator instance belongs to
* @param string|null $subscriber className of a ServiceSubscriber to which this service locator instance belongs to
*/
public function __construct(ContainerInterface $container, array $services, string $entry = null)
public function __construct(ContainerInterface $container, array $services, string $subscriber = null)
{
$this->container = $container;
$this->entry = $entry;
$this->subscriber = $subscriber;
$this->setServices($services);
}
@@ -62,11 +62,20 @@ protected function setServices(array $services)
* Get defined services.
* @return array
*/
public function getServices()
public function getServices() : array
{
return $this->services;
}
/**
* Get name of a class to which this service locator instance belongs to.
* @return string
*/
public function getSubscriber() : string
{
return $this->subscriber;
}
/**
* Finds a service by its identifier.
*
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.