WithDigraphConfiguration::addDigraphOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 51
Code Lines 42

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 42
nc 1
nop 1
dl 0
loc 51
ccs 9
cts 9
cp 1
crap 1
rs 9.248
c 1
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php declare(strict_types=1);
2
/**
3
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
4
 */
5
6
namespace PhUml\Console\Commands;
7
8
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Command\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Symfony\Component\Console\Input\InputOption;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Input\InputOption was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
/**
12
 * There are 8 options to generate the digraph for a class diagram
13
 *
14
 * 1. `recursive`. If present it will look recursively within the `directory` provided
15
 * 2. `associations`. If present the command will generate associations between the classes/interfaces
16
 *    injected through the constructor and the properties of a class
17
 * 3. `hide-private` If present it will show only public and protected members
18
 * 4. `hide-protected` If present it will show only public and private members
19
 * 5. `hide-methods` If present it will show only properties and constants
20
 * 6. `hide-attributes` If present it will show only methods
21
 * 7. `hide-attributes` If present it will not produce a table row if no properties or methods are
22
 *    present
23
 * 8. `theme` There are 3 color schemes (themes) that you can choose from: `phuml`, which is the
24
 *    default one, `php` and `classic`
25
 */
26
trait WithDigraphConfiguration
27
{
28 17
    private function addDigraphOptions(Command $command): void
29
    {
30
        $command
31 17
            ->addOption(
32
                'recursive',
33
                'r',
34
                InputOption::VALUE_NONE,
35
                'Look for classes in the given directory and its sub-directories'
36
            )
37 17
            ->addOption(
38
                'associations',
39
                'a',
40
                InputOption::VALUE_NONE,
41
                'Extract associations between classes from constructor parameters and properties'
42
            )
43 17
            ->addOption(
44
                'hide-private',
45
                'i',
46
                InputOption::VALUE_NONE,
47
                'Ignore private properties, constants and methods'
48
            )
49 17
            ->addOption(
50
                'hide-protected',
51
                'o',
52
                InputOption::VALUE_NONE,
53
                'Ignore protected properties, constants and methods'
54
            )
55 17
            ->addOption(
56
                'hide-methods',
57
                'm',
58
                InputOption::VALUE_NONE,
59
                'Ignore all methods'
60
            )
61 17
            ->addOption(
62
                'hide-attributes',
63
                't',
64
                InputOption::VALUE_NONE,
65
                'Ignore all properties and constants'
66
            )
67 17
            ->addOption(
68
                'hide-empty-blocks',
69
                'b',
70
                InputOption::VALUE_NONE,
71
                'Do not generate empty blocks for properties or methods'
72
            )
73 17
            ->addOption(
74
                'theme',
75
                'e',
76
                InputOption::VALUE_OPTIONAL,
77
                'Colors and fonts to be used for the diagram [phuml, php, classic]',
78
                'phuml'
79
            )
80
        ;
81
    }
82
}
83