original_string: final public static function get_create_structure() {
          $properties = self::properties_definition();
          $returns = array();
  
          foreach ($properties as $property => $definition) {
              if ($property == 'id') {
                  // The can not be set on create.
                  continue;
  
              } else if (isset($returns[$property]) && substr($property, -6) === 'format') {
                  // We've already treated the format.
                  continue;
              }
  
              $required = VALUE_REQUIRED;
              $default = null;
  
              // We cannot use isset here because we want to detect nulls.
              if (array_key_exists('default', $definition)) {
                  $required = VALUE_DEFAULT;
                  $default = $definition['default'];
              }
  
              // Magically treat the contextid fields.
              if ($property == 'contextid') {
                  if (isset($properties['context'])) {
                      throw new coding_exception('There cannot be a context and a contextid column');
                  }
                  $returns += self::get_context_structure();
  
              } else {
                  $returns[$property] = new external_value($definition['type'], $definition['description'], $required, $default,
                      $definition['null']);
  
                  // Magically treat the format properties.
                  if ($formatproperty = self::get_format_field($properties, $property)) {
                      if (isset($returns[$formatproperty])) {
                          throw new coding_exception('The format for \'' . $property . '\' is already defined.');
                      }
                      $returns[$formatproperty] = self::get_format_structure($property,
                          $properties[$formatproperty], VALUE_REQUIRED);
                  }
              }
          }
  
          return new external_single_structure($returns);
      }
code: final public static function get_create_structure() {
          $properties = self::properties_definition();
          $returns = array();
  
          foreach ($properties as $property => $definition) {
              if ($property == 'id') {
                  // The can not be set on create.
                  continue;
  
              } else if (isset($returns[$property]) && substr($property, -6) === 'format') {
                  // We've already treated the format.
                  continue;
              }
  
              $required = VALUE_REQUIRED;
              $default = null;
  
              // We cannot use isset here because we want to detect nulls.
              if (array_key_exists('default', $definition)) {
                  $required = VALUE_DEFAULT;
                  $default = $definition['default'];
              }
  
              // Magically treat the contextid fields.
              if ($property == 'contextid') {
                  if (isset($properties['context'])) {
                      throw new coding_exception('There cannot be a context and a contextid column');
                  }
                  $returns += self::get_context_structure();
  
              } else {
                  $returns[$property] = new external_value($definition['type'], $definition['description'], $required, $default,
                      $definition['null']);
  
                  // Magically treat the format properties.
                  if ($formatproperty = self::get_format_field($properties, $property)) {
                      if (isset($returns[$formatproperty])) {
                          throw new coding_exception('The format for \'' . $property . '\' is already defined.');
                      }
                      $returns[$formatproperty] = self::get_format_structure($property,
                          $properties[$formatproperty], VALUE_REQUIRED);
                  }
              }
          }
  
          return new external_single_structure($returns);
      }
code_tokens: final public static function get_create_structure ( ) { $ properties = self :: properties_definition ( ) ; $ returns = array ( ) ; foreach ( $ properties as $ property => $ definition ) { if ( $ property == 'id' ) { // The can not be set on create. continue ; } else if ( isset ( $ returns [ $ property ] ) && substr ( $ property , - 6 ) === 'format' ) { // We've already treated the format. continue ; } $ required = VALUE_REQUIRED ; $ default = null ; // We cannot use isset here because we want to detect nulls. if ( array_key_exists ( 'default' , $ definition ) ) { $ required = VALUE_DEFAULT ; $ default = $ definition [ 'default' ] ; } // Magically treat the contextid fields. if ( $ property == 'contextid' ) { if ( isset ( $ properties [ 'context' ] ) ) { throw new coding_exception ( 'There cannot be a context and a contextid column' ) ; } $ returns += self :: get_context_structure ( ) ; } else { $ returns [ $ property ] = new external_value ( $ definition [ 'type' ] , $ definition [ 'description' ] , $ required , $ default , $ definition [ 'null' ] ) ; // Magically treat the format properties. if ( $ formatproperty = self :: get_format_field ( $ properties , $ property ) ) { if ( isset ( $ returns [ $ formatproperty ] ) ) { throw new coding_exception ( 'The format for \'' . $ property . '\' is already defined.' ) ; } $ returns [ $ formatproperty ] = self :: get_format_structure ( $ property , $ properties [ $ formatproperty ] , VALUE_REQUIRED ) ; } } } return new external_single_structure ( $ returns ) ; }
docstring: Returns the create structure.
  
  @return external_single_structure
docstring_tokens: Returns the create structure .