Get LESS compiler (if undefined, set it with path for @import directives)

@param boolean $reset
963855
protected function getEnvironment($reset = false)
    {
        if ($reset === true || null === $this->lessc) {
            $this->lessc = new \lessc;
            $this->lessc->addImportDir($this->getConfigFor('phr_template_dir'));
        }

        return $this->lessc;
    }
1347536
public function in(array $dirs, $reset = false)
    {
        $reset and $this->dirs = [];
        array_walk($dirs, function ($dir, $name) {
            if (! is_dir($dir)) {
                throw new InvalidArgumentException('Template folders must be readable paths.');
            }
            if (! is_string($name)) {
                $norm = explode(DIRECTORY_SEPARATOR, $this->normalize($dir));
                $name = implode('.', array_slice($norm, -2));
            }
            $this->dirs[$name] = $dir;
        });
    }
17872
public function parameters($reset = false)
    {
        if ($reset || is_null($this->_searchParameters)) {
            $this->_searchParameters = new ParameterRegistry($this->_controller, []);
            $parameters = (array)$this->config('parameters');
            foreach ($parameters as $parameter) {
                if (!empty($parameter['name'])) {
                    $this->addParam($parameter['name'], $parameter);
                }
            }
        }

        return $this->_searchParameters;
    }
326167
public function getWhereBuilder($new = false)
    {
        if ($new) {
            return new WhereBuilder();
        }

        if (null == self::$whereBuilder) {
            $this->resetWhereBuilder();
        }

        return self::$whereBuilder;
    }
1255605
public function getCompiledDelete(string $table='', bool $reset=TRUE): string
	{
		return $this->_getCompile('delete', $table, $reset);
	}
438527
static function set_info($info)
    {
        if (!isset($info['proto']) && $info['uri'] !='/vendor/boolive/basic/object'){
            $info['proto'] = '/vendor/boolive/basic/object';
        }
        if (isset($info['properties'])){
            foreach ($info['properties'] as $name => $child){
                if (is_scalar($child) || is_null($child)){
                    $child = ['value' => $child];
                    if (isset($info['proto'])) $child['proto'] = $info['proto'].'/'.$name;
                }
                $child['name'] = $name;
                $child['is_property'] = true;
                if (!empty($child['value'])) $child['is_default_value'] = false;
                if (!empty($child['file'])) $child['is_default_file'] = false;
                if (!isset($child['is_default_logic'])) $child['is_default_logic'] = true;
                if (!isset($child['created']) && isset($info['created'])) $child['created'] = $info['created'];
                if (!isset($child['updated']) && isset($info['updated'])) $child['updated'] = $info['updated'];
                $child['is_exists'] = $info['is_exists'];
                $child['uri'] = $info['uri'].'/'.$name;
                self::$list_props[$info['uri']][$name] = $child['uri'];
                self::set_info($child);
            }
            unset($info['properties']);
        }
        self::$list_info[$info['uri']] = $info;
        return $info;
    }
726939
static function errorChoosenAction( $errorCode, &$installParameters, $description, $handlerType, $resetError = true )
    {
        if ( isset( $installParameters['non-interactive'] ) && $installParameters['non-interactive'] )
        {
            if ( $description )
            {
                eZDebug::writeNotice( $description, 'Package installation conflict' );
            }
            return eZPackage::NON_INTERACTIVE;
        }

        if ( isset( $installParameters['error_default_actions'][$handlerType][$errorCode] ) )
        {
            if ( $resetError && count( $installParameters['error'] ) )
                $installParameters['error'] = array();
            return $installParameters['error_default_actions'][$handlerType][$errorCode];
        }

        if ( isset( $installParameters['error']['error_code'] ) &&
             $installParameters['error']['error_code'] == $errorCode )
        {
            if ( isset( $installParameters['error']['choosen_action'] ) )
            {
                $choosenAction = $installParameters['error']['choosen_action'];
                if ( $resetError )
                    $installParameters['error'] = array();
                return $choosenAction;
            }
        }
        return false;
    }
708765
public function update($reset = true)
    {
        $this->explainer->info('Pulling changes');
        $tasks = [$this->vcs->update()];

        // Reset if requested
        if ($reset) {
            array_unshift($tasks, $this->vcs->reset());
        }

        return $this->bash->runForCurrentRelease($tasks);
    }
812842
public function resetCatalog($from = null, $to = null)
    {
        $conn = $this->getConnection();
        if ($from && $to) {
            $where = [
                'created_at >= ?' => $from . ' 00:00:00',
                'created_at <= ?' => $to . ' 23:59:59',
                'imported is ?' => new \Zend_Db_Expr('not null')
            ];
        } else {
            $where = $conn->quoteInto(
                'imported is ?',
                new \Zend_Db_Expr('not null')
            );
        }
        $num = $conn->update(
            $this->getTable(Schema::EMAIL_CATALOG_TABLE),
            [
                'imported' => new \Zend_Db_Expr('null'),
                'modified' => new \Zend_Db_Expr('null'),
            ],
            $where
        );

        return $num;
    }
769160
private function getCompiler(): BladeCompiler
    {
        if ($this->compiler) {
            return $this->compiler;
        }

        if (!is_dir($this->cache)) {
            mkdir($this->cache, 0777, true);
        }

        $blade = new BladeCompiler(new Filesystem(), $this->cache);

        $this->directives->register($blade);

        $this->compiler = $blade;

        return $this->compiler;
    }
1036948
private function peekBeyondClosingParenthesis($resetPeek = true)
    {
        $token        = $this->lexer->peek();
        $numUnmatched = 1;

        while ($numUnmatched > 0 && $token !== null) {
            switch ($token['type']) {
                case Lexer::T_OPEN_PARENTHESIS:
                    ++$numUnmatched;
                    break;

                case Lexer::T_CLOSE_PARENTHESIS:
                    --$numUnmatched;
                    break;

                default:
                    // Do nothing
            }

            $token = $this->lexer->peek();
        }

        if ($resetPeek) {
            $this->lexer->resetPeek();
        }

        return $token;
    }
673038
public function url($reset = true)
    {
        /** @var UniformResourceLocator $locator */
        $locator = Grav::instance()['locator'];
        $image_path = $locator->findResource('cache://images', true);
        $image_dir = $locator->findResource('cache://images', false);
        $saved_image_path = $this->saveImage();

        $output = preg_replace('|^' . preg_quote(GRAV_ROOT, '|') . '|', '', $saved_image_path);

        if ($locator->isStream($output)) {
            $output = $locator->findResource($output, false);
        }

        if (Utils::startsWith($output, $image_path)) {
            $output = '/' . $image_dir . preg_replace('|^' . preg_quote($image_path, '|') . '|', '', $output);
        }

        if ($reset) {
            $this->reset();
        }

        return trim(Grav::instance()['base_url'] . '/' . $this->urlQuerystring($output), '\\');
    }
784280
public function SetImportDirs( $dirs ){
		Less_Parser::$options['import_dirs'] = array();

		foreach($dirs as $path => $uri_root){

			$path = self::WinPath($path);
			if( !empty($path) ){
				$path = rtrim($path,'/').'/';
			}

			if ( !is_callable($uri_root) ){
				$uri_root = self::WinPath($uri_root);
				if( !empty($uri_root) ){
					$uri_root = rtrim($uri_root,'/').'/';
				}
			}

			Less_Parser::$options['import_dirs'][$path] = $uri_root;
		}
	}
902898
public function getCompiler()
    {
        if (!$this->compiler) {
            $cachePath = $this->config->get('cache_path') ?: GlobalContainer::getCachePath();

            if (!$cachePath) {
                throw new \InvalidArgumentException('Please set cache_path into config.');
            }

            if (!is_dir($cachePath)) {
                mkdir($cachePath, 0755, true);
            }

            $this->compiler = new CompilerEngine(new BladeCompiler($this->getFilesystem(), $cachePath));
        }

        return $this->compiler;
    }
769744
public function registerPaths($refresh = false)
    {
        if (!$this->pathRegistered || $refresh) {
            // Set package path
            $package = $this->getPackage();

            if (!$package instanceof NullPackage) {
                $locale  = $package->app->get('language.locale', 'en-GB');
                $default = $package->app->get('language.default', 'en-GB');

                $prefix = $this->pathPrefix ? '/' . $this->pathPrefix : null;

                $this->renderer->addPath(
                    $package->getDir() . '/Templates' . $prefix . '/' . $locale,
                    PriorityQueue::BELOW_NORMAL
                );

                if ($locale !== $default) {
                    $this->renderer->addPath(
                        $package->getDir() . '/Templates' . $prefix . '/' . $default,
                        PriorityQueue::BELOW_NORMAL
                    );
                }

                $this->renderer->addPath($package->getDir() . '/Templates' . $prefix, PriorityQueue::BELOW_NORMAL);

                if ($this->pathPrefix) {
                    $this->renderer->addPath(
                        $package->app->get('path.templates') . '/' . $this->pathPrefix,
                        PriorityQueue::LOW
                    );
                }
            }

            $this->pathRegistered = true;
        }

        return $this;
    }
116504
function getLessImports() {
    if (cache.lessImports) return cache.lessImports;

    var semanticUiLessPath = getPackagePath('semantic-ui-less');
    if (!semanticUiLessPath) {
        error('Package semantic-ui-less could not be found. Install semantic-ui-less or set addLessImports to false.');
    }

    var lessImportsFilePath = path.resolve(semanticUiLessPath, 'semantic.less');
    var lessImportsFile = fs.readFileSync(lessImportsFilePath, 'utf8');

    var importRegex = /@import\s+"([^"]+)"/g;
    var lessImports = {};
    var match;
    while(match = importRegex.exec(lessImportsFile)) {
        var importPath = match[1];
        var component = importPath.substring(importPath.lastIndexOf('/') + 1);
        if (lessImports[component]) {
            error('duplicate less component name \'' + component + '\' - probably the plugin needs an update');
        }
        lessImports[component] = 'semantic-ui-less/' + importPath + '.less';
    }

    cache.lessImports = lessImports;
    return lessImports;
}
1291116
public function getCompiledUpdate(string $table='', bool $reset=TRUE): string
	{
		return $this->_getCompile('update', $table, $reset);
	}