Passed
Push — master ( c7459e...5c3821 )
by Arthur
22:05
created

GeneratorManager::createModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 4
dl 0
loc 9
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 10.03.19
6
 * Time: 18:30
7
 */
8
9
namespace Foundation\Generator\Managers;
10
11
12
class GeneratorManager
13
{
14 2
    public static function createMigration(string $moduleName, string $migrationName, string $tableName, bool $mongo = false)
15
    {
16
        $options = [
17 2
            "module" => $moduleName,
18 2
            "name" => $migrationName,
19 2
            "--table" => $tableName,
20 2
            "--mongo" => $mongo
21
        ];
22 2
        \Artisan::call("larapi:make:migration", $options);
23 2
    }
24
25 1
    public static function createController(string $moduleName, string $controllerName)
26
    {
27
        $options = [
28 1
            "module" => $moduleName,
29 1
            "name" => $controllerName,
30
        ];
31 1
        \Artisan::call("larapi:make:controller", $options);
32 1
    }
33
34
    public static function createPolicy(string $moduleName, string $policyName)
35
    {
36
        $options = [
37
            "module" => $moduleName,
38
            "name" => $policyName,
39
        ];
40
        \Artisan::call("larapi:make:policy", $options);
41
    }
42
43 1
    public static function createEvent(string $moduleName, string $eventName)
44
    {
45
        $options = [
46 1
            "module" => $moduleName,
47 1
            "name" => $eventName,
48
        ];
49 1
        \Artisan::call("larapi:make:event", $options);
50 1
    }
51
52 1
    public static function createNotification(string $moduleName, string $notificationName)
53
    {
54
        $options = [
55 1
            "module" => $moduleName,
56 1
            "name" => $notificationName,
57
        ];
58 1
        \Artisan::call("larapi:make:notification", $options);
59 1
    }
60
61 1
    public static function createServiceProvider(string $moduleName, string $providerName)
62
    {
63
        $options = [
64 1
            "module" => $moduleName,
65 1
            "name" => $providerName,
66
        ];
67 1
        \Artisan::call("larapi:make:provider", $options);
68 1
    }
69
70 1
    public static function createSeeder(string $moduleName, string $seederName)
71
    {
72
        $options = [
73 1
            "module" => $moduleName,
74 1
            "name" => $seederName,
75
        ];
76 1
        \Artisan::call("larapi:make:seeder", $options);
77 1
    }
78
79 2
    public static function createMiddleware(string $moduleName, string $middlewareName)
80
    {
81
        $options = [
82 2
            "module" => $moduleName,
83 2
            "name" => $middlewareName,
84 2
        ];
85 2
        \Artisan::call("larapi:make:middleware", $options);
86
    }
87 2
88 2
    public static function createRequest(string $moduleName, string $requestName)
89
    {
90 2
        $options = [
91
            "module" => $moduleName,
92
            "name" => $requestName,
93 2
        ];
94 2
        \Artisan::call("larapi:make:request", $options);
95 2
    }
96
97 2
    public static function createRule(string $moduleName, string $ruleName)
98 2
    {
99
        $options = [
100 1
            "module" => $moduleName,
101
            "name" => $ruleName,
102
        ];
103 1
        \Artisan::call("larapi:make:rule", $options);
104 1
    }
105 1
106
    public static function createTest(string $moduleName, string $testName, string $type)
107 1
    {
108 1
        $options = [
109
            "module" => $moduleName,
110
            "name" => $testName,
111
            "--type" => $type
112
        ];
113
        \Artisan::call("larapi:make:test", $options);
114
    }
115
116
    public static function createFactory(string $moduleName, string $modelName)
117
    {
118
        $options = [
119
            "module" => $moduleName,
120
            "--model" => $modelName,
121
        ];
122
        \Artisan::call("larapi:make:factory", $options);
123
    }
124
125
    public static function createTransformer(string $moduleName, string $transformerName, string $modelName)
126
    {
127
        $options = [
128
            "module" => $moduleName,
129
            "name" => $transformerName,
130
            "--model" => $modelName,
131
        ];
132
        \Artisan::call("larapi:make:transformer", $options);
133
    }
134
135
    public static function createListener(string $moduleName, string $listenerName, string $eventName, bool $queued = false)
136
    {
137
        $options = [
138
            "module" => $moduleName,
139
            "name" => $listenerName,
140
            "--event" => $eventName,
141
            "--queued" => $queued
142
        ];
143
        \Artisan::call("larapi:make:listener", $options);
144
    }
145
146
    public static function createJob(string $moduleName, string $jobName, bool $sync = false)
147
    {
148
        $options = [
149
            "module" => $moduleName,
150
            "name" => $jobName,
151
            "--sync" => $sync
152
        ];
153
        \Artisan::call("larapi:make:job", $options);
154
    }
155
156
    public static function createCommand(string $moduleName, string $jobName, string $commandName = null)
157
    {
158
        $options = [
159
            "module" => $moduleName,
160
            "name" => $jobName,
161
            "--command" => $commandName
162
        ];
163
        \Artisan::call("larapi:make:command", $options);
164
    }
165
166
    public static function createModel(string $moduleName, string $modelName, bool $mongo=false, bool $migration = true)
167
    {
168
        $options = [
169
            "module" => $moduleName,
170
            "name" => $modelName,
171
            "--mongo" => $mongo,
172
            "--migration" => $migration
173
        ];
174
        \Artisan::call("larapi:make:model", $options);
175
    }
176
}
177