private function createUploadedFile(UploadedFileInterface $psrUploadedFile)
    {
        $temporaryPath = '';
        $clientFileName = '';
        if (UPLOAD_ERR_NO_FILE !== $psrUploadedFile->getError()) {
            $temporaryPath = $this->getTemporaryPath();
            $psrUploadedFile->moveTo($temporaryPath);

            $clientFileName = $psrUploadedFile->getClientFilename();
        }

        if (class_exists('Symfony\Component\HttpFoundation\HeaderUtils')) {
            // Symfony 4.1+
            return new UploadedFile(
                $temporaryPath,
                null === $clientFileName ? '' : $clientFileName,
                $psrUploadedFile->getClientMediaType(),
                $psrUploadedFile->getError(),
                true
            );
        }

        return new UploadedFile(
            $temporaryPath,
            null === $clientFileName ? '' : $clientFileName,
            $psrUploadedFile->getClientMediaType(),
            $psrUploadedFile->getSize(),
            $psrUploadedFile->getError(),
            true
        );
    }