original_string: public static function get_nested_json(array $children, $op = self::OP_AND) {
  
          // Check $op and work out its type.
          switch($op) {
              case self::OP_AND:
              case self::OP_NOT_OR:
              case self::OP_OR:
              case self::OP_NOT_AND:
                  break;
              default:
                  throw new \coding_exception('Invalid $op');
          }
  
          // Do simple tree.
          $result = new \stdClass();
          $result->op = $op;
          $result->c = $children;
          return $result;
      }
code: public static function get_nested_json(array $children, $op = self::OP_AND) {
  
          // Check $op and work out its type.
          switch($op) {
              case self::OP_AND:
              case self::OP_NOT_OR:
              case self::OP_OR:
              case self::OP_NOT_AND:
                  break;
              default:
                  throw new \coding_exception('Invalid $op');
          }
  
          // Do simple tree.
          $result = new \stdClass();
          $result->op = $op;
          $result->c = $children;
          return $result;
      }
code_tokens: public static function get_nested_json ( array $ children , $ op = self :: OP_AND ) { // Check $op and work out its type. switch ( $ op ) { case self :: OP_AND : case self :: OP_NOT_OR : case self :: OP_OR : case self :: OP_NOT_AND : break ; default : throw new \ coding_exception ( 'Invalid $op' ) ; } // Do simple tree. $ result = new \ stdClass ( ) ; $ result -> op = $ op ; $ result -> c = $ children ; return $ result ; }
docstring: Returns a JSON object which corresponds to a tree.
  
  Intended for unit testing, as normally the JSON values are constructed
  by JavaScript code.
  
  This function generates 'nested' (i.e. not root-level) trees.
  
  @param array $children Array of JSON objects from component children
  @param string $op Operator (tree::OP_xx)
  @return stdClass JSON object
  @throws coding_exception If you get parameters wrong
docstring_tokens: Returns a JSON object which corresponds to a tree .