. * * @author Daniil Gentili * @copyright 2016-2023 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto; /** * File callback interface. */ final class FileCallback implements FileCallbackInterface { /** * Callback. * * @var callable */ private $callback; /** * Construct file callback. * * @param mixed $file File to download/upload * @param callable $callback Callback */ public function __construct(private mixed $file, callable $callback) { $this->file = $file; $this->callback = $callback; } /** * Get file. */ public function getFile(): mixed { return $this->file; } public function __invoke(float $percent, float $speed, float $time): void { $callback = $this->callback; $callback($percent, $speed, $time); } }