public static function parse($term, Context $ctx = null)
 {
     $obj = new self(new Scanner($term));
     return $obj->reduce($ctx ?: new Context());
 }
Example #2
0
 public function reduceRight($collection = null, $iterator = null, $memo = null)
 {
     list($collection, $iterator, $memo) = self::_wrapArgs(func_get_args(), 3);
     if (!is_object($collection) && !is_array($collection)) {
         if (is_null($memo)) {
             throw new Exception('Invalid object');
         } else {
             return self::_wrap($memo);
         }
     }
     krsort($collection);
     $__ = new self();
     return self::_wrap($__->reduce($collection, $iterator, $memo));
 }
 public static function reduceRight($collection = null, $iterator = null, $memo = null)
 {
     if (!is_object($collection) && !is_array($collection)) {
         if (is_null($memo)) {
             throw new Exception('Invalid object');
         } else {
             return $memo;
         }
     }
     krsort($collection);
     $__ = new self();
     return $__->reduce($collection, $iterator, $memo);
 }