rudestan /
Teebot
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * Trait with methods to handle file uploads via CURL. |
||
| 5 | * |
||
| 6 | * @package Teebot (Telegram bot framework) |
||
| 7 | * |
||
| 8 | * @author Stanislav Drozdov <[email protected]> |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Teebot\Traits; |
||
| 12 | |||
| 13 | use Teebot\Entity\InputFile; |
||
| 14 | use \CURLFile; |
||
| 15 | |||
| 16 | trait File |
||
| 17 | { |
||
| 18 | protected $hasAttachedData = false; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Creates an InputFile instance for handling file uploads. |
||
| 22 | * |
||
| 23 | * @param string $file Full path to the file |
||
| 24 | * |
||
| 25 | * @return \CURLFile |
||
| 26 | */ |
||
| 27 | protected function initInputFile($file) |
||
| 28 | { |
||
| 29 | $inputFile = new InputFile($file); |
||
| 30 | $file = $inputFile->getFileForUpload(); |
||
| 31 | |||
| 32 | if ($file instanceof CURLFile) { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 33 | $this->hasAttachedData = ($file instanceof CURLFile); |
||
|
0 ignored issues
–
show
|
|||
| 34 | } |
||
| 35 | |||
| 36 | return $file; |
||
| 37 | } |
||
| 38 | } |
||
| 39 |