original_string: public static function createFromConfig($config, $rpcHelper = null) {
      $clientId = $config['clientId'];
      $projectId = $config['projectId'];
      if (!isset($clientId) && !isset($projectId)) {
        throw new Gitkit_ClientException("Missing projectId or clientId in server configuration.");
      }
      if (!isset($config['widgetUrl'])) {
        throw new Gitkit_ClientException("\"widgetUrl\" should be configured");
      }
      if (isset($config["cookieName"])) {
        $cookieName = $config['cookieName'];
      } else {
        $cookieName = self::$DEFAULT_COOKIE_NAME;
      }
      if (!$rpcHelper) {
        if (!isset($config['serviceAccountEmail'])) {
          throw new Gitkit_ClientException(
              "\"serviceAccountEmail\" should be configured");
        }
        if (!isset($config['serviceAccountPrivateKeyFile'])) {
          throw new Gitkit_ClientException(
              "\"serviceAccountPrivateKeyFile\" should be configured");
        }
        $p12Key = file_get_contents($config["serviceAccountPrivateKeyFile"]);
        if ($p12Key === false) {
          throw new Gitkit_ClientException(
              "Can not read file " . $config["serviceAccountPrivateKeyFile"]);
        }
        if (isset($config['serverApiKey'])) {
          $serverApiKey = $config['serverApiKey'];
        } else {
          $serverApiKey = null;
        }
        $rpcHelper = new Gitkit_RpcHelper(
            $config["serviceAccountEmail"],
            $p12Key,
            self::$GITKIT_API_BASE,
            new Google_Auth_OAuth2(new Google_Client()),
            $serverApiKey);
      }
      return new Gitkit_Client($clientId, $config['widgetUrl'],
          $cookieName, $rpcHelper, $projectId);
    }
code: public static function createFromConfig($config, $rpcHelper = null) {
      $clientId = $config['clientId'];
      $projectId = $config['projectId'];
      if (!isset($clientId) && !isset($projectId)) {
        throw new Gitkit_ClientException("Missing projectId or clientId in server configuration.");
      }
      if (!isset($config['widgetUrl'])) {
        throw new Gitkit_ClientException("\"widgetUrl\" should be configured");
      }
      if (isset($config["cookieName"])) {
        $cookieName = $config['cookieName'];
      } else {
        $cookieName = self::$DEFAULT_COOKIE_NAME;
      }
      if (!$rpcHelper) {
        if (!isset($config['serviceAccountEmail'])) {
          throw new Gitkit_ClientException(
              "\"serviceAccountEmail\" should be configured");
        }
        if (!isset($config['serviceAccountPrivateKeyFile'])) {
          throw new Gitkit_ClientException(
              "\"serviceAccountPrivateKeyFile\" should be configured");
        }
        $p12Key = file_get_contents($config["serviceAccountPrivateKeyFile"]);
        if ($p12Key === false) {
          throw new Gitkit_ClientException(
              "Can not read file " . $config["serviceAccountPrivateKeyFile"]);
        }
        if (isset($config['serverApiKey'])) {
          $serverApiKey = $config['serverApiKey'];
        } else {
          $serverApiKey = null;
        }
        $rpcHelper = new Gitkit_RpcHelper(
            $config["serviceAccountEmail"],
            $p12Key,
            self::$GITKIT_API_BASE,
            new Google_Auth_OAuth2(new Google_Client()),
            $serverApiKey);
      }
      return new Gitkit_Client($clientId, $config['widgetUrl'],
          $cookieName, $rpcHelper, $projectId);
    }
code_tokens: public static function createFromConfig ( $ config , $ rpcHelper = null ) { $ clientId = $ config [ 'clientId' ] ; $ projectId = $ config [ 'projectId' ] ; if ( ! isset ( $ clientId ) && ! isset ( $ projectId ) ) { throw new Gitkit_ClientException ( "Missing projectId or clientId in server configuration." ) ; } if ( ! isset ( $ config [ 'widgetUrl' ] ) ) { throw new Gitkit_ClientException ( "\"widgetUrl\" should be configured" ) ; } if ( isset ( $ config [ "cookieName" ] ) ) { $ cookieName = $ config [ 'cookieName' ] ; } else { $ cookieName = self :: $ DEFAULT_COOKIE_NAME ; } if ( ! $ rpcHelper ) { if ( ! isset ( $ config [ 'serviceAccountEmail' ] ) ) { throw new Gitkit_ClientException ( "\"serviceAccountEmail\" should be configured" ) ; } if ( ! isset ( $ config [ 'serviceAccountPrivateKeyFile' ] ) ) { throw new Gitkit_ClientException ( "\"serviceAccountPrivateKeyFile\" should be configured" ) ; } $ p12Key = file_get_contents ( $ config [ "serviceAccountPrivateKeyFile" ] ) ; if ( $ p12Key === false ) { throw new Gitkit_ClientException ( "Can not read file " . $ config [ "serviceAccountPrivateKeyFile" ] ) ; } if ( isset ( $ config [ 'serverApiKey' ] ) ) { $ serverApiKey = $ config [ 'serverApiKey' ] ; } else { $ serverApiKey = null ; } $ rpcHelper = new Gitkit_RpcHelper ( $ config [ "serviceAccountEmail" ] , $ p12Key , self :: $ GITKIT_API_BASE , new Google_Auth_OAuth2 ( new Google_Client ( ) ) , $ serverApiKey ) ; } return new Gitkit_Client ( $ clientId , $ config [ 'widgetUrl' ] , $ cookieName , $ rpcHelper , $ projectId ) ; }
docstring: Creates a Gitkit client from the config array.
  
  @param array $config config parameters
  @param null|Gitkit_RpcHelper $rpcHelper Gitkit Rpc helper object
  @return Gitkit_Client created Gitkit client
  @throws Gitkit_ClientException if required config is missing
docstring_tokens: Creates a Gitkit client from the config array .