| File: UploadedFile.php Lines 30 to 49 | 
|  | 30 | private $stream; | 
|  | 31 |  | 
|  | 32 | /** | 
|  | 33 | * @param string|resource|\Psr\Http\Message\StreamInterface $streamOrFile | 
|  | 34 | * @param int $size UPLOAD_ERR_* constant | 
|  | 35 | * @param int $errorCode | 
|  | 36 | * @param string $clientFilename | 
|  | 37 | * @param string $clientMediaType | 
|  | 38 | */ | 
|  |  | public function __construct($streamOrFile, $size, $errorCode, $clientFilename=null, $clientMediaType=null) { | 
|  | 40 | if($errorCode === UPLOAD_ERR_OK) { | 
|  | 41 | if(is_string($streamOrFile)) { | 
|  | 42 | $this->file = $streamOrFile; | 
|  | 43 | } elseif(is_resource($streamOrFile)) { | 
|  | 44 | $this->stream = new Stream($streamOrFile); | 
|  | 45 | } elseif($streamOrFile instanceof \Psr\Http\Message\StreamInterface) { | 
|  | 46 | $this->stream = $streamOrFile; | 
|  | 47 | } else { | 
|  | 48 | throw new \InvalidArgumentException('Invalid stream or file provided for UploadedFile'); | 
|  | 49 | } | 
|  | 
| File: UploadedFile.php Lines 69 to 88 | 
|  | 69 | } | 
|  | 70 | $this->clientMediaType = $clientMediaType; | 
|  | 71 | } | 
|  | 72 |  | 
|  | 73 | /** | 
|  | 74 | * $_FILES の1件分から作成する | 
|  | 75 | * @param array $file | 
|  | 76 | * @return \Puyo\Psr7\UploadedFile | 
|  | 77 | */ | 
|  |  | public static function createBy_FILE(array $file) { | 
|  | 79 | return new UploadedFile($file['tmp_name'], $file['size'], $file['error'], $file['name'], $file['type']); | 
|  | 80 | } | 
|  | 81 |  | 
|  | 82 | /** | 
|  | 83 | * {@inheritdoc} | 
|  | 84 | * @return \Psr\Http\Message\StreamInterface | 
|  | 85 | * @throws \RuntimeException if the upload was not successful. | 
|  | 86 | */ | 
|  | 87 | public function getStream() { | 
|  | 88 | if(!$this->isUploadOk()) { | 
|  |