<commit_before><?php

/*
 * This file is part of the ILess
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * Environment
 *
 * @package ILess
 * @subpackage environment
 */
class ILess_Environment {

  /**
   * Array of frames
   *
   * @var array
   */
  public $frames = array();

  /**
   * Cstom variables
   *
   * @var ILess_Node_Ruleset
   */
  public $customVariables;

  /**
   * Compress the output?
   *
   * @var bool
   */
  public $compress = false;

  /**
   * Can shorten colors?
   *
   * @var boolean
   */
  public $canShortenColors = false;

  /**
   * The math precision
   *
   * @var integer
   */
  public $precision = 16;

  /**
   * Debug flag
   *
   * @var boolean
   */
  public $debug = false;

  /**
   * @var boolean
   */
  public $strictImports = false;

  /**
   * Adjust URL's to be relative?
   *
   * @var boolean
   */
  public $relativeUrls = false;

  /**
   * @var array
   */
  public $mediaBlocks = array();

  /**
   * @var array
   */
  public $mediaPath = array();

  /**
   * @var array
   */
  public $paths = array();

  /**
   * Math is required to be in parenthesis like: <pre>(1+1)</pre>
   *
   * @var boolean
   */
  public $strictMath = false;

  /**
   * Validate the units used?
   *
   * @var boolean
   */
  public $strictUnits = false;

  /**
   * Process imports?
   *
   * @var boolean
   */
  public $processImports = true;

  /**
   * IE8 data-uri compatibility
   *
   * @var boolean
   */
  public $ieCompat = true;

  /**
   * Dump line numbers?
   *
   * @var false|all|comments|mediaquery
   */
  public $dumpLineNumbers = false;

  /**
   * Tab level
   *
   * @var integer
   */
  public $tabLevel = 0;

  /**
   * First selector flag
   *
   * @var boolean
   */
  public $firstSelector = false;

  /**
   * Last rule flag
   *
   * @var boolean
   */
  public $lastRule = false;

  /**
   * Important flag (currently not implemented in less.js)
   *
   * @var boolean
   */
  public $isImportant = false;

  /**
   * Selectors
   *
   * @var array
   */
  public $selectors = array();

  /**
   * Parens stack
   *
   * @var array
   */
  protected $parensStack = array();

  /**
   * Current file information. For error reporting,
   * importing and making urls relative etc.
   *
   * @var ILess_FileInfo
   */
  public $currentFileInfo;

  /**
   * What is this for?
   *
   * @var boolean
   */
  public $importMultiple = false;

  /**
   * Source map flag
   *
   * @var boolean
   */
  public $sourceMap = false;

  /**
   * Array of source map options
   *
   * @var array
   */
  public $sourceMapOptions = array();

  /**
   * Filename to contents of all parsed the files
   *
   * @var array
   */
  public $contentsMap = array();

  /**
   * Has extends? For speed improvement
   *
   * @var boolean
   */
  public $hasExtends = false;

  /**
   * The function registry
   *
   * @var ILess_FunctionRegistry
   */
  protected $functionRegistry;

  /**
   * Constructor
   *
   * @param ILess_FunctionRegistry $registry The function registry
   * @param array $options
   * @throws InvalidArgumentException If passed options are invalid
   */
  public function __construct(array $options = array(), ILess_FunctionRegistry $registry = null)
  {
    if($registry)
    {
      $this->setFunctionRegistry($registry);
    }

    $invalid = array();
    foreach($options as $option => $value)
    {
      // convert underscored option to camelCased property
      if(strpos($option, '_') !== false)
      {
        $option = ILess_Util::camelize($option);
      }

      if(!property_exists($this, $option))
      {
        $invalid[] = $option;
      }
      else
      {
        switch($option)
        {
          case 'strictUnits':
          case 'compress':
          case 'importMultiple':
          case 'ieCompat':
            $value = (boolean)$value;
            break;
        }

        $this->$option = $value;
      }
    }

    if(count($invalid))
    {
      throw new InvalidArgumentException('Invalid options "%s" given.', join(', ', $invalid));
    }

  }

  /**
   * Returns the function registry<commit_msg>fixed wrong paremeters for exception<commit_after><?php

/*
 * This file is part of the ILess
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * Environment
 *
 * @package ILess
 * @subpackage environment
 */
class ILess_Environment {

  /**
   * Array of frames
   *
   * @var array
   */
  public $frames = array();

  /**
   * Cstom variables
   *
   * @var ILess_Node_Ruleset
   */
  public $customVariables;

  /**
   * Compress the output?
   *
   * @var bool
   */
  public $compress = false;

  /**
   * Can shorten colors?
   *
   * @var boolean
   */
  public $canShortenColors = false;

  /**
   * The math precision
   *
   * @var integer
   */
  public $precision = 16;

  /**
   * Debug flag
   *
   * @var boolean
   */
  public $debug = false;

  /**
   * @var boolean
   */
  public $strictImports = false;

  /**
   * Adjust URL's to be relative?
   *
   * @var boolean
   */
  public $relativeUrls = false;

  /**
   * @var array
   */
  public $mediaBlocks = array();

  /**
   * @var array
   */
  public $mediaPath = array();

  /**
   * @var array
   */
  public $paths = array();

  /**
   * Math is required to be in parenthesis like: <pre>(1+1)</pre>
   *
   * @var boolean
   */
  public $strictMath = false;

  /**
   * Validate the units used?
   *
   * @var boolean
   */
  public $strictUnits = false;

  /**
   * Process imports?
   *
   * @var boolean
   */
  public $processImports = true;

  /**
   * IE8 data-uri compatibility
   *
   * @var boolean
   */
  public $ieCompat = true;

  /**
   * Dump line numbers?
   *
   * @var false|all|comments|mediaquery
   */
  public $dumpLineNumbers = false;

  /**
   * Tab level
   *
   * @var integer
   */
  public $tabLevel = 0;

  /**
   * First selector flag
   *
   * @var boolean
   */
  public $firstSelector = false;

  /**
   * Last rule flag
   *
   * @var boolean
   */
  public $lastRule = false;

  /**
   * Important flag (currently not implemented in less.js)
   *
   * @var boolean
   */
  public $isImportant = false;

  /**
   * Selectors
   *
   * @var array
   */
  public $selectors = array();

  /**
   * Parens stack
   *
   * @var array
   */
  protected $parensStack = array();

  /**
   * Current file information. For error reporting,
   * importing and making urls relative etc.
   *
   * @var ILess_FileInfo
   */
  public $currentFileInfo;

  /**
   * What is this for?
   *
   * @var boolean
   */
  public $importMultiple = false;

  /**
   * Source map flag
   *
   * @var boolean
   */
  public $sourceMap = false;

  /**
   * Array of source map options
   *
   * @var array
   */
  public $sourceMapOptions = array();

  /**
   * Filename to contents of all parsed the files
   *
   * @var array
   */
  public $contentsMap = array();

  /**
   * Has extends? For speed improvement
   *
   * @var boolean
   */
  public $hasExtends = false;

  /**
   * The function registry
   *
   * @var ILess_FunctionRegistry
   */
  protected $functionRegistry;

  /**
   * Constructor
   *
   * @param ILess_FunctionRegistry $registry The function registry
   * @param array $options
   * @throws InvalidArgumentException If passed options are invalid
   */
  public function __construct(array $options = array(), ILess_FunctionRegistry $registry = null)
  {
    if($registry)
    {
      $this->setFunctionRegistry($registry);
    }

    $invalid = array();
    foreach($options as $option => $value)
    {
      // convert underscored option to camelCased property
      if(strpos($option, '_') !== false)
      {
        $option = ILess_Util::camelize($option);
      }

      if(!property_exists($this, $option))
      {
        $invalid[] = $option;
      }
      else
      {
        switch($option)
        {
          case 'strictUnits':
          case 'compress':
          case 'importMultiple':
          case 'ieCompat':
            $value = (boolean)$value;
            break;
        }

        $this->$option = $value;
      }
    }

    if(count($invalid))
    {
      throw new InvalidArgumentException(sprintf('Invalid options "%s" given.', join(', ', $invalid)));
    }

  }

  /**
   * Returns the function registry
{'fraction_non_alphanumeric': 0.13333333333333333, 'fraction_numerical': 0.0014234875444839859, 'mean_word_length': 2.0360100828231906, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '3593966', 'n_tokens_mistral': 2753, 'n_tokens_neox': 2661, 'n_words': 705}