-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Valid use for Lightncandy::prepare() #346
Comments
Completely agree with brunobg. I use this to dynamically generate an email that is used once. LightnCandy is a much better parser than other frameworks/plugins and is perfect for this use. Caching the file is not necessary since it is only ever used once. |
The prepare function is doing exact the same things. Write it to a temp file and include the code. See lightncandy/src/LightnCandy.php Lines 152 to 157 in 5f8dc54
|
Exactly. It's more convenient to call |
You could create a small function or Helper class and copy the prepare method in case you need it. This will ensure that you have to the control. And I meant that prepare is doing exactly what robentwist said is not necessary. |
Why do you have to remove a feature that works, people want it, and does exactly what you're proposing putting into an outside class? |
Sure, I could also re-implement substr() to ensure I have control and add to a Helper class. Should I? No.
To be pedantic, it's not cached with prepare(). Caching means storing it. You use a temporary file that is deleted as soon as the function returns. If I can't used it twice, it's not cached.
Can't put it better than @robentwist did. And as @danmcadams said, it's not like you don't use the function all over the docs, too. More time was spent discussing this issue than accepting a trivial one-line patch that corrects the |
Regarding
Lightncandy::prepare()
and #323: lightncandy can be used for dynamic code or documentation generation at compile time execution, which will only run once and therefore there's no gain in caching to a file. So prepare() is not a good idea for most use cases, but definitely good for this case, as saving PHP code to a file to include it is cumbersome.Even if the
@deprecate
annotation is kept, I suggest at least the@return
type fix.The text was updated successfully, but these errors were encountered: