Asset   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 39
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
C replaceBy() 0 29 7
1
<?php
2
3
/**
4
 * Manage Template
5
 *
6
 * @category  	Venus
7
 * @package     Venus\lib\Functions
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: 3.0.0
12
 * @filesource	https://github.com/las93/venus2
13
 * @link      	https://github.com/las93
14
 * @since     	3.0.0
15
 */
16
namespace Venus\lib\Functions;
17
18
/**
19
 * This class manage the Template
20
 *
21
 * @category  	Venus
22
 * @package     Venus\lib\Functions
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: 3.0.0
27
 * @filesource	https://github.com/las93/venus2
28
 * @link      	https://github.com/las93
29
 * @since     	3.0.0
30
 */
31
class Asset 
32
{
33
	/**
34
	 * run before
35
	 *
36
	 * @access public
37
	 * @param  array $aParams parameters
38
	 * @return string
39
	 */
40
	public function replaceBy(array $aParams = array()) : string
41
	{
42
	    $aParams['template'] = trim(str_replace(["'", '"'], "", $aParams['template']));
43
	    
44
		if (isset($aParams['template'])) {
45
46
		    $aTemplates = explode(';', $aParams['template']);
47
		    $sGetUrl = 'getCss?';
48
		    
49
		    foreach ($aTemplates as $sTemplate) {
50
		     
51
    		    if (strstr($sTemplate, 'css/')) {
52
    			
53
    		        $sGetUrl .= $sTemplate.'&';
54
    		    }
55
    		    else if (strstr($sTemplate, 'js/')) {
56
    		        
57
    		        $sGetUrl .= $sTemplate.'&';
58
    		    }
59
		    }
60
		   
61
		    if (defined('ASSET_VERSION') && ASSET_VERSION !== false) {
62
		        
63
		        $sGetUrl .= ASSET_VERSION;
64
		    }
65
66
			return $sGetUrl;
67
		}
68
	}
69
}
70