1: <?php
2: namespace Pharborist\Types;
3:
4: use Pharborist\Constants\ConstantNode;
5:
6: /**
7: * Base class for TRUE and FALSE.
8: *
9: * @see TrueNode
10: * @see FalseNode
11: */
12: abstract class BooleanNode extends ConstantNode implements ScalarNode {
13: /**
14: * Creates a BooleanNode.
15: *
16: * @param mixed $boolean
17: * The boolean to create. Pass a truthy value for TrueNode, falsy for FalseNode.
18: *
19: * @return BooleanNode
20: */
21: public static function create($boolean) {
22: if ($boolean) {
23: return TrueNode::create();
24: }
25: else {
26: return FalseNode::create();
27: }
28: }
29:
30: /**
31: * Returns the boolean value of constant.
32: *
33: * @return boolean
34: */
35: abstract public function toValue();
36: }
37: