You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a reason the string has to be put into the constructor, and the actual config happens at runtime?
It makes it difficult for DI and libraries/config to adjust the object ones in constructing and then using it.
Then you usually make the builder itself stateless and instead wrap statefulness internally.
$env = .. // Can contain all the filters and stuff$options = [
'xhtmlOutput' => true,
'strictMode' => false,
'escapeHtml' => true
];
// We can pass defaults here if we want$instance = newDecoda($env, $options);
// We can also set options here per convertion$html = $instance->convert($bbcodeText, $options);
$html2 = $instance->convert($bbcodeText2, $otherOptions);
What do you think?
There will also be no need for reset() then as it keeps the wrapper stateless and reuses the objects here.
The text was updated successfully, but these errors were encountered:
No strong reason that I remember. If I were to rewrite this now, I would most likely move the string to parse(), so that the same instance can be reused.
Is there a reason the string has to be put into the constructor, and the actual config happens at runtime?
It makes it difficult for DI and libraries/config to adjust the object ones in constructing and then using it.
If you look into e.g.
https://commonmark.thephpleague.com/1.5/extensions/github-flavored-markdown/
or https://github.com/kzykhys/Ciconia/blob/master/src/Ciconia/Ciconia.php#L42
Then you usually make the builder itself stateless and instead wrap statefulness internally.
What do you think?
There will also be no need for reset() then as it keeps the wrapper stateless and reuses the objects here.
The text was updated successfully, but these errors were encountered: