<commit_before><?php

namespace Stermedia\AppDevSecurity;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Exception\ParseException;

/**
 * Class AppDevSecurity
 * This tool handle access to debug front controllers that are deployed by to production servers.
 * Uses parameters defined in
 * @author <NAME> <<EMAIL>>
 * @license MIT
 */
class AppDevSecurityHandler
{
    /**
     * Config dir path - path to symfony config dir
     *
     * @var string
     */
    protected $configDir;

    /**
     * $_SERVER - Server and execution environment information
     *
     * @var array
     */
    protected $server;

    /**
     * Is app_dev security disabled
     *
     * @var bool
     */
    protected $securityDisabled;

    /**
     * Is HTTP_CLIENT_IP allowed
     *
     * @var bool
     */
    protected $allowHttpClientIp;

    /**
     * Is HTTP_X_FORWARDED_FOR allowed
     *
     * @var bool
     */
    protected $allowHttpXForwardedFor;

    /**
     * Array of disallowed types of interface between web server and PHP(the Server API, SAPI)
     * uses php_sapi_name()
     *
     * @var array
     */
    protected $disallowedPhpSapiNames;

    /**
     * Array of allowed remote ip addresses. Compares to REMOTE_ADDR
     *
     * @var array
     */
    protected $allowedRemoteAddr;

    /**
     * Constructor
     *
     * @param string $configDir path to symfony config dir
     * @param array  $server    $_SERVER - Server and execution environment information
     */
    public function __construct($configDir = null, $server = null)
    {
        if(is_null($configDir)) {
            $this->configDir = __DIR__.'/../../../app/config/';
        } else {
            $this->configDir = $configDir;
        }
        if(is_null($server)) {
            $this->server = $_SERVER;
        } else {
            $this->server = $server;
        }

        // set defaults
        $this->securityDisabled= false;
        $this->allowHttpClientIp = false;
        $this->allowHttpXForwardedFor = false;
        $this->disallowedPhpSapiNames = array ('cli-server');
        $this->allowedRemoteAddr = array (
            '127.0.0.1',
            'fe80::1',
            '::1'
        );

        $this->loadParameters();
    }

    /**
     * Returns absolute config dir path
     *
     * @return string
     */
    protected function getConfigDir()<commit_msg>updated default config path<commit_after><?php

namespace Stermedia\AppDevSecurity;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Exception\ParseException;

/**
 * Class AppDevSecurity
 * This tool handle access to debug front controllers that are deployed by to production servers.
 * Uses parameters defined in
 * @author <NAME> <<EMAIL>>
 * @license MIT
 */
class AppDevSecurityHandler
{
    /**
     * Config dir path - path to symfony config dir
     *
     * @var string
     */
    protected $configDir;

    /**
     * $_SERVER - Server and execution environment information
     *
     * @var array
     */
    protected $server;

    /**
     * Is app_dev security disabled
     *
     * @var bool
     */
    protected $securityDisabled;

    /**
     * Is HTTP_CLIENT_IP allowed
     *
     * @var bool
     */
    protected $allowHttpClientIp;

    /**
     * Is HTTP_X_FORWARDED_FOR allowed
     *
     * @var bool
     */
    protected $allowHttpXForwardedFor;

    /**
     * Array of disallowed types of interface between web server and PHP(the Server API, SAPI)
     * uses php_sapi_name()
     *
     * @var array
     */
    protected $disallowedPhpSapiNames;

    /**
     * Array of allowed remote ip addresses. Compares to REMOTE_ADDR
     *
     * @var array
     */
    protected $allowedRemoteAddr;

    /**
     * Constructor
     *
     * @param string $configDir path to symfony config dir
     * @param array  $server    $_SERVER - Server and execution environment information
     */
    public function __construct($configDir = null, $server = null)
    {
        if(is_null($configDir)) {
            $this->configDir = __DIR__.'/../../../../../app/config/';
        } else {
            $this->configDir = $configDir;
        }
        if(is_null($server)) {
            $this->server = $_SERVER;
        } else {
            $this->server = $server;
        }

        // set defaults
        $this->securityDisabled= false;
        $this->allowHttpClientIp = false;
        $this->allowHttpXForwardedFor = false;
        $this->disallowedPhpSapiNames = array ('cli-server');
        $this->allowedRemoteAddr = array (
            '127.0.0.1',
            'fe80::1',
            '::1'
        );

        $this->loadParameters();
    }

    /**
     * Returns absolute config dir path
     *
     * @return string
     */
    protected function getConfigDir()
{'fraction_non_alphanumeric': 0.11297584936553418, 'fraction_numerical': 0.004093327875562832, 'mean_word_length': 1.994485294117647, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1688547', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1392, 'n_words': 356}