@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | class ResourceCompiler extends AbstractCompiler |
12 | 12 | { |
13 | 13 | protected $cachePrefix = 'resource_'; |
14 | - protected $stubFilename = 'Resource.js' ; |
|
14 | + protected $stubFilename = 'Resource.js'; |
|
15 | 15 | |
16 | 16 | public function __construct($scaffolderConfig, $modelData = null) |
17 | 17 | { |
18 | - $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/'; |
|
18 | + $this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/'; |
|
19 | 19 | parent::__construct($scaffolderConfig, $modelData); |
20 | 20 | } |
21 | 21 | |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function getOutputFilename() |
39 | 39 | { |
40 | - $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/' ; |
|
40 | + $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/'; |
|
41 | 41 | |
42 | 42 | Directory::createIfNotExists($folder, 0755, true); |
43 | 43 | |
44 | - return $folder . $this->modelData->tableName . '.resource.js'; |
|
44 | + return $folder.$this->modelData->tableName.'.resource.js'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | } |
48 | 48 | \ No newline at end of file |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | class RegisterControllerCompiler extends AbstractCompiler |
12 | 12 | { |
13 | 13 | protected $cachePrefix = 'register_controller_'; |
14 | - protected $stubFilename = 'RegisterController.js' ; |
|
14 | + protected $stubFilename = 'RegisterController.js'; |
|
15 | 15 | |
16 | 16 | public function __construct($scaffolderConfig, $modelData = null) |
17 | 17 | { |
18 | - $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/'; |
|
18 | + $this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/'; |
|
19 | 19 | parent::__construct($scaffolderConfig, $modelData); |
20 | 20 | } |
21 | 21 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | foreach ($this->modelData->fields as $field) |
40 | 40 | { |
41 | 41 | |
42 | - if($field->type->ui == 'autoComplete' || $field->type->ui == 'multipleAutoComplete') |
|
42 | + if ($field->type->ui == 'autoComplete' || $field->type->ui == 'multipleAutoComplete') |
|
43 | 43 | { |
44 | 44 | $this->stub = str_replace('{{table_from}}', $field->table_from, $this->stub); |
45 | 45 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | private function replaceFileUpload() |
54 | 54 | { |
55 | - $fileStub = File::get($this->stubsDirectory . '/Register/FileRegisterControllerStub.php'); |
|
55 | + $fileStub = File::get($this->stubsDirectory.'/Register/FileRegisterControllerStub.php'); |
|
56 | 56 | $this->stub = str_replace('{{file_upload}}', $fileStub, $this->stub); |
57 | 57 | |
58 | 58 | $keyAutoComplete = $keyMultipleAutoComplete = $keyCheckbox = $keyCheckboxTree = false; |
@@ -67,22 +67,22 @@ discard block |
||
67 | 67 | $keyAutoComplete = true; |
68 | 68 | break; |
69 | 69 | case 'multipleAutoComplete': |
70 | - $multipleAutoStub = $this->changeStubDataAndTag('MultipleAutoComplete','{{multiple_auto_complete}}',$field->table_from); |
|
70 | + $multipleAutoStub = $this->changeStubDataAndTag('MultipleAutoComplete', '{{multiple_auto_complete}}', $field->table_from); |
|
71 | 71 | $keyMultipleAutoComplete = true; |
72 | 72 | break; |
73 | 73 | case 'checkbox': |
74 | - $checkboxStub = $this->changeStubDataAndTag('Checkbox','{{checkbox}}', $field->table_from); |
|
74 | + $checkboxStub = $this->changeStubDataAndTag('Checkbox', '{{checkbox}}', $field->table_from); |
|
75 | 75 | $keyCheckbox = true; |
76 | 76 | break; |
77 | 77 | case 'checkboxTree': |
78 | - $checkboxTreeStub = $this->changeStubDataAndTag('CheckboxTree','{{checkbox_tree}}', $field->table_from); |
|
78 | + $checkboxTreeStub = $this->changeStubDataAndTag('CheckboxTree', '{{checkbox_tree}}', $field->table_from); |
|
79 | 79 | $keyCheckboxTree = true; |
80 | 80 | break; |
81 | 81 | default: |
82 | 82 | break; |
83 | 83 | } |
84 | 84 | |
85 | - if($field->foreignKey) |
|
85 | + if ($field->foreignKey) |
|
86 | 86 | { |
87 | 87 | $this->stub = str_replace('{{foreign_table}}', $field->foreignKey->table, $this->stub); |
88 | 88 | } |
@@ -90,22 +90,22 @@ discard block |
||
90 | 90 | |
91 | 91 | } |
92 | 92 | |
93 | - if(!$keyAutoComplete) |
|
93 | + if (!$keyAutoComplete) |
|
94 | 94 | { |
95 | 95 | $this->stub = str_replace('{{auto_complete}}', ' ', $this->stub); |
96 | 96 | } |
97 | 97 | |
98 | - if(!$keyMultipleAutoComplete) |
|
98 | + if (!$keyMultipleAutoComplete) |
|
99 | 99 | { |
100 | 100 | $this->stub = str_replace('{{multiple_auto_complete}}', ' ', $this->stub); |
101 | 101 | } |
102 | 102 | |
103 | - if(!$keyCheckbox) |
|
103 | + if (!$keyCheckbox) |
|
104 | 104 | { |
105 | 105 | $this->stub = str_replace('{{checkbox}}', ' ', $this->stub); |
106 | 106 | } |
107 | 107 | |
108 | - if(!$keyCheckboxTree) |
|
108 | + if (!$keyCheckboxTree) |
|
109 | 109 | { |
110 | 110 | $this->stub = str_replace('{{checkbox_tree}}', ' ', $this->stub); |
111 | 111 | } |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | - public function changeStubDataAndTag($stubName,$stubTag,$table_from) |
|
117 | + public function changeStubDataAndTag($stubName, $stubTag, $table_from) |
|
118 | 118 | { |
119 | - $stubFile = File::get($this->stubsDirectory . '/Register/'.$stubName.'ControllerStub.php'); |
|
119 | + $stubFile = File::get($this->stubsDirectory.'/Register/'.$stubName.'ControllerStub.php'); |
|
120 | 120 | $stubFile = str_replace('{{table_from}}', $table_from, $stubFile); |
121 | 121 | $this->stub = str_replace($stubTag, $stubFile, $this->stub); |
122 | 122 | } |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | */ |
130 | 130 | protected function getOutputFilename() |
131 | 131 | { |
132 | - $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/register/' ; |
|
132 | + $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/register/'; |
|
133 | 133 | |
134 | 134 | Directory::createIfNotExists($folder, 0755, true); |
135 | 135 | |
136 | - return $folder .$this->modelData->tableName . '_register.controller.js'; |
|
136 | + return $folder.$this->modelData->tableName.'_register.controller.js'; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | } |
140 | 140 | \ No newline at end of file |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | class ListChooseColumnsCompiler extends AbstractCompiler |
12 | 12 | { |
13 | 13 | protected $cachePrefix = 'list_choose_column_'; |
14 | - protected $stubFilename = 'ChooseColumnsDialog.html' ; |
|
14 | + protected $stubFilename = 'ChooseColumnsDialog.html'; |
|
15 | 15 | |
16 | 16 | public function __construct($scaffolderConfig, $modelData = null) |
17 | 17 | { |
18 | - $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/'; |
|
18 | + $this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/'; |
|
19 | 19 | parent::__construct($scaffolderConfig, $modelData); |
20 | 20 | } |
21 | 21 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function getOutputFilename() |
41 | 41 | { |
42 | - $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ; |
|
42 | + $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/'; |
|
43 | 43 | |
44 | 44 | Directory::createIfNotExists($folder, 0755, true); |
45 | 45 | |
46 | - return $folder .$this->modelData->tableName . '_columns.dialog.html'; |
|
46 | + return $folder.$this->modelData->tableName.'_columns.dialog.html'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -9,16 +9,16 @@ discard block |
||
9 | 9 | use Scaffolder\Support\Directory; |
10 | 10 | use Scaffolder\Support\CamelCase; |
11 | 11 | use Scaffolder\Support\Validator; |
12 | -use stdClass ; |
|
12 | +use stdClass; |
|
13 | 13 | |
14 | 14 | class RegisterTemplateCompiler extends AbstractCompiler |
15 | 15 | { |
16 | 16 | protected $cachePrefix = 'register_template_'; |
17 | - protected $stubFilename = 'RegisterTemplate.html' ; |
|
17 | + protected $stubFilename = 'RegisterTemplate.html'; |
|
18 | 18 | |
19 | 19 | public function __construct($scaffolderConfig, $modelData = null) |
20 | 20 | { |
21 | - $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/'; |
|
21 | + $this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/'; |
|
22 | 22 | parent::__construct($scaffolderConfig, $modelData); |
23 | 23 | } |
24 | 24 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return $this |
44 | 44 | */ |
45 | - private function replaceInputFields(){ |
|
45 | + private function replaceInputFields() { |
|
46 | 46 | |
47 | 47 | $inputFields = $this->getInputFields(); |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return $this |
58 | 58 | */ |
59 | - public function getInputFields(){ |
|
59 | + public function getInputFields() { |
|
60 | 60 | |
61 | 61 | $inputFields = $eagerFields = ''; |
62 | 62 | |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | { |
65 | 65 | $fieldStub = $this->getInputStubByField($field); |
66 | 66 | |
67 | - if($field->foreignKey){ |
|
67 | + if ($field->foreignKey) { |
|
68 | 68 | |
69 | - $fieldStub = $this->replaceForeingStrings($field, $fieldStub) ; |
|
69 | + $fieldStub = $this->replaceForeingStrings($field, $fieldStub); |
|
70 | 70 | $fieldStub = str_replace('{{foreign_model_name}}', strtolower(CamelCase::convertToCamelCase($field->foreignKey->table)), $fieldStub); |
71 | 71 | } |
72 | 72 | |
73 | - $inputFields .= $this->replaceFieldInput($field, $fieldStub) ; |
|
73 | + $inputFields .= $this->replaceFieldInput($field, $fieldStub); |
|
74 | 74 | |
75 | 75 | // Check foreign key |
76 | 76 | if ($field->foreignKey && isset($field->foreignKey->eager) && $field->foreignKey->eager) |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $foreignModelData = $this->getModelData($field->foreignKey->table); |
80 | 80 | $foreignControllerCompiler = new RegisterTemplateCompiler($this->scaffolderConfig, $foreignModelData); |
81 | 81 | $foreignControllerCompiler->setEagerTable($this->modelData->tableName); |
82 | - $eagerFields .= $foreignControllerCompiler->getInputFields(); |
|
82 | + $eagerFields .= $foreignControllerCompiler->getInputFields(); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $this->stub = str_replace('{{eager_objects_inputs}}', $eagerFields, $this->stub); |
91 | 91 | |
92 | - return $inputFields ; |
|
92 | + return $inputFields; |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | foreach ($this->modelData->reverseRelationships as $relationship) |
106 | 106 | { |
107 | 107 | if ($relationship->type == "belongsToMany") { |
108 | - $fieldStub = File::get($this->stubsDirectory . 'Register/'. CamelCase::convertToCamelCase($relationship->ui). '.html'); |
|
108 | + $fieldStub = File::get($this->stubsDirectory.'Register/'.CamelCase::convertToCamelCase($relationship->ui).'.html'); |
|
109 | 109 | |
110 | - $fieldStub = str_replace('{{related_table}}',CamelCase::convertToCamelCase($relationship->relatedTable), $fieldStub); |
|
110 | + $fieldStub = str_replace('{{related_table}}', CamelCase::convertToCamelCase($relationship->relatedTable), $fieldStub); |
|
111 | 111 | $fieldStub = str_replace('{{related_table_lw}}', strtolower(CamelCase::convertToCamelCase($relationship->relatedTable)), $fieldStub); |
112 | 112 | $fieldStub = str_replace('{{table_name}}', $this->modelData->tableName, $fieldStub); |
113 | 113 | $fieldStub = str_replace('{{related_table_lw_pl}}', CamelCase::pluralize(strtolower($relationship->relatedTable)), $fieldStub); |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @return $this |
132 | 132 | */ |
133 | - protected function replaceFieldInput($field, $fieldStub){ |
|
134 | - $fieldStub = $this->replaceFieldStrings($field, $fieldStub) ; |
|
135 | - $fieldStub = $this->replaceFieldValidations($field, $fieldStub) ; |
|
133 | + protected function replaceFieldInput($field, $fieldStub) { |
|
134 | + $fieldStub = $this->replaceFieldStrings($field, $fieldStub); |
|
135 | + $fieldStub = $this->replaceFieldValidations($field, $fieldStub); |
|
136 | 136 | |
137 | - return $fieldStub ; |
|
137 | + return $fieldStub; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @return $this |
147 | 147 | */ |
148 | - protected function replaceFieldValidations($field, $fieldStub){ |
|
149 | - $fieldStub = $this->replaceFieldStrings($field, $fieldStub) ; |
|
148 | + protected function replaceFieldValidations($field, $fieldStub) { |
|
149 | + $fieldStub = $this->replaceFieldStrings($field, $fieldStub); |
|
150 | 150 | |
151 | 151 | $validationsConverted = Validator::convertValidations($field->validations); |
152 | 152 | |
153 | - $inputValidations = '' ; |
|
153 | + $inputValidations = ''; |
|
154 | 154 | |
155 | 155 | foreach ($validationsConverted as $attribute => $value) { |
156 | - if($value) |
|
157 | - $inputValidations .= ' '.$attribute.'="'. $value.'"' ; |
|
156 | + if ($value) |
|
157 | + $inputValidations .= ' '.$attribute.'="'.$value.'"'; |
|
158 | 158 | else |
159 | - $inputValidations .= ' '.$attribute ; |
|
159 | + $inputValidations .= ' '.$attribute; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | $fieldStub = str_replace('{{field_validation}}', $inputValidations, $fieldStub); |
163 | 163 | |
164 | - return $fieldStub ; |
|
164 | + return $fieldStub; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -173,26 +173,26 @@ discard block |
||
173 | 173 | * @return $this |
174 | 174 | */ |
175 | 175 | private $inputStub = []; |
176 | - private function getInputStubByField($field){ |
|
176 | + private function getInputStubByField($field) { |
|
177 | 177 | |
178 | - if($field->index == 'primary'){ |
|
179 | - $uiType = 'primary' ; |
|
178 | + if ($field->index == 'primary') { |
|
179 | + $uiType = 'primary'; |
|
180 | 180 | } |
181 | - elseif(isset($field->foreignKey) && $field->foreignKey){ |
|
182 | - if(isset($field->foreignKey->eager) && $field->foreignKey->eager) |
|
183 | - $uiType = 'foreign_eager' ; |
|
181 | + elseif (isset($field->foreignKey) && $field->foreignKey) { |
|
182 | + if (isset($field->foreignKey->eager) && $field->foreignKey->eager) |
|
183 | + $uiType = 'foreign_eager'; |
|
184 | 184 | else |
185 | - $uiType = $field->type->ui ; |
|
185 | + $uiType = $field->type->ui; |
|
186 | 186 | } |
187 | 187 | else { |
188 | - $uiType = $field->type->ui ; |
|
188 | + $uiType = $field->type->ui; |
|
189 | 189 | } |
190 | 190 | |
191 | - if(array_key_exists($uiType, $this->inputStub)){ |
|
191 | + if (array_key_exists($uiType, $this->inputStub)) { |
|
192 | 192 | return $this->inputStub[$uiType]; |
193 | 193 | } |
194 | 194 | else { |
195 | - $this->inputStub[$uiType] = File::get($this->stubsDirectory . 'Register/'. CamelCase::convertToCamelCase($uiType). '.html'); |
|
195 | + $this->inputStub[$uiType] = File::get($this->stubsDirectory.'Register/'.CamelCase::convertToCamelCase($uiType).'.html'); |
|
196 | 196 | |
197 | 197 | return $this->inputStub[$uiType]; |
198 | 198 | } |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | */ |
207 | 207 | protected function getOutputFilename() |
208 | 208 | { |
209 | - $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/register/' ; |
|
209 | + $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/register/'; |
|
210 | 210 | |
211 | 211 | Directory::createIfNotExists($folder, 0755, true); |
212 | 212 | |
213 | - return $folder .$this->modelData->tableName . '_register.html'; |
|
213 | + return $folder.$this->modelData->tableName.'_register.html'; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | } |
217 | 217 | \ No newline at end of file |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | class ListModuleCompiler extends AbstractCompiler |
12 | 12 | { |
13 | 13 | protected $cachePrefix = 'list_module_'; |
14 | - protected $stubFilename = 'ListModule.js' ; |
|
14 | + protected $stubFilename = 'ListModule.js'; |
|
15 | 15 | |
16 | 16 | public function __construct($scaffolderConfig, $modelData = null) |
17 | 17 | { |
18 | - $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/'; |
|
18 | + $this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/'; |
|
19 | 19 | parent::__construct($scaffolderConfig, $modelData); |
20 | 20 | } |
21 | 21 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function getOutputFilename() |
41 | 41 | { |
42 | - $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ; |
|
42 | + $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/'; |
|
43 | 43 | |
44 | 44 | Directory::createIfNotExists($folder, 0755, true); |
45 | 45 | |
46 | - return $folder .$this->modelData->tableName . '_list.module.js'; |
|
46 | + return $folder.$this->modelData->tableName.'_list.module.js'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -10,18 +10,18 @@ discard block |
||
10 | 10 | |
11 | 11 | class IndexModuleCompiler extends AbstractCompiler |
12 | 12 | { |
13 | - protected $stubFilename = 'IndexModule.js' ; |
|
13 | + protected $stubFilename = 'IndexModule.js'; |
|
14 | 14 | |
15 | - protected $stubResourceFilename = 'IndexModuleModel.js' ; |
|
16 | - protected $stubResource ; |
|
15 | + protected $stubResourceFilename = 'IndexModuleModel.js'; |
|
16 | + protected $stubResource; |
|
17 | 17 | |
18 | 18 | |
19 | 19 | public function __construct($scaffolderConfig, $modelData = null) |
20 | 20 | { |
21 | - $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/'; |
|
21 | + $this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/'; |
|
22 | 22 | parent::__construct($scaffolderConfig, null); |
23 | 23 | |
24 | - $this->stubResource = File::get($this->stubsDirectory . $this->stubResourceFilename ); |
|
24 | + $this->stubResource = File::get($this->stubsDirectory.$this->stubResourceFilename); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return string |
31 | 31 | */ |
32 | - public function replaceAndStore(){} |
|
32 | + public function replaceAndStore() {} |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Compiles a resource. |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $folder = PathParser::parse($this->scaffolderConfig->generator->paths->index); |
71 | 71 | |
72 | - return $folder . 'index.module.js'; |
|
72 | + return $folder.'index.module.js'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | class ModuleCompiler extends AbstractCompiler |
12 | 12 | { |
13 | 13 | protected $cachePrefix = 'module_'; |
14 | - protected $stubFilename = 'Module.js' ; |
|
14 | + protected $stubFilename = 'Module.js'; |
|
15 | 15 | |
16 | 16 | public function __construct($scaffolderConfig, $modelData = null) |
17 | 17 | { |
18 | - $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/'; |
|
18 | + $this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/'; |
|
19 | 19 | parent::__construct($scaffolderConfig, $modelData); |
20 | 20 | } |
21 | 21 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function getOutputFilename() |
41 | 41 | { |
42 | - $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/' ; |
|
42 | + $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/'; |
|
43 | 43 | |
44 | 44 | Directory::createIfNotExists($folder, 0755, true); |
45 | 45 | |
46 | - return $folder . $this->modelData->tableName . '.module.js'; |
|
46 | + return $folder.$this->modelData->tableName.'.module.js'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | class RegisterModuleCompiler extends AbstractCompiler |
12 | 12 | { |
13 | 13 | protected $cachePrefix = 'register_module_'; |
14 | - protected $stubFilename = 'RegisterModule.js' ; |
|
14 | + protected $stubFilename = 'RegisterModule.js'; |
|
15 | 15 | |
16 | 16 | public function __construct($scaffolderConfig, $modelData = null) |
17 | 17 | { |
18 | - $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/'; |
|
18 | + $this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/'; |
|
19 | 19 | parent::__construct($scaffolderConfig, $modelData); |
20 | 20 | } |
21 | 21 | |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function getOutputFilename() |
41 | 41 | { |
42 | - $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/register/' ; |
|
42 | + $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/register/'; |
|
43 | 43 | |
44 | 44 | Directory::createIfNotExists($folder, 0755, true); |
45 | 45 | |
46 | - return $folder .$this->modelData->tableName . '_register.module.js'; |
|
46 | + return $folder.$this->modelData->tableName.'_register.module.js'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -5,30 +5,30 @@ discard block |
||
5 | 5 | use Scaffolder\Compilers\Support\FileToCompile; |
6 | 6 | use Illuminate\Support\Facades\File; |
7 | 7 | use Scaffolder\Support\Json; |
8 | -use stdClass ; |
|
8 | +use stdClass; |
|
9 | 9 | |
10 | 10 | abstract class AbstractCompiler |
11 | 11 | { |
12 | - protected $cachePrefix ; |
|
12 | + protected $cachePrefix; |
|
13 | 13 | protected $stubFilename; |
14 | 14 | |
15 | 15 | protected $stub; |
16 | - protected $scaffolderConfig ; |
|
17 | - protected $modelName ; |
|
18 | - protected $modelData ; |
|
19 | - protected $stubsDirectory ; |
|
16 | + protected $scaffolderConfig; |
|
17 | + protected $modelName; |
|
18 | + protected $modelData; |
|
19 | + protected $stubsDirectory; |
|
20 | 20 | |
21 | - protected $eagerTable ; |
|
21 | + protected $eagerTable; |
|
22 | 22 | |
23 | 23 | const CACHE_EXT = '.scf'; |
24 | 24 | |
25 | 25 | public function __construct($scaffolderConfig, $modelData = null) |
26 | 26 | { |
27 | - $this->modelName = isset($modelData->modelName) ? $modelData->modelName : null ; |
|
28 | - $this->modelData = $modelData ; |
|
29 | - $this->scaffolderConfig = $scaffolderConfig ; |
|
27 | + $this->modelName = isset($modelData->modelName) ? $modelData->modelName : null; |
|
28 | + $this->modelData = $modelData; |
|
29 | + $this->scaffolderConfig = $scaffolderConfig; |
|
30 | 30 | |
31 | - $this->stub = File::get($this->stubsDirectory . $this->stubFilename ); |
|
31 | + $this->stub = File::get($this->stubsDirectory.$this->stubFilename); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function compile($extra = null) |
42 | 42 | { |
43 | - if (File::exists(base_path('scaffolder-config/cache/' . $this->cachePrefix . $this->modelData->modelHash . self::CACHE_EXT))) |
|
43 | + if (File::exists(base_path('scaffolder-config/cache/'.$this->cachePrefix.$this->modelData->modelHash.self::CACHE_EXT))) |
|
44 | 44 | { |
45 | 45 | return $this->store(new FileToCompile(true, $this->modelData->modelHash)); |
46 | 46 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string |
71 | 71 | */ |
72 | - protected function setEagerTable($eagerTable){ |
|
72 | + protected function setEagerTable($eagerTable) { |
|
73 | 73 | $this->eagerTable = $eagerTable.'.'; |
74 | 74 | } |
75 | 75 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | // Store in cache |
88 | 88 | if ($fileToCompile->cached) |
89 | 89 | { |
90 | - File::copy(base_path('scaffolder-config/cache/' . $this->cachePrefix . $fileToCompile->hash . self::CACHE_EXT), $path); |
|
90 | + File::copy(base_path('scaffolder-config/cache/'.$this->cachePrefix.$fileToCompile->hash.self::CACHE_EXT), $path); |
|
91 | 91 | } |
92 | 92 | else |
93 | 93 | { |
94 | - File::put(base_path('scaffolder-config/cache/' . $this->cachePrefix . $fileToCompile->hash . self::CACHE_EXT), $this->stub); |
|
95 | - File::copy(base_path('scaffolder-config/cache/' . $this->cachePrefix . $fileToCompile->hash . self::CACHE_EXT), $path); |
|
94 | + File::put(base_path('scaffolder-config/cache/'.$this->cachePrefix.$fileToCompile->hash.self::CACHE_EXT), $this->stub); |
|
95 | + File::copy(base_path('scaffolder-config/cache/'.$this->cachePrefix.$fileToCompile->hash.self::CACHE_EXT), $path); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $path; |
@@ -121,27 +121,27 @@ discard block |
||
121 | 121 | return $this; |
122 | 122 | } |
123 | 123 | |
124 | - protected function getPrimaryKeyField(){ |
|
124 | + protected function getPrimaryKeyField() { |
|
125 | 125 | $primaryKey = new stdClass; |
126 | - $primaryKey->name = "id" ; |
|
127 | - $primaryKey->index = "primary" ; |
|
128 | - $primaryKey->declared = false ; |
|
129 | - $primaryKey->type = new stdClass ; |
|
130 | - $primaryKey->type->ui = 'label' ; |
|
131 | - $primaryKey->type->db = 'integer' ; |
|
126 | + $primaryKey->name = "id"; |
|
127 | + $primaryKey->index = "primary"; |
|
128 | + $primaryKey->declared = false; |
|
129 | + $primaryKey->type = new stdClass; |
|
130 | + $primaryKey->type->ui = 'label'; |
|
131 | + $primaryKey->type->db = 'integer'; |
|
132 | 132 | $primaryKey->foreignKey = []; |
133 | - $primaryKey->validations = "required" ; |
|
133 | + $primaryKey->validations = "required"; |
|
134 | 134 | |
135 | 135 | foreach ($this->modelData->fields as $field) |
136 | 136 | { |
137 | 137 | if ($field->index == 'primary') |
138 | 138 | { |
139 | - $primaryKey = $field ; |
|
139 | + $primaryKey = $field; |
|
140 | 140 | break; |
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | - return $primaryKey ; |
|
144 | + return $primaryKey; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return $this |
192 | 192 | */ |
193 | - protected function replaceForeingStrings($field, $originalStubPart){ |
|
193 | + protected function replaceForeingStrings($field, $originalStubPart) { |
|
194 | 194 | $replaceStub = str_replace('{{foreign_table}}', $field->foreignKey->table, $originalStubPart); |
195 | 195 | $replaceStub = str_replace('{{table_name}}', $this->modelData->tableName, $replaceStub); |
196 | 196 | $replaceStub = str_replace('{{foreign_field}}', $field->foreignKey->field, $replaceStub); |
197 | 197 | $replaceStub = str_replace('{{foreign_model}}', ucwords($field->foreignKey->table), $replaceStub); |
198 | 198 | $replaceStub = str_replace('{{field}}', $field->name, $replaceStub); |
199 | 199 | |
200 | - if(isset($this->scaffolderConfig->generator->namespaces)) |
|
200 | + if (isset($this->scaffolderConfig->generator->namespaces)) |
|
201 | 201 | $replaceStub = str_replace('{{model_namespace}}', $this->scaffolderConfig->generator->namespaces->models, $replaceStub); |
202 | 202 | |
203 | 203 | return $replaceStub; |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @return $this |
214 | 214 | */ |
215 | - protected function replaceFieldStrings($field, $originalStubPart){ |
|
215 | + protected function replaceFieldStrings($field, $originalStubPart) { |
|
216 | 216 | $replaceStub = str_replace('{{field}}', $field->name, $originalStubPart); |
217 | 217 | |
218 | - if($this->eagerTable) $this->eagerTable.'.' ; |
|
218 | + if ($this->eagerTable) $this->eagerTable.'.'; |
|
219 | 219 | |
220 | 220 | $replaceStub = str_replace('{{eager_table}}', $this->eagerTable, $replaceStub); |
221 | 221 | |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | * @return $this |
244 | 244 | */ |
245 | 245 | protected $modelDataArray = []; |
246 | - protected function getModelData($tableName){ |
|
246 | + protected function getModelData($tableName) { |
|
247 | 247 | |
248 | - if(array_key_exists($tableName, $this->modelDataArray)){ |
|
248 | + if (array_key_exists($tableName, $this->modelDataArray)) { |
|
249 | 249 | return $this->modelDataArray[$tableName]; |
250 | 250 | } |
251 | 251 | else { |
252 | 252 | |
253 | - $modelFilename = base_path('scaffolder-config/models/') . $tableName . '.json' ; |
|
253 | + $modelFilename = base_path('scaffolder-config/models/').$tableName.'.json'; |
|
254 | 254 | |
255 | 255 | $modelData = Json::decodeFile($modelFilename); |
256 | 256 | |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | $modelHash = md5_file($modelFilename); |
262 | 262 | |
263 | 263 | // Set model name |
264 | - $modelData->modelName = $modelName ; |
|
264 | + $modelData->modelName = $modelName; |
|
265 | 265 | |
266 | 266 | // Set model name |
267 | - $modelData->modelHash = $modelHash ; |
|
267 | + $modelData->modelHash = $modelHash; |
|
268 | 268 | |
269 | 269 | $this->modelDataArray[$tableName] = $modelData; |
270 | 270 |