Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from thisispiers/master
add “constant()” TSSFunction
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/* @description Transformation Style Sheets - Revolutionising PHP templating * | ||
* @author Tom Butler tom@r.je * | ||
* @copyright 2017 Tom Butler <tom@r.je> | https://r.je/ * | ||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License * | ||
* @version 1.2 */ | ||
namespace Transphporm\TSSFunction; | ||
/* Handles constant() function in the TSS stlyesheet */ | ||
class Constant implements \Transphporm\TSSFunction { | ||
public function run(array $args, \DomElement $element) { | ||
$const_name = strtoupper(trim($args[0])); | ||
if (!defined($const_name)) { | ||
throw new \Exception($const_name . ' is not a defined constant'); | ||
} | ||
return constant($const_name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters