Hey Alexander!
2015-04-22 10:26 GMT+02:00 Alexander Moskalev irker@irker.net:
Jakub, I think about static factory methods, but not sure if it will be
great.
I think using empty constructor more clear.
So we can add a setter, which, however, will return $this, to allow
chaining and prevent one redundant line of code:
<?php
$fileBuffer = (new CURLFile)->setBuffer('some file contents');
// ($fileBuffer instanceof CURLFile) === true
But this looks a bit weird and for some people also confusing. Thus it
would be even better to have a static factory method, I think.
Best regards,
Kubo2
Hi!
I try rewrite feature to use exists class:
https://github.com/php/php-src/commit/6319f954ca0674c77bb1f8f8409c9ac841fe301d
Please, take a look at this commit.
- constructor does not require params
- added curl_buffer_file_create function (like curl_file_create)
- setters changed to allow binary data. May be it isn't good idea, but all
properties already have public access, so we can already set bad values. So
it just make common behavior for setters and manual setting properties. - If file name cast to true and contain a string - we use it.
- If it still cast to true, but contain not a string - we report error
- If file name cast to false - we use buffer
Please, check my commit and later I will create new pull request.
Thank you!
--
With regards, Alexander Moskalev
irker@irker.net
irker@php.net
a.moskalev@corp.badoo.com
Hi!
PR: https://github.com/php/php-src/pull/1283
--
With regards, Alexander Moskalev
irker@irker.net
irker@php.net
a.moskalev@corp.badoo.com