private function checkArgs()

in src/Downloader.php [130:174]


    private function checkArgs(array &$context, Models\GetObjectRequest &$request, array &$args): array
    {
        $context = $this->filterArgs($args) + $this->options;

        if (!Validation::isValidBucketName(Utils::safetyString($request->bucket))) {
            throw new \InvalidArgumentException('invalid field, request.bucket.');
        }

        if (!Validation::isValidObjectName(Utils::safetyString($request->key))) {
            throw new \InvalidArgumentException('invalid field, request.key.');
        }

        // range
        $pos = 0;
        $epos = -1;
        if ($request->rangeHeader != null) {
            if ($this->client instanceof EncryptionClient) {
                throw new \InvalidArgumentException("encryption client does not support range.");
            }
            $vals = Utils::parseHttpRange($request->rangeHeader);
            if ($vals === false) {
                throw new \InvalidArgumentException("invalid field, request.rangeHeader.");
            }
            if ($vals[0] > 0) {
                $pos = $vals[0];
            }
            if ($vals[1] > 0) {
                $epos = $vals[1] + 1;
            }
        }
        $context['pos'] = $pos;
        $context['epos'] = $epos;

        if (Utils::safetyInt($context['part_size']) <= 0) {
            $context['part_size'] = Defaults::DEFAULT_PART_SIZE;
        }

        if (Utils::safetyInt($context['parallel_num']) <= 0) {
            $context['parallel_num'] = Defaults::DEFAULT_DOWNLOAD_PARALLEL;
        }

        $context['request'] = $request;

        return $context;
    }