Integration with symfony/string for better strings manipulation
That would be very helpful integration from text processing point of view.
Library: https://github.com/symfony/string
It should be pretty straightforward since we would just need to create a scalar function for each of the methods string methods.
I think we can make it a part of TextAdapter, just put all scalar functions inside of it.
~All those functions should be also added to TextAdapter DSL functions, with a text_ prefix.~
Those functions should exist in the src/core/etl/src/Flow/ETL/Function namespace and be part of the core ETL.
We don't even need to create for them dedicated DSL functions (as they can only operate on string), what we can do is simply expose them through src/core/etl/src/Flow/ETL/Function/ScalarFunctionChain.php so they would all be available through ref()->xxxx
Documentation: How to create scalar function
How does it differ from Symfony String?
Interesting, I would need to go through entire APIs of both libs to understand which one provides more value. symfony/string comes with some dependencies, that's one thing. However to provide more text manipulation options we should also take a look at https://github.com/voku/portable-utf8
So the question is what makes more sense, portable-ascii + portable-utf8 or symfony/string?
I asked GitHub copilot which one we should use and he said symfony/string but without any good justification 😅 I wouldn't trust it, comparing the APIs - that's what we need to do first
https://symfony.com/doc/current/string.html#methods-to-change-case just noticed that symfony/string can also replace an existing case converting dependency. So I guess we have our answer about which library to use
This is an example of how easy it is to create Scalar Functions: https://github.com/flow-php/flow/pull/1337
With recent PRs:
- #1635,
- #1617,
- #1607
I would say that this could be considered as done, no?
I would say that this could be considered as done, no?
Hmm the initial idea was to cover all functions from String Component by scalar functions, so I guess we are still missing few but I need to spend some time, go through list of functions and list what we already have and what we are still missing