/** * Constructor. * Sets parser options * @param array $options * @return SassParser */ public function __construct($options = array()) { if (!is_array($options)) { if (isset($options['debug']) && $options['debug']) { throw new SassException('Options must be an array'); } $options = count((array) $options) ? (array) $options : array(); } unset($options['language']); $basepath = $_SERVER['PHP_SELF']; $basepath = substr($basepath, 0, strrpos($basepath, '/') + 1); $defaultOptions = array('basepath' => $basepath, 'debug_info' => FALSE, 'filename' => array('dirname' => '', 'basename' => ''), 'functions' => array(), 'load_paths' => array(), 'load_path_functions' => array(), 'line' => 1, 'line_numbers' => FALSE, 'style' => SassRenderer::STYLE_NESTED, 'syntax' => SassFile::SASS, 'debug' => FALSE, 'quiet' => FALSE, 'callbacks' => array('warn' => FALSE, 'debug' => FALSE)); if (isset(self::$instance)) { $defaultOptions['load_paths'] = self::$instance->load_paths; } $options = array_merge($defaultOptions, $options); // We don't want to allow setting of internal only property syntax value if (isset($options["property_syntax"]) && $options["property_syntax"] == "scss") { unset($options["property_syntax"]); } self::$instance = $this; self::$functions = $options['functions']; unset($options['functions']); foreach ($options as $name => $value) { $this->{$name} = $value; } if (!$this->property_syntax && $this->syntax == SassFile::SCSS) { $this->property_syntax = "scss"; } $GLOBALS['SassParser_debug'] = $this->debug; }