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