Skip to content

Commit 3af265c

Browse files
committed
optimization
1 parent c5eeaf8 commit 3af265c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Service/Factory/UserManagerFactory.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o
2323
{
2424
$params = $this->getParams($container);
2525

26-
return new UserManager(...$params);
26+
return $this->createService($params, UserManager::class);
2727
}
2828

2929
/**
@@ -42,4 +42,14 @@ protected function getParams(ContainerInterface $container)
4242

4343
return [$entityManager, $bcrypt, $userEntityClassName, $roleEntityClassName];
4444
}
45+
46+
/**
47+
* @param array $params
48+
* @param string $requestedName
49+
* @return UserManager
50+
*/
51+
protected function createService(array $params, $requestedName)
52+
{
53+
return new $requestedName(...$params);
54+
}
4555
}

0 commit comments

Comments
 (0)