Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | require_once('Destructable.php'); |
---|
4 | |
---|
5 | class JavaScriptObject extends Destructable { |
---|
6 | protected $statement; |
---|
7 | protected $keys; |
---|
8 | |
---|
9 | public function __construct($statement) { |
---|
10 | $this->statement = $statement; |
---|
11 | } |
---|
12 | |
---|
13 | public function __destruct() { |
---|
14 | $this->mem_flush('statement', 'keys'); |
---|
15 | } |
---|
16 | |
---|
17 | public function type() { |
---|
18 | return 'Object'; |
---|
19 | } |
---|
20 | |
---|
21 | public function comments() { |
---|
22 | return $this->statement->comments; |
---|
23 | } |
---|
24 | |
---|
25 | public function values() { |
---|
26 | if (isset($this->keys)) { |
---|
27 | return $this->keys; |
---|
28 | } |
---|
29 | |
---|
30 | $keys = array(); |
---|
31 | foreach ($this->statement->first as $value) { |
---|
32 | if (is_array($value)) { |
---|
33 | $value = $value[0]; |
---|
34 | } |
---|
35 | $keys[$value->key][] = $value->convert(); |
---|
36 | } |
---|
37 | |
---|
38 | return ($this->keys = $keys); |
---|
39 | } |
---|
40 | |
---|
41 | public function __toString() { |
---|
42 | return '(' . $this->type() . ')'; |
---|
43 | } |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.