code: public function setEndpoint($endpoint)
      {
          if (!filter_var($endpoint, FILTER_VALIDATE_URL)) {
              throw new InvalidArgumentException(
                  sprintf(
                      'Not an url: %s',
                      $endpoint
                  )
              );
          }
          $parts          = parse_url($endpoint);
          $this->endpoint = sprintf('%s://%s', $parts['scheme'], $parts['host']);
      }
docs: @param string $endpoint
  
  @throws InvalidArgumentException