| 1 | <?php |
| 2 | |
| 3 | require_once('Destructable.php'); |
| 4 | |
| 5 | class JavaScriptFunction extends Destructable { |
| 6 | protected $statement; |
| 7 | |
| 8 | public function __construct($statement, $instantiated = FALSE) { |
| 9 | $this->statement = $statement; |
| 10 | } |
| 11 | |
| 12 | public function __destruct() { |
| 13 | $this->mem_flush('statement'); |
| 14 | } |
| 15 | |
| 16 | public function type() { |
| 17 | return 'Function'; |
| 18 | } |
| 19 | |
| 20 | public function comments() { |
| 21 | return $this->statement->comments; |
| 22 | } |
| 23 | |
| 24 | public function body() { |
| 25 | return $this->statement->second; |
| 26 | } |
| 27 | |
| 28 | public function parameters() { |
| 29 | $parameters = array(); |
| 30 | foreach ($this->statement->first as $parameter) { |
| 31 | $parameters[] = (object)array( |
| 32 | 'name' => $parameter->value, |
| 33 | 'comments' => $parameter->comments |
| 34 | ); |
| 35 | } |
| 36 | return $parameters; |
| 37 | } |
| 38 | |
| 39 | public function __toString() { |
| 40 | return '(' . $this->type() . ')'; |
| 41 | } |
| 42 | } |