Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/BooleanLiteral.php

raw
1 <?php
2 /**
3 * This file is part of the Peast package
4 *
5 * (c) Marco Marchiò <[email protected]>
6 *
7 * For the full copyright and license information refer to the LICENSE file
8 * distributed with this source code
9 */
10 namespace Peast\Syntax\Node;
11
12 /**
13 * A node that represents a boolean literal.
14 *
15 * @author Marco Marchiò <[email protected]>
16 */
17 class BooleanLiteral extends Literal
18 {
19 /**
20 * Sets node's value
21 *
22 * @param mixed $value Value
23 *
24 * @return $this
25 */
26 public function setValue($value)
27 {
28 if ($value === "true") {
29 $this->value = true;
30 } elseif ($value === "false") {
31 $this->value = false;
32 } else {
33 $this->value = (bool) $value;
34 }
35 $this->raw = $this->value ? "true" : "false";
36 return $this;
37 }
38 }