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;
    }
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;
    }
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 ; }
Check if the given TelegramMethod should be handled as a multipart.

@param TelegramMethods $method
@return array
Check if the given TelegramMethod should be handled as a multipart .