<commit_before><?php
namespace Aws\Common;

/**
 * Handles backwards compatibility between v2 and v3 configuration settings.
 */
class Compat
{
    /** @var array Mapping of old option names to a conversion function. */
    private static $mapping = [
        'key' => 'convert_key',
        'secret' => 'convert_secret',
        'token' => 'convert_token',
        'credentials.client' => 'convert_credentials_client',
        'credentials.cache.key' => 'convert_credentials_cache_key',
        'base_url' => 'convert_base_url',
        'ssl.certificate_authority' => 'convert_ssl_certificate_authority',
        'curl.options' => 'convert_curl_options',
        'client.backoff.logger' => 'convert_client_backoff_logger',
        'command.params' => 'convert_command_params',
        'command.disable_validation' => 'convert_command_disable_validation'
    ];

    /**
     * Converts SDKv2 configuration options to SDKv3 configuration options.
     *
     * @param array $config Configuration array to convert by reference.
     */
    public function convertConfig(array &$config)
    {
        foreach (array_keys($config) as $key) {
            if (isset(self::$mapping[$key])) {
                $this->{self::$mapping[$key]}($config[$key], $config);
            }
        }
    }

    private function convert_key($value, array &$config)
    {
        $config['credentials']['key'] = $value;
        unset($config['key']);
    }

    private function convert_secret($value, array &$config)
    {
        $config['credentials']['secret'] = $value;
        unset($config['secret']);
    }

    private function convert_token($value, array &$config)
    {
        $config['credentials']['token'] = $value;
        unset($config['token'], $config['token.ttd']);
    }

    private function convert_credentials_client($value, array &$config)
    {
        unset($config['credentials.client']);
        trigger_error('credentials.client is no longer supported');
    }<commit_msg>Speeding up compat layer<commit_after><?php
namespace Aws\Common;

/**
 * Handles backwards compatibility between v2 and v3 configuration settings.
 */
class Compat
{
    /** @var array Mapping of old option names to a conversion function. */
    private static $mapping = [
        'key' => 'convert_key',
        'secret' => 'convert_secret',
        'token' => 'convert_token',
        'credentials.client' => 'convert_credentials_client',
        'credentials.cache.key' => 'convert_credentials_cache_key',
        'base_url' => 'convert_base_url',
        'ssl.certificate_authority' => 'convert_ssl_certificate_authority',
        'curl.options' => 'convert_curl_options',
        'client.backoff.logger' => 'convert_client_backoff_logger',
        'command.params' => 'convert_command_params',
        'command.disable_validation' => 'convert_command_disable_validation'
    ];

    /**
     * Converts SDKv2 configuration options to SDKv3 configuration options.
     *
     * @param array $config Configuration array to convert by reference.
     */
    public function convertConfig(array &$config)
    {
        foreach ($config as $key => $value) {
            if (isset(self::$mapping[$key])) {
                $this->{self::$mapping[$key]}($value, $config);
            }
        }
    }

    private function convert_key($value, array &$config)
    {
        $config['credentials']['key'] = $value;
        unset($config['key']);
    }

    private function convert_secret($value, array &$config)
    {
        $config['credentials']['secret'] = $value;
        unset($config['secret']);
    }

    private function convert_token($value, array &$config)
    {
        $config['credentials']['token'] = $value;
        unset($config['token'], $config['token.ttd']);
    }

    private function convert_credentials_client($value, array &$config)
    {
        unset($config['credentials.client']);
        trigger_error('credentials.client is no longer supported');
    }
{'fraction_non_alphanumeric': 0.14278506559031282, 'fraction_numerical': 0.0020181634712411706, 'mean_word_length': 3.005050505050505, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '77006', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1107, 'n_words': 234}