protected function setOptions(array $options)
    {
        // @codeCoverageIgnoreStart
        $this->parserDefaults = array_merge($this->parserDefaults, [
            // The import callback ensures that if a file is not found in the
            // app's webroot, it will search for that file in its plugin's
            // webroot path
            'import_callback' => function ($lessTree) {
                if ($pathAndUri = $lessTree->PathAndUri()) {
                    return $pathAndUri;
                }

                $file = $lessTree->getPath();
                list($plugin, $basefile) = $this->assetSplit($file);
                $file = $this->pluginAssetFile([$plugin, $basefile]);

                if ($file) {
                    return [
                        $file,
                        $this->assetBaseUrl($plugin, $basefile)
                    ];
                }

                return null;
            }
        ]);
        // @codeCoverageIgnoreEnd

        if (empty($options['parser'])) {
            $options['parser'] = [];
        }
        if (Configure::read('debug') && !isset($options['parser']['sourceMap'])) {
            $options['parser']['sourceMap'] = true;
        }
        $options['parser'] = array_merge($this->parserDefaults, $options['parser']);

        if (empty($options['js'])) {
            $options['js'] = [];
        }
        $options['js'] = array_merge($this->lessjsDefaults, $options['js']);

        if (empty($options['less'])) {
            $options['less'] = 'Less.less.min';
        }

        if (!isset($options['cache'])) {
            $options['cache'] = true;
        }

        return $options;
    }
protected function setOptions(array $options)
    {
        // @codeCoverageIgnoreStart
        $this->parserDefaults = array_merge($this->parserDefaults, [
            // The import callback ensures that if a file is not found in the
            // app's webroot, it will search for that file in its plugin's
            // webroot path
            'import_callback' => function ($lessTree) {
                if ($pathAndUri = $lessTree->PathAndUri()) {
                    return $pathAndUri;
                }

                $file = $lessTree->getPath();
                list($plugin, $basefile) = $this->assetSplit($file);
                $file = $this->pluginAssetFile([$plugin, $basefile]);

                if ($file) {
                    return [
                        $file,
                        $this->assetBaseUrl($plugin, $basefile)
                    ];
                }

                return null;
            }
        ]);
        // @codeCoverageIgnoreEnd

        if (empty($options['parser'])) {
            $options['parser'] = [];
        }
        if (Configure::read('debug') && !isset($options['parser']['sourceMap'])) {
            $options['parser']['sourceMap'] = true;
        }
        $options['parser'] = array_merge($this->parserDefaults, $options['parser']);

        if (empty($options['js'])) {
            $options['js'] = [];
        }
        $options['js'] = array_merge($this->lessjsDefaults, $options['js']);

        if (empty($options['less'])) {
            $options['less'] = 'Less.less.min';
        }

        if (!isset($options['cache'])) {
            $options['cache'] = true;
        }

        return $options;
    }
protected function setOptions ( array $ options ) { // @codeCoverageIgnoreStart $ this -> parserDefaults = array_merge ( $ this -> parserDefaults , [ // The import callback ensures that if a file is not found in the // app's webroot, it will search for that file in its plugin's // webroot path 'import_callback' => function ( $ lessTree ) { if ( $ pathAndUri = $ lessTree -> PathAndUri ( ) ) { return $ pathAndUri ; } $ file = $ lessTree -> getPath ( ) ; list ( $ plugin , $ basefile ) = $ this -> assetSplit ( $ file ) ; $ file = $ this -> pluginAssetFile ( [ $ plugin , $ basefile ] ) ; if ( $ file ) { return [ $ file , $ this -> assetBaseUrl ( $ plugin , $ basefile ) ] ; } return null ; } ] ) ; // @codeCoverageIgnoreEnd if ( empty ( $ options [ 'parser' ] ) ) { $ options [ 'parser' ] = [ ] ; } if ( Configure :: read ( 'debug' ) && ! isset ( $ options [ 'parser' ] [ 'sourceMap' ] ) ) { $ options [ 'parser' ] [ 'sourceMap' ] = true ; } $ options [ 'parser' ] = array_merge ( $ this -> parserDefaults , $ options [ 'parser' ] ) ; if ( empty ( $ options [ 'js' ] ) ) { $ options [ 'js' ] = [ ] ; } $ options [ 'js' ] = array_merge ( $ this -> lessjsDefaults , $ options [ 'js' ] ) ; if ( empty ( $ options [ 'less' ] ) ) { $ options [ 'less' ] = 'Less.less.min' ; } if ( ! isset ( $ options [ 'cache' ] ) ) { $ options [ 'cache' ] = true ; } return $ options ; }
Sets the less configuration var options based on the ones given by the user
and our default ones.

Here's also where we define the import_callback used by less.php parser,
so it can find files successfully even if they're on plugin folders.

@param array  $options An array of options containing our options
combined with the ones for the parsers.
@return array $options The resulting $options array.
Sets the less configuration var options based on the ones given by the user and our default ones .