Skip to content
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

Feature Proposal: Serialize and Unserialize of a QR-string #36

Open
kohlerdominik opened this issue Apr 20, 2020 · 3 comments
Open

Feature Proposal: Serialize and Unserialize of a QR-string #36

kohlerdominik opened this issue Apr 20, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@kohlerdominik
Copy link
Contributor

My apologies for a lot of noise from me the last few days. We just started working on the QR-Bill implementation.

I am currently writing our specification of the feature, and came to the conclusion, that it could make sense to store and restore the QR-Code content instead of creating it from data every time.

Since PHP 7.4 we could wrap it in __serialize and __unserialize, but I think that's not what it's intentional use is (for me php-serialize is more technical, while this seems Domain Knowledge).

Therefore, I think getContentString() and parseContentString($string) could make more sense.

I would be happy to work out a PR to add this on occasion. But maybe there's already a similar feature implemented I'm missing here? Or are there some specific reason that it's not supported in the first place?

@sprain
Copy link
Owner

sprain commented Apr 20, 2020

My apologies for a lot of noise from me the last few days. We just started working on the QR-Bill implementation.

No problem. I am glad the library is helpful for you and feedback is always welcome.

I am currently writing our specification of the feature, and came to the conclusion, that it could make sense to store and restore the QR-Code content instead of creating it from data every time.

What already works is to get the actual contents of the qr code image with $qrBill->getQrCode()->getText();. This contains all necessary information as this is what the bank gets as well. I can see the benefit of creating the whole domain model by injecting such a string and then (re)create outputs from that. Such an approach would also allow to use the library to read data from existing qr bills (for example as a receiver of bills).

I'd suggest an integration like this:

// Serialize
$existingQrBillString = $qrBill->getQrString(); // internally doing $qrBill->getQrCode()->getText();

// Deserialize
$newQrBill = QrBill::createFromQrString($existingQrBillString); // this needs to be built

Would this cover your use case or did you have something else in mind?

@kohlerdominik
Copy link
Contributor Author

Yes, this covers exactly my idea here. The shortcut getQrString() makes sense to me, as it seems more obvious on the QrBill class. But createFromQrString could be quite some work.

From your comment I didn't understand if you suggest how I should implement it, or if you plan to add the feature yourself. As said, i can try to work on it, but i can't estimate when it would be ready, as i neither know how long it will take nor how much time i can spend on it within the next weeks.

@sprain
Copy link
Owner

sprain commented Apr 20, 2020

From your comment I didn't understand if you suggest how I should implement it, or if you plan to add the feature yourself. As said, i can try to work on it, but i can't estimate when it would be ready, as i neither know how long it will take nor how much time i can spend on it within the next weeks.

I cannot tell whether I will have time for this in the next few weeks. So I suggest, we leave it pending here and if anybody wants to start working on it, they hopefully will let us know :)

@sprain sprain added the enhancement New feature or request label Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants