Less::toCss()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 1
1
<?php
2
3
/**
4
 * Manage Less 
5
 *
6
 * @category  	Venus
7
 * @package		Venus\lib
8
 * @author    	Judicaël Paquet <[email protected]>
9
 * @copyright 	Copyright (c) 2013-2014 PAQUET Judicaël FR Inc. (https://github.com/las93)
10
 * @license   	https://github.com/las93/venus2/blob/master/LICENSE.md Tout droit réservé à PAQUET Judicaël
11
 * @version   	Release: 1.0.0
12
 * @filesource	https://github.com/las93/venus2
13
 * @link      	https://github.com/las93
14
 * @since     	1.0
15
 */
16
namespace Venus\lib;
17
18
/**
19
 * Manage Less
20
 *
21
 * @category  	Venus
22
 * @package		Venus\lib
23
 * @author    	Judicaël Paquet <[email protected]>
24
 * @copyright 	Copyright (c) 2013-2014 PAQUET Judicaël FR Inc. (https://github.com/las93)
25
 * @license   	https://github.com/las93/venus2/blob/master/LICENSE.md Tout droit réservé à PAQUET Judicaël
26
 * @version   	Release: 1.0.0
27
 * @filesource	https://github.com/las93/venus2
28
 * @link      	https://github.com/las93
29
 * @since     	1.0
30
 */
31
class Less
32
{
33
    /**
34
     * @var string
35
     */
36
    const LESS_WINDOWS = LESS_WINDOWS;
37
    
38
	/**
39
	 * translate the content
40
	 *
41
	 * @access public
42
	 * @param  mixed $sFile content to translate
43
	 * @return void
44
	 */
45
	public static function toCss(string $sFile)
46
	{
47
	    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
48
	        
49
	        $sCmd = self::LESS_WINDOWS." ".$sFile." --watch";
50
            $sContent = shell_exec($sCmd);
51
	    }
52
	    else {
53
	       
54
	        $sCmd = "lessc ".$sFile." --no-color 2>&1";
55
            $sContent = shell_exec($sCmd);
56
	    }
57
	    
58
        header("content-type:text/css");
59
        echo $sContent;
60
	}
61
}
62