Kit-PHPEncoder icon indicating copy to clipboard operation
Kit-PHPEncoder copied to clipboard

Comments

Open hiqsol opened this issue 5 years ago • 2 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!

hiqsol avatar Aug 24 '18 07:08 hiqsol

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).

Riimu avatar Oct 10 '18 10:10 Riimu

Cool. Thank you!

Going 7.1 is a good idea in any case!

hiqsol avatar Oct 10 '18 12:10 hiqsol