|
Revision 6093, 1.3 kB
(checked in by pottedmeat, 2 years ago)
|
|
Bug work
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | require_once('DojoParameter.php'); |
|---|
| 4 | require_once('DojoBlock.php'); |
|---|
| 5 | |
|---|
| 6 | class DojoParameters extends DojoBlock |
|---|
| 7 | { |
|---|
| 8 | private $object = 'DojoParameters'; |
|---|
| 9 | |
|---|
| 10 | private $parameters = array(); |
|---|
| 11 | protected $terminator = ')'; |
|---|
| 12 | |
|---|
| 13 | public function __construct($package, $line_number = false, $position = false) |
|---|
| 14 | { |
|---|
| 15 | parent::__construct($package, $line_number, $position); |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | public function build() |
|---|
| 19 | { |
|---|
| 20 | if (!$this->start) { |
|---|
| 21 | die("DojoFunctionCall->build() used before setting a start position"); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | $code = $this->package->getCode(); |
|---|
| 25 | $end = array($this->start[0], $this->start[1]); |
|---|
| 26 | |
|---|
| 27 | do { |
|---|
| 28 | $parameter = new DojoParameter($this->package, $end[0], $end[1], $this->terminator); |
|---|
| 29 | $end = $parameter->build(); |
|---|
| 30 | |
|---|
| 31 | $this->parameters[] = $parameter; |
|---|
| 32 | } |
|---|
| 33 | while ($code[$end[0]]{$end[1]} != $this->terminator); |
|---|
| 34 | |
|---|
| 35 | $this->setEnd($end[0], $end[1]); |
|---|
| 36 | return $end; |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | public function getParameter($pos) |
|---|
| 40 | { |
|---|
| 41 | if ($this->parameters && !empty($this->parameters[$pos])) { |
|---|
| 42 | return $this->parameters[$pos]; |
|---|
| 43 | } |
|---|
| 44 | else { |
|---|
| 45 | return new DojoParameter($this->package); |
|---|
| 46 | } |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | public function getParameters() |
|---|
| 50 | { |
|---|
| 51 | if ($this->parameters) { |
|---|
| 52 | return $this->parameters; |
|---|
| 53 | } |
|---|
| 54 | else { |
|---|
| 55 | return array(); |
|---|
| 56 | } |
|---|
| 57 | } |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | ?> |
|---|