File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 33namespace Eghamat24 \DatabaseRepository \Creators ;
44
55use Illuminate \Support \Collection ;
6- use Eghamat24 \DatabaseRepository \Commands \MakeEnum ;
76
87class CreatorEnum implements IClassCreator
98{
@@ -22,12 +21,14 @@ public function createAttributes(): array
2221 {
2322 $ attributes = [];
2423 foreach ($ this ->enum as $ _enum ) {
24+
2525 $ attributes [strtoupper ($ _enum )] = $ this ->writeAttribute (
2626 $ this ->attributeStub ,
2727 strtoupper ($ _enum ),
2828 $ _enum
2929 );
3030 }
31+
3132 return $ attributes ;
3233 }
3334
@@ -58,8 +59,11 @@ public function getClassName(): string
5859
5960 private function writeAttribute (string $ attributeStub , string $ attributeName , string $ attributeString ): string
6061 {
61- return str_replace (['{{ AttributeName }} ' , '{{ AttributeString }} ' ],
62- [$ attributeName , $ attributeString ],
63- $ attributeStub );
62+ $ replaceMapping = [
63+ '{{ AttributeName }} ' => $ attributeName ,
64+ '{{ AttributeString }} ' => $ attributeString ,
65+ ];
66+
67+ return str_replace (array_keys ($ replaceMapping ), array_values ($ replaceMapping ), $ attributeStub );
6468 }
6569}
You can’t perform that action at this time.
0 commit comments