mirror of
https://github.com/flarum/framework.git
synced 2025-02-19 07:13:24 +08:00
31 lines
627 B
PHP
31 lines
627 B
PHP
<?php namespace Flarum\Core\Commands;
|
|
|
|
use RuntimeException;
|
|
|
|
class UploadAvatarCommand
|
|
{
|
|
public $userId;
|
|
|
|
/**
|
|
* @var \Symfony\Component\HttpFoundation\File\UploadedFile
|
|
*/
|
|
public $file;
|
|
|
|
public $actor;
|
|
|
|
public function __construct($userId, $file, $actor)
|
|
{
|
|
if (empty($userId) || !intval($userId)) {
|
|
throw new RuntimeException('No valid user ID specified.');
|
|
}
|
|
|
|
if (is_null($file)) {
|
|
throw new RuntimeException('No file to upload');
|
|
}
|
|
|
|
$this->userId = $userId;
|
|
$this->file = $file;
|
|
$this->actor = $actor;
|
|
}
|
|
}
|