Completed
Push — develop ( 1aadc7...f2612d )
by
unknown
15:52 queued 05:10
created

Module   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 21.15 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 11
loc 52
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 4 1
A getConsoleUsage() 0 16 1
A getAutoloaderConfig() 11 11 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * YAWIK
4
 * Applications Module Bootstrap
5
 *
6
 * @copyright (c) 2013-2015 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 */
9
10
namespace Applications;
11
12
use Zend\Console\Adapter\AdapterInterface as Console;
13
use Zend\ModuleManager\Feature\ConsoleUsageProviderInterface;
14
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
15
use Core\ModuleManager\ModuleConfigLoader;
16
17
/**
18
 * Bootstrap class of the applications module
19
 */
20
class Module implements ConsoleUsageProviderInterface, AutoloaderProviderInterface
21
{
22
    /**
23
     * Displays console options
24
     *
25
     * @param Console $console
26
     * @return array|null|string
27
     */
28
    public function getConsoleUsage(Console $console)
29
    {
30
        return array(
31
            'Manipulation of applications collection',
32
            'applications generatekeywords' => '(Re-)Generates keywords for all applications.',
33
            'applications calculate-rating' => '(Re-)Calculates average rating for all applications.',
34
            'applications cleanup'          => 'removes applications drafts.',
35
            'applications list'             => 'list view scripts.',
36
            'applications reset-files-permissions [--filter=]' => 'Resets (means: Set again) the permissions of attachments and contact images',
37
            array('--filter=JSON', "available keys:\n"
38
                                   . "- before    ISODate   only applications before the given date\n"
39
                                   . "- after     ISODate   only applications after the given date\n"
40
                                   . "- id        String    Mongo ID of the application\n"
41
                                   . "- isDraft   Boolean   "),
42
        );
43
    }
44
    
45
    /**
46
     * Loads module specific configuration.
47
     *
48
     * @return array
49
     */
50
    public function getConfig()
51
    {
52
        return ModuleConfigLoader::load(__DIR__ . '/config');
53
    }
54
55
    /**
56
     * Loads module specific autoloader configuration.
57
     *
58
     * @return array
59
     */
60 View Code Duplication
    public function getAutoloaderConfig()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
61
    {
62
        return array(
63
            'Zend\Loader\StandardAutoloader' => array(
64
                'namespaces' => array(
65
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
66
                    __NAMESPACE__ . 'Test' => __DIR__ . '/test/' . __NAMESPACE__ .'Test',
67
                ),
68
            ),
69
        );
70
    }
71
}
72