<commit_before><?php
namespace mharj;

class HttpRequest {
  private $headers = array();
  protected function __construct() {
    $this->headers = getallheaders();
  }
  
  public function getHeaderNames(): array {
    return array_keys($this->headers);
  }
  
  public function getHeader(string $name) {
    $lh = array_change_key_case($this->headers, CASE_LOWER);
    if ( array_key_exists(strtolower($name),$lh) ) {
      return $lh[strtolower($name)];
    }
    return null;
  }
  
  public function containsHeader(string $name): bool {
    return array_key_exists(strtolower($name),array_change_key_case($this->headers, CASE_LOWER));
  }
  
  public static function getServerHttpRequest() {
    if ( defined('HHVM_VERSION') ) {
      return new HhvmHttpRequest();
    }
    if( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) {
      return new ApacheHttpRequest();
    } 
    return new CommonHttpRequest();
  }
}<commit_msg>Update HttpRequest.php<commit_after><?php
namespace mharj;

class HttpRequest {
  private $headers = array();
  protected function __construct() {
    $this->headers = getallheaders();
  }
  
  public function getHeaderNames(): array {
    return array_keys($this->headers);
  }
  
  public function getHeader(string $name) {
    $lh = array_change_key_case($this->headers, CASE_LOWER);
    if ( array_key_exists(strtolower($name),$lh) ) {
      return $lh[strtolower($name)];
    }
    return null;
  }
  
  public function containsHeader(string $name): bool {
    return array_key_exists(strtolower($name),array_change_key_case($this->headers, CASE_LOWER));
  }
  
  public static function getServerHttpRequest() {
    if ( defined('HHVM_VERSION') ) {
      return new HhvmHttpRequest();
    }
    if( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) {
      return new ApacheHttpRequest();
    }
    if ( php_sapi_name() === 'cli' )  {
      return new CliHttpRequest();
    }
    return new CommonHttpRequest();
  }
}
{'fraction_non_alphanumeric': 0.13444951801116184, 'fraction_numerical': 0.0, 'mean_word_length': 3.8097560975609754, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3906165', 'n_tokens_mistral': 635, 'n_tokens_neox': 624, 'n_words': 127}