touhidurabir / laravel-stub-generator

A laravel package to generate class files from stub files.
MIT License
53 stars 10 forks source link

[Feature Request]: Allow for repeater placeholder #7

Closed nicolasbinet closed 2 years ago

nicolasbinet commented 2 years ago

Feature Description

This would be useful for classes or templates where code is being repeated and placeholders non foreseeable.

Is this feature valuable for other users as well and why?

No response

touhidurabir commented 2 years ago

code is being repeated and placeholders non foreseeable.

@nicolasbinet I am bit confused about the feature . Can you provide any pseudo code example and use can for it ?

nicolasbinet commented 2 years ago

@touhidurabir My idea was to support @repeat features in the stub file.

After some thoughts, we implemented it differently. We needed to create dynamic classes with multiple almost identical methods, based on a single template. We created a specific template for the methods, that we looped through with your lib, saved toString(), concatenated the results, and replace in our code. Almost as simple.

Thanks for taking the time to answer this feature request. This can be closed if you wish.

touhidurabir commented 2 years ago

Thanks for the update .