Passed
Push — feature/lg ( 7947e2...b62375 )
by Richard
03:40
created

BaseCommand::generateScaffoldItems()   B

Complexity

Conditions 10
Paths 32

Size

Total Lines 25
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 15
c 3
b 0
f 0
dl 0
loc 25
rs 7.6666
cc 10
nc 32
nop 0

How to fix   Complexity   

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
2
3
namespace PWWEB\Artomator\Commands;
4
5
use InfyOm\Generator\Commands\BaseCommand as Base;
6
use InfyOm\Generator\Generators\Scaffold\ControllerGenerator;
7
use InfyOm\Generator\Generators\Scaffold\MenuGenerator;
8
use InfyOm\Generator\Generators\Scaffold\RequestGenerator;
9
use InfyOm\Generator\Generators\Scaffold\ViewGenerator;
10
use PWWEB\Artomator\Generators\GraphQL\GraphQLMutationGenerator;
11
use PWWEB\Artomator\Generators\GraphQL\GraphQLQueryGenerator;
12
use PWWEB\Artomator\Generators\GraphQL\GraphQLSubscriptionGenerator;
13
use PWWEB\Artomator\Generators\GraphQL\GraphQLTypeGenerator;
14
use PWWEB\Artomator\Generators\Scaffold\RoutesGenerator;
15
16
class BaseCommand extends Base
17
{
18
    public function generateGraphQLItems()
19
    {
20
        if (false === ($this->isSkip('mutations') or $this->isSkip('graphql_mutations'))) {
21
            $mutationGenerator = new GraphQLMutationGenerator($this->commandData);
22
            $mutationGenerator->generate();
23
        }
24
25
        if (false === ($this->isSkip('queries') or $this->isSkip('graphql_query'))) {
26
            $queryGenerator = new GraphQLQueryGenerator($this->commandData);
27
            $queryGenerator->generate();
28
        }
29
30
        if (false === ($this->isSkip('types') or $this->isSkip('graphql_types'))) {
31
            $typeGenerator = new GraphQLTypeGenerator($this->commandData);
32
            $typeGenerator->generate();
33
        }
34
35
        if ((false === ($this->isSkip('subscription') or $this->isSkip('graphql_subscription'))) and config('pwweb.artomator.options.subscription')) {
36
            $subscriptionGenerator = new GraphQLSubscriptionGenerator($this->commandData);
37
            $subscriptionGenerator->generate();
38
        }
39
    }
40
41
    public function generateScaffoldItems()
42
    {
43
        if (false === $this->isSkip('requests') and false === $this->isSkip('scaffold_requests')) {
44
            $requestGenerator = new RequestGenerator($this->commandData);
45
            $requestGenerator->generate();
46
        }
47
48
        if (false === $this->isSkip('controllers') and false === $this->isSkip('scaffold_controller')) {
49
            $controllerGenerator = new ControllerGenerator($this->commandData);
50
            $controllerGenerator->generate();
51
        }
52
53
        if (false === $this->isSkip('views')) {
54
            $viewGenerator = new ViewGenerator($this->commandData);
55
            $viewGenerator->generate();
56
        }
57
58
        if (false === $this->isSkip('routes') and false === $this->isSkip('scaffold_routes')) {
59
            $routeGenerator = new RoutesGenerator($this->commandData);
60
            $routeGenerator->generate();
61
        }
62
63
        if (false === $this->isSkip('menu') and $this->commandData->config->getAddOn('menu.enabled')) {
64
            $menuGenerator = new MenuGenerator($this->commandData);
65
            $menuGenerator->generate();
66
        }
67
    }
68
}
69