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

Constant::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 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