Code Duplication    Length = 15-16 lines in 2 locations

lib/Payone/Builder.php 2 locations

@@ 374-388 (lines=15) @@
371
372
        $serviceProtocol->setServiceApplyFilters($serviceApplyFilters);
373
374
        if (array_key_exists('loggers', $protocolConfig)) {
375
            $loggerConfig = $protocolConfig['loggers'];
376
            if (is_array($loggerConfig) and count($loggerConfig) > 0) {
377
                foreach ($loggerConfig as $className => $options) {
378
                    if (class_exists($className)) {
379
                        /** @var $logger Payone_Protocol_Logger_Interface * */
380
                        $logger = new $className;
381
                        if (method_exists($logger, 'setConfig')) {
382
                            $logger->setConfig($options);
383
                        }
384
385
                        $serviceProtocol->addLogger($logger);
386
                    }
387
                }
388
            }
389
        }
390
391
        // @todo hs: repository section, for now as a separate array, could this be combined with the loggers?
@@ 392-407 (lines=16) @@
389
        }
390
391
        // @todo hs: repository section, for now as a separate array, could this be combined with the loggers?
392
        if (array_key_exists('repositories', $protocolConfig)) {
393
            $respositoryConfig = $protocolConfig['repositories'];
394
            if (is_array($respositoryConfig) and count($respositoryConfig) > 0) {
395
                foreach ($respositoryConfig as $className => $options) {
396
                    if (class_exists($className)) {
397
                        // @todo hs: what do we do with Payone_Api_Persistence_Interface?
398
                        /** @var $repository Payone_TransactionStatus_Persistence_Interface * */
399
                        $repository = new $className;
400
                        if (method_exists($repository, 'setConfig')) {
401
                            $repository->setConfig($options);
402
                        }
403
404
                        $serviceProtocol->addRepository($repository);
405
                    }
406
                }
407
            }
408
        }
409
410
        return $serviceProtocol;