<commit_before><?php

class BaseCryptCookieSession implements BaseSessionInterface {

  /**
   * @var array
   */
  private $store = array();
  /**
   * @var IConfigReader
   */
  private $config;

  /**
   * @var string
   */
  private $cookie_name;

  /**
   * @param IConfigReader $config
   */
  public function __construct($config) {
    $this->config = $config;
    $this->decodeCryptCookie();

    $this->cookie_name = $this->config->get('cookie.name', 'SecureSessionCookie');
    if($this->config->get('cookie.encrypt_key', null) === null) {
      throw new BaseCryptCookieSessionException('Config key "cookie.encrypt_key" must be set!');
    }
  }

  /**
   * @param string $key
   * @param mixed $default Default value to return when key is not found
   * @return mixed
   */
  public function get($key, $default = null) {
    return array_key_exists($key, $this->store) ? $this->store[$key] : $default;
  }
<commit_msg>Fix: Decrypting the cookie before knowing its name is also stupid<commit_after><?php

class BaseCryptCookieSession implements BaseSessionInterface {

  /**
   * @var array
   */
  private $store = array();
  /**
   * @var IConfigReader
   */
  private $config;

  /**
   * @var string
   */
  private $cookie_name;

  /**
   * @param IConfigReader $config
   */
  public function __construct($config) {
    $this->config = $config;
    $this->cookie_name = $this->config->get('cookie.name', 'SecureSessionCookie');

    if($this->config->get('cookie.encrypt_key', null) === null) {
      throw new BaseCryptCookieSessionException('Config key "cookie.encrypt_key" must be set!');
    }
    
    $this->decodeCryptCookie();
  }

  /**
   * @param string $key
   * @param mixed $default Default value to return when key is not found
   * @return mixed
   */
  public function get($key, $default = null) {
    return array_key_exists($key, $this->store) ? $this->store[$key] : $default;
  }

{'fraction_non_alphanumeric': 0.1507563901930099, 'fraction_numerical': 0.0, 'mean_word_length': 3.2622222222222224, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '3609368', 'n_tokens_mistral': 610, 'n_tokens_neox': 595, 'n_words': 146}