You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
824 B
44 lines
824 B
<?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() . ')'; |
|
} |
|
} |