1 <?php
 2 /**
 3  * @package     Joomla.Libraries
 4  * @subpackage  LESS
 5  *
 6  * @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 7  * @license     GNU General Public License version 2 or later; see LICENSE.txt
 8  */
 9 
10 defined('JPATH_PLATFORM') or die;
11 
12 /**
13  * Wrapper class for lessc
14  *
15  * @package     Joomla.Libraries
16  * @subpackage  Less
17  * @since       3.4
18  * @deprecated  4.0  without replacement
19  */
20 class JLess extends lessc
21 {
22     /**
23      * Constructor
24      *
25      * @param   string  $fname      Filename to process
26      * @param   mided   $formatter  Formatter object
27      *
28      * @since   3.4
29      */
30     public function __construct($fname = null, $formatter = null)
31     {
32         parent::__construct($fname);
33 
34         if ($formatter === null)
35         {
36             $formatter = new JLessFormatterJoomla;
37         }
38 
39         $this->setFormatter($formatter);
40     }
41 
42     /**
43      * Override compile to reset $this->allParsedFiles array to allow
44      * parsing multiple files/strings using same imports.
45      * PR: https://github.com/leafo/lessphp/pull/607
46      *
47      * For documentation on this please see /vendor/leafo/lessc.inc.php
48      *
49      * @param   string  $string  LESS string to parse.
50      * @param   string  $name    The sourceName used for error messages.
51      *
52      * @return  string  $out     The compiled css output.
53      */
54     public function compile($string, $name = null)
55     {
56         $this->allParsedFiles = array();
57 
58         return parent::compile($string, $name);
59     }
60 }
61