<commit_before><?php
/**
 * Tinyark Framework
 *
 * @copyright Copyright 2012-2013, Dong <<EMAIL>>
 * @link http://maxmars.net/projects/tinyark Tinyark project
 * @license MIT License (http://maxmars.net/license/MIT)
 */

class ArkRequest
{
    protected $attributes;

    public function __construct()
    {
        
    }

    public function getMethod()
    {
        return $_SERVER['REQUEST_METHOD'];
    }

    public function getAttribute($key, $default = null)
    {
        return isset($this->attributes[$key])?$this->attributes[$key]:$default;
    }

    public function setAttribute($key, $value)
    {
        $this->attributes[$key] = $value;
    }

    /**
     * Get request parameter($_GET > $_POST > attributes)
     * 
     * @param  string $key
     * @param  mixed $default
     * @return mixed
     */
    public function get($key, $default = null)
    {
        return isset($_GET[$key])?$_GET[$key]:(
                isset($_POST[$key])?$_POST[$key]:$this->getAttribute($key, $default)
            );
    }

    public function getClientIp()
    {
        return $_SERVER['HTTP_REMOTE_ADDR'];
    }

    /**
     * Check if the request is secure
     * 
     * @see http://stackoverflow.com/questions/1175096/how-to-find-out-if-you-are-using-https-without-serverhttps
     * @return boolean
     */
    public function isSecure()
    {
        if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
            || $_SERVER['SERVER_PORT'] == 443) {

            return true;<commit_msg>fix https issue<commit_after><?php
/**
 * Tinyark Framework
 *
 * @copyright Copyright 2012-2013, Dong <<EMAIL>>
 * @link http://maxmars.net/projects/tinyark Tinyark project
 * @license MIT License (http://maxmars.net/license/MIT)
 */

class ArkRequest
{
    protected $attributes;

    public function __construct()
    {
        
    }

    public function getMethod()
    {
        return $_SERVER['REQUEST_METHOD'];
    }

    public function getAttribute($key, $default = null)
    {
        return isset($this->attributes[$key])?$this->attributes[$key]:$default;
    }

    public function setAttribute($key, $value)
    {
        $this->attributes[$key] = $value;
    }

    /**
     * Get request parameter($_GET > $_POST > attributes)
     * 
     * @param  string $key
     * @param  mixed $default
     * @return mixed
     */
    public function get($key, $default = null)
    {
        return isset($_GET[$key])?$_GET[$key]:(
                isset($_POST[$key])?$_POST[$key]:$this->getAttribute($key, $default)
            );
    }

    public function getClientIp()
    {
        return $_SERVER['HTTP_REMOTE_ADDR'];
    }

    /**
     * Check if the request is secure
     * 
     * @see http://stackoverflow.com/questions/1175096/how-to-find-out-if-you-are-using-https-without-serverhttps
     * @return boolean
     */
    public function isSecure()
    {
        if (
            $_SERVER['SERVER_PORT'] != 80
            && 
            (
                !empty($_SERVER['HTTPS']) 
                && 
                $_SERVER['HTTPS'] !== 'off'
                || 
                $_SERVER['SERVER_PORT'] == 443
            )
        ) {

            return true;
{'fraction_non_alphanumeric': 0.15035948733979368, 'fraction_numerical': 0.011878712097530478, 'mean_word_length': 2.109815354713314, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '3457662', 'n_tokens_mistral': 1005, 'n_tokens_neox': 936, 'n_words': 181}