Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
85.71% |
6 / 7 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Less_Tree_DefaultFunc | |
85.71% |
6 / 7 |
|
75.00% |
3 / 4 |
7.14 | |
0.00% |
0 / 1 |
| compile | |
75.00% |
3 / 4 |
|
0.00% |
0 / 1 |
4.25 | |||
| value | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| error | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| reset | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @private |
| 4 | */ |
| 5 | class Less_Tree_DefaultFunc { |
| 6 | |
| 7 | /** @var string|null */ |
| 8 | private static $error_; |
| 9 | /** @var int|null */ |
| 10 | private static $value_; |
| 11 | |
| 12 | public static function compile() { |
| 13 | if ( self::$error_ ) { |
| 14 | throw new Exception( self::$error_ ); |
| 15 | } |
| 16 | if ( self::$value_ !== null ) { |
| 17 | return self::$value_ ? new Less_Tree_Keyword( 'true' ) : new Less_Tree_Keyword( 'false' ); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | public static function value( $v ) { |
| 22 | self::$value_ = $v; |
| 23 | } |
| 24 | |
| 25 | public static function error( $e ) { |
| 26 | self::$error_ = $e; |
| 27 | } |
| 28 | |
| 29 | public static function reset() { |
| 30 | self::$value_ = self::$error_ = null; |
| 31 | } |
| 32 | } |