original_string: public static function get_effective_default_contextlevel_purpose_and_category($contextlevel, $forcedpurposevalue = false,
                                                                                     $forcedcategoryvalue = false, $component = '') {
          // Get the defaults for this context level.
          list($purposeid, $categoryid) = self::get_defaults($contextlevel, $component);
  
          // Honour forced values.
          if ($forcedpurposevalue) {
              $purposeid = $forcedpurposevalue;
          }
          if ($forcedcategoryvalue) {
              $categoryid = $forcedcategoryvalue;
          }
  
          if ($contextlevel == CONTEXT_USER) {
              // Only user context levels inherit from a parent context level.
              list($parentpurposeid, $parentcategoryid) = self::get_defaults(CONTEXT_SYSTEM);
  
              if (context_instance::INHERIT == $purposeid || context_instance::NOTSET == $purposeid) {
                  $purposeid = (int)$parentpurposeid;
              }
  
              if (context_instance::INHERIT == $categoryid || context_instance::NOTSET == $categoryid) {
                  $categoryid = $parentcategoryid;
              }
          }
  
          return [$purposeid, $categoryid];
      }
code: public static function get_effective_default_contextlevel_purpose_and_category($contextlevel, $forcedpurposevalue = false,
                                                                                     $forcedcategoryvalue = false, $component = '') {
          // Get the defaults for this context level.
          list($purposeid, $categoryid) = self::get_defaults($contextlevel, $component);
  
          // Honour forced values.
          if ($forcedpurposevalue) {
              $purposeid = $forcedpurposevalue;
          }
          if ($forcedcategoryvalue) {
              $categoryid = $forcedcategoryvalue;
          }
  
          if ($contextlevel == CONTEXT_USER) {
              // Only user context levels inherit from a parent context level.
              list($parentpurposeid, $parentcategoryid) = self::get_defaults(CONTEXT_SYSTEM);
  
              if (context_instance::INHERIT == $purposeid || context_instance::NOTSET == $purposeid) {
                  $purposeid = (int)$parentpurposeid;
              }
  
              if (context_instance::INHERIT == $categoryid || context_instance::NOTSET == $categoryid) {
                  $categoryid = $parentcategoryid;
              }
          }
  
          return [$purposeid, $categoryid];
      }
code_tokens: public static function get_effective_default_contextlevel_purpose_and_category ( $ contextlevel , $ forcedpurposevalue = false , $ forcedcategoryvalue = false , $ component = '' ) { // Get the defaults for this context level. list ( $ purposeid , $ categoryid ) = self :: get_defaults ( $ contextlevel , $ component ) ; // Honour forced values. if ( $ forcedpurposevalue ) { $ purposeid = $ forcedpurposevalue ; } if ( $ forcedcategoryvalue ) { $ categoryid = $ forcedcategoryvalue ; } if ( $ contextlevel == CONTEXT_USER ) { // Only user context levels inherit from a parent context level. list ( $ parentpurposeid , $ parentcategoryid ) = self :: get_defaults ( CONTEXT_SYSTEM ) ; if ( context_instance :: INHERIT == $ purposeid || context_instance :: NOTSET == $ purposeid ) { $ purposeid = ( int ) $ parentpurposeid ; } if ( context_instance :: INHERIT == $ categoryid || context_instance :: NOTSET == $ categoryid ) { $ categoryid = $ parentcategoryid ; } } return [ $ purposeid , $ categoryid ] ; }
docstring: Returns the effective default purpose and category for a context level.
  
  @param int $contextlevel
  @param int|bool $forcedpurposevalue Use this value as if this was this context level purpose.
  @param int|bool $forcedcategoryvalue Use this value as if this was this context level category.
  @param string $component The name of the component to check.
  @return int[]
docstring_tokens: Returns the effective default purpose and category for a context level .