Haanga_AST::is_expr PHP Method

is_expr() public static method

public static is_expr ( $arr )
    public static function is_expr($arr)
    {
        return self::check_type($arr, 'op_expr');
    }

Usage Example

Ejemplo n.º 1
0
 protected function check_expr(&$expr)
 {
     if (Haanga_AST::is_expr($expr)) {
         if ($expr['op_expr'] == 'in') {
             for ($id = 0; $id < 2; $id++) {
                 if ($this->is_var_filter($expr[$id])) {
                     $expr[$id] = $this->get_filtered_var($expr[$id]['var_filter'], $var);
                 }
             }
             if (Haanga_AST::is_str($expr[1])) {
                 $expr = hexpr(hexec('strpos', $expr[1], $expr[0]), '!==', FALSE);
             } else {
                 $expr = hexpr(hexpr_cond(hexec('is_array', $expr[1]), hexec('array_search', $expr[0], $expr[1]), hexec('strpos', $expr[1], $expr[0])), '!==', FALSE);
             }
         }
         if (is_object($expr)) {
             $expr = $expr->getArray();
         }
         $this->check_expr($expr[0]);
         $this->check_expr($expr[1]);
     } else {
         if (is_array($expr)) {
             if ($this->is_var_filter($expr)) {
                 $expr = $this->get_filtered_var($expr['var_filter'], $var);
             } else {
                 if (isset($expr['args'])) {
                     /* check every arguments */
                     foreach ($expr['args'] as &$v) {
                         $this->check_expr($v);
                     }
                     unset($v);
                 } else {
                     if (isset($expr['expr_cond'])) {
                         /* Check expr conditions */
                         $this->check_expr($expr['expr_cond']);
                         $this->check_expr($expr['true']);
                         $this->check_expr($expr['false']);
                     }
                 }
             }
         }
     }
 }