Code Duplication    Length = 36-37 lines in 2 locations

src/Factory/Client/ClientFactory.php 1 location

@@ 24-60 (lines=37) @@
21
 * @author Mathias Gelhausen <[email protected]>
22
 * @since 0.1.0
23
 */
24
class ClientFactory implements FactoryInterface
25
{
26
27
    /**
28
     * Create the client.
29
     *
30
     * @param ContainerInterface $container
31
     * @param string             $requestedName
32
     * @param array|null         $options
33
     *
34
     * @return Client
35
     */
36
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
37
    {
38
        /* @var \StackOverflowApi\Options\ModuleOptions $options */
39
        $options = $container->get('StackoverflowApi/ModuleOptions');
40
        $log     = $container->get('Log/StackoverflowApi');
41
42
        $client = new Client($options->getAuthorizationCode());
43
        $client->setLogger($log);
44
45
        return $client;
46
    }
47
48
    /**
49
     * Create the client
50
     *
51
     * @param ServiceLocatorInterface $serviceLocator
52
     *
53
     * @return Client
54
     * @deprecated will be obsolete with ZF3
55
     */
56
    public function createService(ServiceLocatorInterface $serviceLocator)
57
    {
58
        return $this($serviceLocator, Client::class);
59
    }
60
}

src/Factory/Service/JobsManagerFactory.php 1 location

@@ 25-60 (lines=36) @@
22
 * @author Mathias Gelhausen <[email protected]>
23
 * @since 0.1.0
24
 */
25
class JobsManagerFactory implements FactoryInterface
26
{
27
28
    /**
29
     * Create a JobsManager instance
30
     *
31
     * @param ContainerInterface $container
32
     * @param string             $requestedName
33
     * @param array              $options
34
     *
35
     * @return JobsManager
36
     */
37
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
38
    {
39
        $log          = $container->get('Log/StackoverflowApi');
40
        $client       = $container->get(Client::class);
41
42
        $manager = new JobsManager($client);
43
        $manager->setLogger($log);
44
45
        return $manager;
46
    }
47
48
    /**
49
     * Create service
50
     *
51
     * @param ServiceLocatorInterface $serviceLocator
52
     *
53
     * @return JobsManager
54
     * @deprecated obsolete with ZF3
55
     */
56
    public function createService(ServiceLocatorInterface $serviceLocator)
57
    {
58
        return $this($serviceLocator, JobsManager::class);
59
    }
60
}