source: Dev/trunk/src/client/util/docscripts/lib/parser2/JavaScriptOr.php

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 770 bytes
Line 
1<?php
2
3class JavaScriptOr extends JavaScriptVariable {
4  protected $ors;
5
6  public function __construct($ors) {
7    if (!is_array($ors)) {
8      throw new Exception('JavaScriptOr expects to be passed an array');
9    }
10    $this->ors = $ors;
11  }
12
13  public function __destruct() {
14    $this->mem_flush('ors');
15  }
16
17  public function types() {
18    $mapped = array();
19    foreach ($this->ors as $item) {
20      $mapped[] = $item->type();
21    }
22    return $mapped;
23  }
24
25  public function type() {
26    $types = array_diff($this->types(), array('variable'));
27    if (count($types) == 1) {
28      return array_pop($types);
29    }
30    // Assume that if one of them is a boolean, they all are
31    if (in_array('bool', $types)) {
32      return 'bool';
33    }
34
35    return 'Object';
36  }
37}
Note: See TracBrowser for help on using the repository browser.