Re: PR 1217: Add support for upload files from buffer string in curl extenion
| From: | Jakub Kubíček | Date: | Sun, 26 Apr 2015 15:33:15 +0000 |
| Subject: | Re: PR 1217: Add support for upload files from buffer string in curl extenion | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-85952@lists.php.net to get a copy of this message | ||
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