package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -26,9 +26,9 @@ class_exists(NotFoundExceptionInterface::class);
*/
trait ServiceLocatorTrait
{
private $factories;
private $loading = [];
private $providedTypes;
private array $factories;
private array $loading = [];
private array $providedTypes;
/**
* @param callable[] $factories
@@ -38,22 +38,12 @@ trait ServiceLocatorTrait
$this->factories = $factories;
}
/**
* {@inheritdoc}
*
* @return bool
*/
public function has(string $id)
public function has(string $id): bool
{
return isset($this->factories[$id]);
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function get(string $id)
public function get(string $id): mixed
{
if (!isset($this->factories[$id])) {
throw $this->createNotFoundException($id);
@@ -75,12 +65,9 @@ trait ServiceLocatorTrait
}
}
/**
* {@inheritdoc}
*/
public function getProvidedServices(): array
{
if (null === $this->providedTypes) {
if (!isset($this->providedTypes)) {
$this->providedTypes = [];
foreach ($this->factories as $name => $factory) {