code: private function getRedirectUriWithState(?string $state = null): string
      {
          if (null === $state) {
              return $this->redirectUri;
          }
  
          $sep = false === strpos($this->redirectUri, '?') ? '?' : '&';
  
          return $this->redirectUri.$sep.'state='.$state;
      }
docs: @param string|null $state
  
  @return string