summaryrefslogtreecommitdiff
path: root/src/ste/VariableNode.php
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-04-30 09:38:05 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-04-30 09:38:25 +0200
commit2381c52c690342f773a7cfa500387b6bfad76952 (patch)
tree340296ea529e40b81012c936703429a86481788e /src/ste/VariableNode.php
parent2d26169b367af60cbc03d417c09918f50aa3b882 (diff)
downloadste-2381c52c690342f773a7cfa500387b6bfad76952.tar.gz
ste-2381c52c690342f773a7cfa500387b6bfad76952.tar.bz2
ste-2381c52c690342f773a7cfa500387b6bfad76952.zip
Automatic code formatting
Also add git hooks that checks formatting
Diffstat (limited to 'src/ste/VariableNode.php')
-rw-r--r--src/ste/VariableNode.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ste/VariableNode.php b/src/ste/VariableNode.php
index 18bb6a4..d03fdce 100644
--- a/src/ste/VariableNode.php
+++ b/src/ste/VariableNode.php
@@ -2,19 +2,21 @@
namespace kch42\ste;
-class VariableNode extends ASTNode {
+class VariableNode extends ASTNode
+{
public $name;
public $arrayfields = array();
- public function transcompile() {
+ public function transcompile()
+ {
$varaccess = '@$ste->scope[' . (is_numeric($this->name) ? $this->name : '"' . Misc::escape_text($this->name) . '"'). ']';
- foreach($this->arrayfields as $af) {
- if((count($af) == 1) and ($af[0] instanceof TextNode) and is_numeric($af[0]->text)) {
+ foreach ($this->arrayfields as $af) {
+ if ((count($af) == 1) and ($af[0] instanceof TextNode) and is_numeric($af[0]->text)) {
$varaccess .= '[' . $af->text . ']';
} else {
- $varaccess .= '[' . implode(".", array_map(function($node) {
- if($node instanceof TextNode) {
+ $varaccess .= '[' . implode(".", array_map(function ($node) {
+ if ($node instanceof TextNode) {
return "\"" . Misc::escape_text($node->text) . "\"";
- } else if($node instanceof VariableNode) {
+ } elseif ($node instanceof VariableNode) {
return $node->transcompile();
}
}, $af)). ']';