@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @var $type |
17 | 17 | */ |
18 | - public $type='model'; |
|
18 | + public $type = 'model'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var array |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @var $commandRule |
34 | 34 | */ |
35 | - public $commandRule=['model','?table']; |
|
35 | + public $commandRule = ['model', '?table']; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @method create |
39 | 39 | * @return mixed |
40 | 40 | */ |
41 | - public function create(){ |
|
41 | + public function create() { |
|
42 | 42 | |
43 | 43 | $this->argument['file'] = $this->argument['model']; |
44 | 44 | |
45 | - if(!isset($this->argument['table'])){ |
|
45 | + if (!isset($this->argument['table'])) { |
|
46 | 46 | $this->argument['table'] = $this->argument['file'].'s'; |
47 | 47 | } |
48 | 48 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $this->directory['modelDir'] = app()->path()->model(); |
53 | 53 | $this->directory['builderDir'] = $this->directory['modelDir'].'/Builder'; |
54 | - $this->directory['builderAssistantDir'] = $this->directory['modelDir'].'/Builder/Assistant'; |
|
54 | + $this->directory['builderAssistantDir'] = $this->directory['modelDir'].'/Builder/Assistant'; |
|
55 | 55 | $this->directory['contract'] = $this->directory['modelDir'].'/Contract'; |
56 | 56 | $this->directory['helper'] = $this->directory['modelDir'].'/Helper'; |
57 | 57 | |
@@ -66,22 +66,22 @@ discard block |
||
66 | 66 | //model set |
67 | 67 | $this->touch['model/model'] = $this->directory['modelDir'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'.php'; |
68 | 68 | $this->touch['model/builder'] = $this->directory['builderDir'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Builder.php'; |
69 | - $this->touch['model/builderasistant'] = $this->directory['builderAssistantDir'].''.DIRECTORY_SEPARATOR.'Builder.php'; |
|
69 | + $this->touch['model/builderasistant'] = $this->directory['builderAssistantDir'].''.DIRECTORY_SEPARATOR.'Builder.php'; |
|
70 | 70 | $this->touch['model/contract'] = $this->directory['contract'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Contract.php'; |
71 | 71 | |
72 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')){ |
|
72 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')) { |
|
73 | 73 | $this->touch['model/scope'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php'; |
74 | 74 | } |
75 | 75 | |
76 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php')){ |
|
76 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php')) { |
|
77 | 77 | $this->touch['model/event'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php'; |
78 | 78 | } |
79 | 79 | |
80 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'TableChanges.php')){ |
|
80 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'TableChanges.php')) { |
|
81 | 81 | $this->touch['model/tablechanges'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'TableChanges.php'; |
82 | 82 | } |
83 | 83 | |
84 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Constructor.php')){ |
|
84 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Constructor.php')) { |
|
85 | 85 | $this->touch['model/constructor'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Constructor.php'; |
86 | 86 | } |
87 | 87 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $entityDir = $this->directory['modelDir'].''.DIRECTORY_SEPARATOR.'Entity'; |
91 | 91 | |
92 | - if(!file_exists($entityDir)){ |
|
92 | + if (!file_exists($entityDir)) { |
|
93 | 93 | files()->makeDirectory($entityDir); |
94 | 94 | } |
95 | 95 | |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | $entityClass = $entityDir.''.DIRECTORY_SEPARATOR.''.$entityTableName.''.DIRECTORY_SEPARATOR.''.$entityTableName; |
99 | 99 | |
100 | 100 | |
101 | - $generator = new Generator($entityDir,'EntityMap'); |
|
101 | + $generator = new Generator($entityDir, 'EntityMap'); |
|
102 | 102 | |
103 | - if(!file_exists($entityDir.''.DIRECTORY_SEPARATOR.'EntityMap.php')){ |
|
103 | + if (!file_exists($entityDir.''.DIRECTORY_SEPARATOR.'EntityMap.php')) { |
|
104 | 104 | |
105 | 105 | //$this->setAnnotations(); |
106 | 106 | $generator->createClass(); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $entityMapNamespaceResolve = new $entityMapNamespace; |
112 | 112 | |
113 | - if(!method_exists($entityMapNamespaceResolve,strtolower($this->argument['table']))){ |
|
113 | + if (!method_exists($entityMapNamespaceResolve, strtolower($this->argument['table']))) { |
|
114 | 114 | |
115 | 115 | $generator->createClassUse([ |
116 | 116 | Utils::getNamespace($entityClass) |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | |
141 | 141 | |
142 | 142 | //set builder map |
143 | - $generator = new Generator($this->directory['builderDir'],'BuilderMap'); |
|
143 | + $generator = new Generator($this->directory['builderDir'], 'BuilderMap'); |
|
144 | 144 | |
145 | - if(!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')){ |
|
145 | + if (!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')) { |
|
146 | 146 | |
147 | 147 | $this->setAnnotations(); |
148 | 148 | $generator->createClass(); |
149 | 149 | } |
150 | 150 | |
151 | - if(!file_exists($this->touch['model/model'])){ |
|
151 | + if (!file_exists($this->touch['model/model'])) { |
|
152 | 152 | |
153 | 153 | $generator->createMethod([ |
154 | 154 | strtolower($this->argument['file']) |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | //set project touch |
172 | - $this->file->touch($this,[ |
|
172 | + $this->file->touch($this, [ |
|
173 | 173 | 'stub'=>'Model_Create' |
174 | 174 | ]); |
175 | 175 | |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | /** |
181 | 181 | * @return bool |
182 | 182 | */ |
183 | - private function setAnnotations(){ |
|
183 | + private function setAnnotations() { |
|
184 | 184 | |
185 | 185 | $entityMap = app()->path()->model().''.DIRECTORY_SEPARATOR.'Entity'.DIRECTORY_SEPARATOR.'EntityMap.php'; |
186 | 186 | |
187 | - if(file_exists($entityMap)){ |
|
187 | + if (file_exists($entityMap)) { |
|
188 | 188 | |
189 | 189 | Utils::changeClass(path()->serviceAnnotations().'.php', |
190 | 190 | [ |