Conditions | 3 |
Paths | 3 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
18 | 3 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
19 | { |
||
20 | 3 | $config = $container->get('config')['svycka_social_user']; |
|
21 | |||
22 | 3 | $localUserProvider = $container->get($config['local_user_provider']); |
|
23 | |||
24 | 3 | if (!$localUserProvider instanceof LocalUserProviderInterface) { |
|
25 | 1 | throw new ServiceNotCreatedException(sprintf( |
|
26 | 1 | 'Invalid "local_user_provider" specified expected class name with implements "%s"', |
|
27 | 1 | LocalUserProviderInterface::class |
|
28 | )); |
||
29 | } |
||
30 | |||
31 | 2 | $storage = $container->get($config['social_user_storage']); |
|
32 | |||
33 | 2 | if (!$storage instanceof SocialUserStorageInterface) { |
|
34 | 1 | throw new ServiceNotCreatedException(sprintf( |
|
35 | 1 | 'Invalid "social_user_storage" specified expected class name with implements "%s"', |
|
36 | 1 | SocialUserStorageInterface::class |
|
37 | )); |
||
38 | } |
||
39 | |||
40 | 1 | return new SocialUserService($localUserProvider, $storage); |
|
41 | } |
||
42 | } |
||
43 |