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 3
3
namespace Eghamat24 \DatabaseRepository \Creators ;
4
4
5
5
use Illuminate \Support \Collection ;
6
- use Eghamat24 \DatabaseRepository \Commands \MakeEnum ;
7
6
8
7
class CreatorEnum implements IClassCreator
9
8
{
@@ -22,12 +21,14 @@ public function createAttributes(): array
22
21
{
23
22
$ attributes = [];
24
23
foreach ($ this ->enum as $ _enum ) {
24
+
25
25
$ attributes [strtoupper ($ _enum )] = $ this ->writeAttribute (
26
26
$ this ->attributeStub ,
27
27
strtoupper ($ _enum ),
28
28
$ _enum
29
29
);
30
30
}
31
+
31
32
return $ attributes ;
32
33
}
33
34
@@ -58,8 +59,11 @@ public function getClassName(): string
58
59
59
60
private function writeAttribute (string $ attributeStub , string $ attributeName , string $ attributeString ): string
60
61
{
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 );
64
68
}
65
69
}
You can’t perform that action at this time.
0 commit comments