Completed
Push — master ( 1c2473...022040 )
by Tom
02:55 queued 01:10
created

Constant   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 9
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 7 2
1
<?php
2
/* @description     Transformation Style Sheets - Revolutionising PHP templating    *
3
 * @author          Tom Butler [email protected]                                             *
4
 * @copyright       2017 Tom Butler <[email protected]> | https://r.je/                      *
5
 * @license         http://www.opensource.org/licenses/bsd-license.php  BSD License *
6
 * @version         1.2                                                             */
7
namespace Transphporm\TSSFunction;
8
/* Handles constant() function in the TSS stlyesheet */
9
class Constant implements \Transphporm\TSSFunction {
10
	public function run(array $args, \DomElement $element) {
11
		$const_name = strtoupper(trim($args[0]));
12
		if (!defined($const_name)) {
13
			throw new \Exception($const_name . ' is not a defined constant');
14
		}
15
		return constant($const_name);
16
	}
17
}
18