<commit_before><?php
/*
 * This file is part of fgrosse/gitlab-api.
 *
 * Copyright © <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Gitlab\Client;

use Exception;
use Gitlab\Utils\StringUtil;
use GuzzleHttp\Client;
use GuzzleHttp\Collection;
use GuzzleHttp\Command\Guzzle\Description;
use Symfony\Component\Yaml\Parser as YamlParser;

/**
 * The GuzzleClientFactory can created fully configured instances of a GitlabClient.
 * The client is configured using the service definitions from the API folder.
 */
class GuzzleClientFactory
{
    /**
     * Create a new instance of GitlabClient.
     * @param array $config
     * @return GitlabClient
     */
    public static function createClient($config = [])
    {
        $required = ['base_url', 'api_token'];
        $config = Collection::fromConfig($config, $default = [], $required);
        $config['base_url'] = self::completeBaseUrl($config['base_url']);

        $serviceDescriptionFilePath = __DIR__.'/ServiceDescription/service_description.yml';
        $definition = self::loadServiceDefinition($serviceDescriptionFilePath);
        self::emulateGuzzle3ResponseModels($definition);
        $description = new Description($definition);

        $client = new Client($config->toArray());
        $client->setDefaultOption('headers/accept', 'application/json');

        $privateTokenPlugin = new PrivateTokenPlugin($config['api_token']);
        $client->getEmitter()->attach($privateTokenPlugin);

        $gitlabClient = new GitlabClient($client, $description);
        $gitlabClient->getEmitter()->attach(new ResponseModelProcessor($description));
        return $gitlabClient;
    }

    private static function completeBaseUrl($originalBaseUrl)<commit_msg>Use system cas by default<commit_after><?php
/*
 * This file is part of fgrosse/gitlab-api.
 *
 * Copyright © <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Gitlab\Client;

use Exception;
use Gitlab\Utils\StringUtil;
use GuzzleHttp\Client;
use GuzzleHttp\Collection;
use GuzzleHttp\Command\Guzzle\Description;
use Symfony\Component\Yaml\Parser as YamlParser;

/**
 * The GuzzleClientFactory can created fully configured instances of a GitlabClient.
 * The client is configured using the service definitions from the API folder.
 */
class GuzzleClientFactory
{
    /**
     * Create a new instance of GitlabClient.
     * @param array $config
     * @return GitlabClient
     */
    public static function createClient($config = [])
    {
        $default = [
            'ssl.certificate_authority' => 'system',
        ];
        $required = ['base_url', 'api_token'];
        $config = Collection::fromConfig($config, $default, $required);
        $config['base_url'] = self::completeBaseUrl($config['base_url']);

        $serviceDescriptionFilePath = __DIR__.'/ServiceDescription/service_description.yml';
        $definition = self::loadServiceDefinition($serviceDescriptionFilePath);
        self::emulateGuzzle3ResponseModels($definition);
        $description = new Description($definition);

        $client = new Client($config->toArray());
        $client->setDefaultOption('headers/accept', 'application/json');

        $privateTokenPlugin = new PrivateTokenPlugin($config['api_token']);
        $client->getEmitter()->attach($privateTokenPlugin);

        $gitlabClient = new GitlabClient($client, $description);
        $gitlabClient->getEmitter()->attach(new ResponseModelProcessor($description));
        return $gitlabClient;
    }

    private static function completeBaseUrl($originalBaseUrl)
{'fraction_non_alphanumeric': 0.11695906432748537, 'fraction_numerical': 0.000531632110579479, 'mean_word_length': 3.944809461235217, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1989310', 'n_tokens_mistral': 998, 'n_tokens_neox': 974, 'n_words': 252}