Completed
Push — feature/host-swagger-through-p... ( 67ca0b )
by Lucas
07:54
created

ScriptHandler   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 44.44 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 8
loc 18
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A generateSwaggerJson() 8 8 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
 * swagger composer scripthandler
4
 */
5
6
namespace Graviton\SwaggerBundle\Composer;
7
8
use Graviton\CoreBundle\Composer\ScriptHandlerBase;
9
use Composer\Script\CommandEvent;
10
11
/**
12
 * ScriptHandler for Composer, wrapping our symfony console commands..
13
 *
14
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
15
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
16
 * @link     http://swisscom.ch
17
 */
18
class ScriptHandler extends ScriptHandlerBase
0 ignored issues
show
Coding Style introduced by
ScriptHandler does not seem to conform to the naming convention (Utils?$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
19
{
20
    /**
21
     * Generates swagger.json
22
     *
23
     * @param CommandEvent $event Event
24
     *
25
     * @return void
26
     */
27 View Code Duplication
    public static function generateSwaggerJson(CommandEvent $event)
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...
28
    {
29
        $options = self::getOptions($event);
30
        $consolePath = $options['symfony-app-dir'];
31
        $cmd = escapeshellarg('graviton:swagger:generate');
32
33
        self::executeCommand($event, $consolePath, $cmd);
34
    }
35
}
36