|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PWWEB\Artomator\Common; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\Str; |
|
6
|
|
|
use InfyOm\Generator\Common\CommandData as Data; |
|
7
|
|
|
use InfyOm\Generator\Common\GeneratorConfig as Config; |
|
8
|
|
|
|
|
9
|
|
|
class GeneratorConfig extends Config |
|
10
|
|
|
{ |
|
11
|
|
|
/* Path variables */ |
|
12
|
|
|
public $pathGraphQL; |
|
13
|
|
|
|
|
14
|
|
|
/* Model Names */ |
|
15
|
|
|
public $gName; |
|
16
|
|
|
public $gPlural; |
|
17
|
|
|
public $gCamel; |
|
18
|
|
|
public $gCamelPlural; |
|
19
|
|
|
public $gSnake; |
|
20
|
|
|
public $gSnakePlural; |
|
21
|
|
|
public $gDashed; |
|
22
|
|
|
public $gDashedPlural; |
|
23
|
|
|
public $gSlash; |
|
24
|
|
|
public $gSlashPlural; |
|
25
|
|
|
public $gHuman; |
|
26
|
|
|
public $gHumanPlural; |
|
27
|
|
|
|
|
28
|
|
|
public function loadPaths() |
|
29
|
|
|
{ |
|
30
|
|
|
parent::loadPaths(); |
|
31
|
|
|
|
|
32
|
|
|
$this->pathGraphQL = config('lighthouse.schema.register', base_path('graphql/schema.graphql')); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function loadDynamicVariables(Data &$commandData) |
|
36
|
|
|
{ |
|
37
|
|
|
parent::loadDynamicVariables($commandData); |
|
38
|
|
|
$commandData->addDynamicVariable('$LICENSE_PACKAGE$', config('pwweb.artomator.license.package')); |
|
39
|
|
|
$commandData->addDynamicVariable('$LICENSE_AUTHORS$', license_authors(config('pwweb.artomator.license.authors'))); |
|
40
|
|
|
$commandData->addDynamicVariable('$LICENSE_COPYRIGHT$', config('pwweb.artomator.license.copyright')); |
|
41
|
|
|
$commandData->addDynamicVariable('$LICENSE$', config('pwweb.artomator.license.license')); |
|
42
|
|
|
$commandData->addDynamicVariable('$NAMESPACE_GRAPHQL_MODEL$', str_replace('\\', '\\\\', $this->nsModel)); |
|
43
|
|
|
return $commandData; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function prepareGraphQLNames($name = null) |
|
47
|
|
|
{ |
|
48
|
|
|
if (is_null($name)) { |
|
49
|
|
|
$name = $this->mName; |
|
50
|
|
|
} |
|
51
|
|
|
$this->gName = $name; |
|
52
|
|
|
$this->gPlural = Str::plural($this->gName); |
|
53
|
|
|
$this->gCamel = Str::camel($this->gName); |
|
54
|
|
|
$this->gCamelPlural = Str::camel($this->gPlural); |
|
55
|
|
|
$this->gSnake = Str::snake($this->gName); |
|
56
|
|
|
$this->gSnakePlural = Str::snake($this->gPlural); |
|
57
|
|
|
$this->gDashed = str_replace('_', '-', Str::snake($this->gSnake)); |
|
58
|
|
|
$this->gDashedPlural = str_replace('_', '-', Str::snake($this->gSnakePlural)); |
|
59
|
|
|
$this->gSlash = str_replace('_', '/', Str::snake($this->gSnake)); |
|
60
|
|
|
$this->gSlashPlural = str_replace('_', '/', Str::snake($this->gSnakePlural)); |
|
61
|
|
|
$this->gHuman = Str::title(str_replace('_', ' ', Str::snake($this->gSnake))); |
|
62
|
|
|
$this->gHumanPlural = Str::title(str_replace('_', ' ', Str::snake($this->gSnakePlural))); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function loadDynamicGraphQLVariables(Data &$commandData) |
|
66
|
|
|
{ |
|
67
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME$', $this->gName); |
|
68
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_CAMEL$', $this->gCamel); |
|
69
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_PLURAL$', $this->gPlural); |
|
70
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_PLURAL_CAMEL$', $this->gCamelPlural); |
|
71
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_SNAKE$', $this->gSnake); |
|
72
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_PLURAL_SNAKE$', $this->gSnakePlural); |
|
73
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_DASHED$', $this->gDashed); |
|
74
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_PLURAL_DASHED$', $this->gDashedPlural); |
|
75
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_SLASH$', $this->gSlash); |
|
76
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_PLURAL_SLASH$', $this->gSlashPlural); |
|
77
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_HUMAN$', $this->gHuman); |
|
78
|
|
|
$commandData->addDynamicVariable('$GRAPHQL_NAME_PLURAL_HUMAN$', $this->gHumanPlural); |
|
79
|
|
|
return $commandData; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|