<commit_before><?php

class load
{
  public static $config = array();

  private static $custom_timers = array();


  /*
  |--------------------------------------------------------------------------
  | Configuration methods
  |--------------------------------------------------------------------------
  */

  # Get config variable
  public static function &get($name)
  {
    return self::$config[$name];
  }



  # Set config variable
  public static function set($name, $value)
  {
    return (self::$config[$name] = $value);
  }



  # Merge config variable
  public static function merge($name, $value, $owerwrite = TRUE)
  {
    if (!isset(self::$config[$name]))
    {
      return (self::$config[$name] = $value);
    }

    switch (true)
    {
      case is_array(self::$config[$name]):
        if (empty($owerwrite))
        {
          return (self::$config[$name] += $value);
        }
        else
        {
          return (self::$config[$name] = array_merge((array)self::$config[$name], (array)$value));
        }
      break;

      case is_object(self::$config[$name]):
        if (empty($owerwrite))
        {
          return (self::$config[$name] = (object)((array)self::$config[$name] + (array)$value));
        }
        else
        {
          return (self::$config[$name] = (object)array_merge((array)self::$config[$name], (array)$value));
        }
      break;

      case is_int(self::$config[$name]):
      case is_float(self::$config[$name]):
        return (self::$config[$name] += $value);
      break;

      case is_string(self::$config[$name]):
      default:
        return (self::$config[$name] .= $value);
      break;
    }
  }




  /*
  |--------------------------------------------------------------------------
  | File Loadings
  |--------------------------------------------------------------------------
  */

  # Load config files
  public static function config($files)
  {
    $config =& self::$config;
    foreach ((array) $files as $name)
    {
      include APP_PATH .'config/'. $name .'.php';
    }
  }


  # Load models
  public static function model($files)
  {
    foreach ((array) $files as $name)
    {
      include APP_PATH .'models/'. $name .'.php';
    }
  }


  # Load views
  public static function view($files, &$data = array(), $return = FALSE)
  {
    // Check for global template variables
    if (!empty(self::$config['view_data']))
    {
      $data = $data + (array) self::$config['view_data'];
    }

    // Return it
    if (!empty($return))
    {
      ob_start();
    }

    // Include view files
    foreach ((array) $files as $file)
    {
      include APP_PATH . 'views/' . $file . '.php';
    }

    // Return it
    if (!empty($return))
    {
      $contents = ob_get_contents();
      ob_end_clean();
      return $contents;
    }
  }


  # Helpers
  public static function helper($files)
  {
    foreach ((array) $files as $name)
    {
      include APP_PATH .'helpers/'. $name .'.php';
    }
  }



  /*
  |--------------------------------------------------------------------------
  | Aditional methods
  |--------------------------------------------------------------------------
  */

  public static function mark_timer($name)
  {
    global $microtime;
    self::$custom_timers[$name] = round(microtime(true) - $microtime, 5);
  }


  public static function execution_time()
  {
    global $microtime;
    $output = 'Total execution time: ' . round(microtime(true) - $microtime, 5) . " seconds;\n";
    $output .= 'Memory used: ' . round(memory_get_usage() / 1024 / 1024, 4) . " MB;\n";
    <commit_msg>Possibility to load from other projects<commit_after><?php

class load
{
  public static $config = array();

  private static $custom_timers = array();


  /*
  |--------------------------------------------------------------------------
  | Configuration methods
  |--------------------------------------------------------------------------
  */

  # Get config variable
  public static function &get($name)
  {
    return self::$config[$name];
  }



  # Set config variable
  public static function set($name, $value)
  {
    return (self::$config[$name] = $value);
  }



  # Merge config variable
  public static function merge($name, $value, $owerwrite = TRUE)
  {
    if (!isset(self::$config[$name]))
    {
      return (self::$config[$name] = $value);
    }

    switch (true)
    {
      case is_array(self::$config[$name]):
        if (empty($owerwrite))
        {
          return (self::$config[$name] += $value);
        }
        else
        {
          return (self::$config[$name] = array_merge((array)self::$config[$name], (array)$value));
        }
      break;

      case is_object(self::$config[$name]):
        if (empty($owerwrite))
        {
          return (self::$config[$name] = (object)((array)self::$config[$name] + (array)$value));
        }
        else
        {
          return (self::$config[$name] = (object)array_merge((array)self::$config[$name], (array)$value));
        }
      break;

      case is_int(self::$config[$name]):
      case is_float(self::$config[$name]):
        return (self::$config[$name] += $value);
      break;

      case is_string(self::$config[$name]):
      default:
        return (self::$config[$name] .= $value);
      break;
    }
  }




  /*
  |--------------------------------------------------------------------------
  | File Loadings
  |--------------------------------------------------------------------------
  */

  # Load config files
  public static function config($files, $project = NULL)
  {
    $config =& self::$config;
    foreach ((array) $files as $name)
    {
      include (empty($project) ? APP_PATH : BASE_PATH . $project . '/') . 'config/'. $name .'.php';
    }
  }


  # Load models
  public static function model($files, $project = NULL)
  {
    foreach ((array) $files as $name)
    {
      include (empty($project) ? APP_PATH : BASE_PATH . $project . '/') . 'models/'. $name .'.php';
    }
  }


  # Load views
  public static function view($files, &$data = array(), $return = FALSE, $project = NULL)
  {
    // Check for global template variables
    if (!empty(self::$config['view_data']))
    {
      $data = $data + (array) self::$config['view_data'];
    }

    // Return it
    if (!empty($return))
    {
      ob_start();
    }

    // Include view files
    foreach ((array) $files as $file)
    {
      include (empty($project) ? APP_PATH : BASE_PATH . $project . '/') . 'views/' . $file . '.php';
    }

    // Return it
    if (!empty($return))
    {
      $contents = ob_get_contents();
      ob_end_clean();
      return $contents;
    }
  }


  # Helpers
  public static function helper($files, $project = NULL)
  {
    foreach ((array) $files as $name)
    {
      include (empty($project) ? APP_PATH : BASE_PATH . $project . '/') . 'helpers/'. $name .'.php';
    }
  }



  /*
  |--------------------------------------------------------------------------
  | Aditional methods
  |--------------------------------------------------------------------------
  */

  public static function mark_timer($name)
  {
    global $microtime;
    self::$custom_timers[$name] = round(microtime(true) - $microtime, 5);
  }


  public static function execution_time()
  {
    global $microtime;
    $output = 'Total execution time: ' . round(microtime(true) - $microtime, 5) . " seconds;\n";
    $output .= 'Memory used: ' . round(memory_get_usage() / 1024 / 1024, 4) . " MB;\n";
    
{'fraction_non_alphanumeric': 0.27069680353082787, 'fraction_numerical': 0.002942356560117694, 'mean_word_length': 1.6303200844178685, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5168079', 'n_tokens_mistral': 2218, 'n_tokens_neox': 2130, 'n_words': 477}