Check if the given TelegramMethod should be handled as a multipart.

@param TelegramMethods $method
@return array
772651
private function checkIsMultipart(TelegramMethods $method): array
    {
        $this->logger->debug('Checking whether to apply special conditions to this request');
        $method->performSpecialConditions();

        $return = [];

        foreach ($method as $key => $value) {
            if ((\is_object($value) && $value instanceof InputFile)||(\is_object($value) && $value instanceof Photo)||((is_array($value) || $value instanceof Countable) && \count($value)>1 && (reset($value) instanceof InputFile||reset($value) instanceof Photo))) {
                $this->logger->debug('About to send a file, so changing request to use multi-part instead');
                // If we are about to send a file, we must use the multipart/form-data way
                $this->formType = 'multipart/form-data';
                if($value instanceof InputFile){
                  $return[$key] = [
                      'id' => $key,
                      'filename' => $value->path,
                      'stream' => $value->getStream()
                  ];
                }elseif($value instanceof Photo){
                   $return[$key] = [
                      'id' => $key,
                      'filename' => $value->media->path,
                      'stream' => $value->media->getStream()
                  ];
                }elseif((is_array($value) || $value instanceof Countable)){
                  foreach ($value as $kk => $vv){
                  if($vv instanceof InputFile){
                   $return[$kk] = [
                      'id' => $kk,
                      'filename' => $vv->path,
                      'stream' => $vv->getStream()
                  ];
                }elseif($vv instanceof Photo){
                    $return[$kk] = [
                      'id' => $kk,
                      'filename' => $vv->media->path,
                      'stream' => $vv->media->getStream()
                  ];
                  }
                  }
                }
            }
        }

        return $return;
    }
1174676
protected function getMethodParameters($method, $docBlock = null): array
    {
        $result = [];

        /** @var \ReflectionParameter $param */
        foreach ($method->getParameters() as $param) {
            $parameter = new SmdParameter();
            $parameter->name = $param->getName();
            if (PHP_VERSION_ID > 70000) {
                $parameter->types = [(string)$param->getType()];
            }
            $parameter->optional = $param->isOptional();
            if ($parameter->optional) {
                $parameter->default = $param->getDefaultValue();
            }

            $result[$param->getName()] = $parameter;
        }

        if ($docBlock === null) {
            return array_values($result);
        }

        $params = $docBlock->getTagsByName(self::API_METHOD_DEFAULT_PARAMS);

        /** @var DocBlock\Tags\Param $param */
        foreach ($params as $param) {
            $name = (string)$param->getVariableName();

            $parameter = $result[$name] ?? new SmdParameter();
            $parameter->name = $name;

            if (!empty((string)$param->getDescription())) {
                $parameter->description = (string)$param->getDescription();
            }
            if (!empty((string)$param->getType())) {
                $parameter->types = explode('|', (string)$param->getType());
            }

            $result[$name] = $parameter;
        }

        /** @var ApiParam[] $params */
        $params = $docBlock->getTagsByName(self::API_METHOD_PARAMS);

        foreach ($params as $param) {
            $result = $this->getExtendedParameters($param, $result);
        }

        return array_values($result);
    }
1302420
public function checkToken($method = 'post') {
        $token = $this->getFormToken();

        if (!$this->input->$method->get($token, '', 'alnum')) {
            if ($this->getSession()->isNew()) {
                // Redirect to login screen.
                $this->redirect('/login');
                $this->close();
            }

            return false;
        }

        return true;
    }
53445
private function getMethods($methods)
    {
        $methods = $methods ?? $this->methods;

        if (is_string($methods))
            $methods = (array) $methods;

        return is_array($methods) ? array_map('strtoupper', $methods) : [];
    }
273703
function _process_submission($method) {
        $submission = array();
        if (!empty($this->_ajaxformdata)) {
            $submission = $this->_ajaxformdata;
        } else if ($method == 'post') {
            if (!empty($_POST)) {
                $submission = $_POST;
            }
        } else {
            $submission = $_GET;
            merge_query_params($submission, $_POST); // Emulate handling of parameters in xxxx_param().
        }

        // following trick is needed to enable proper sesskey checks when using GET forms
        // the _qf__.$this->_formname serves as a marker that form was actually submitted
        if (array_key_exists('_qf__'.$this->_formname, $submission) and $submission['_qf__'.$this->_formname] == 1) {
            if (!confirm_sesskey()) {
                print_error('invalidsesskey');
            }
            $files = $_FILES;
        } else {
            $submission = array();
            $files = array();
        }
        $this->detectMissingSetType();

        $this->_form->updateSubmission($submission, $files);
    }
1091240
protected static function checkMethods($value, $method)
    {
        $valid = false;
        if ($value === 'AJAX' && self::isAjax() && $value === $method) {
            $valid = true;
        } elseif ($value === 'AJAXP' && self::isAjax() && $method === 'POST') {
            $valid = true;
        } elseif (in_array($value, explode('|', self::$validMethods)) && ($value === $method || $value === 'ANY')) {
            $valid = true;
        }

        return $valid;
    }
1102049
protected function getMethodPartAndVerb($method)
    {
        preg_match($this->methodRule, $method, $matches);

        return empty($matches) ? false : array_slice($matches, 1);
    }
1277951
protected function getJsMethod($method)
    {
        $methods = [
            'get' => 'read',
            'post' => 'create',
            'put' => 'update',
            'delete' => 'delete',
        ];
        return isset($methods[strtolower($method)]) ? $methods[strtolower($method)] : 'read';
    }
711772
public function contains(string $key, string $method = null):bool {
		if(is_null($method)) {
			$method = self::DATA_COMBINED;
		}

		switch($method) {
		case self::DATA_QUERYSTRING:
			$isset = $this->containsQueryStringParameter($key);
			break;

		case self::DATA_BODY:
			$isset =$this->containsBodyParameter($key);
			break;

		case self::DATA_FILES:
			$isset =$this->containsFile($key);
			break;

		case self::DATA_COMBINED:
			$isset = isset($this->parameters[$key]);
			break;

		default:
			throw new InvalidInputMethodException($method);
		}

		return $isset;
	}
223889
public function isValidHttpMethod($method)
    {
        $method = strtoupper($method);

        if (in_array('ANY', $this->methods)) {
            return true;
        }

        return (bool)in_array($method, $this->methods);
    }
1119570
private function checkMethod(Request $request, $method)
    {
        if(Text::isEmpty($method))
        {
            return true;
        }
        else if(is_array($method))
        {
            return in_array($request->getMethod(), $method);
        }
        else
        {
            return $method === $request->getMethod();
        }
    }
1238857
private function callMethod($method, $params)
    {
        $params['chat_id'] = Conversation::get('lead_id');

        return giga_remote_post($this->getResource($method), $params);
    }
745993
private function getMethodCallbacks(\ReflectionMethod $method)
    {
        $callbacks   = array();
        $annotations = $this->reader->getMethodAnnotations($method);

        foreach ($annotations as $annot) {
            if ($annot instanceof \Doctrine\ORM\Mapping\PrePersist) {
                $callbacks[] = array($method->name, Events::prePersist);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostPersist) {
                $callbacks[] = array($method->name, Events::postPersist);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PreUpdate) {
                $callbacks[] = array($method->name, Events::preUpdate);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostUpdate) {
                $callbacks[] = array($method->name, Events::postUpdate);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PreRemove) {
                $callbacks[] = array($method->name, Events::preRemove);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostRemove) {
                $callbacks[] = array($method->name, Events::postRemove);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PostLoad) {
                $callbacks[] = array($method->name, Events::postLoad);
            }

            if ($annot instanceof \Doctrine\ORM\Mapping\PreFlush) {
                $callbacks[] = array($method->name, Events::preFlush);
            }
        }

        return $callbacks;
    }
1276874
private static function getMethodClass($method)
    {
        Assertion::true(self::isAlgorithmSupported($method), sprintf('Compression method "%s" is not supported.', $method));

        return self::getSupportedMethods()[$method];
    }
689655
private function validateHttpMethods(array $methods): array
    {
        if (empty($methods)) {
            throw new InvalidArgumentException(
                'HTTP methods argument was empty; must contain at least one method'
            );
        }
        if (false === array_reduce($methods, function ($valid, $method) {
            if (false === $valid) {
                return false;
            }
            if (! is_string($method)) {
                return false;
            }
            //if (! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
            if (! preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method)) {
                return false;
            }

            return $valid;
        }, true)) {
            throw new InvalidArgumentException('One or more HTTP methods were invalid');
        }

        return array_map('strtoupper', $methods);
    }
357073
private static function validate_method( $method ) {

		if ( $method && isset( $method[0] ) && isset( $method[1] ) ) {
			if ( method_exists( $method[0], $method[1] ) ) {
				return true;
			}
		}

		return false;
	}
953185
protected function getRequestDataByMethod($method = HttpMethods::GET)
    {
        switch ($method) {
            // POST method
            case HttpMethods::POST:
                $postData = array_merge($_GET, $_POST);
                return $postData ?: [];
                break;
            // PUT method
            case HttpMethods::PUT:
            // PATH method
            case HttpMethods::PATCH:
                $data = $this->cypher->decode(file_get_contents('php://input'));
                parse_str($data, $patchData);
                $patchData = array_merge($_GET, $patchData);
                return $patchData ?: [];
                break;

            // methods with empty payload
            case HttpMethods::DELETE:
            case HttpMethods::HEAD:
            case HttpMethods::OPTIONS:
                return [];
                break;

            // GET method (default)
            case HttpMethods::GET:
            default:
                return $_GET;
                break;
        }
    }