Kit-PHPEncoder
Kit-PHPEncoder copied to clipboard
Comments
I have a specific need, can it be implemented in this library?
I want to have dumped array with comments like this:
return [
'a' => [
'a1' => 'one', /// from file-a
],
'b' => [
'b2' => 'two', /// from file-b
],
];
It could be implemented with providing callback:
public function commentsCallback(array $keys, $value) {
/// example, actual logic will be other
if ($keys == ['a','a1'] and $value === 'one') return 'from file a';
/// ....
return null;
}
Thanks in advance!
I don't think this is necessarily a bad idea, but the implementation could be a bit tricky.
I will look into implementing this, if I end up doing a bigger refactoring once PHP 5.6 and 7.0 goes EOL (and I will most likely bump the minimum requirement to 7.1).
Cool. Thank you!
Going 7.1 is a good idea in any case!