original_string: protected static function get_expiry_info(purpose $purpose, int $comparisondate = 0) : expiry_info {
          $overrides = $purpose->get_purpose_overrides();
          $expiredroles = $unexpiredroles = [];
          if (empty($overrides)) {
              // There are no overrides for this purpose.
              if (empty($comparisondate)) {
                  // The date is empty, therefore this context cannot be considered for automatic expiry.
                  $defaultexpired = false;
              } else {
                  $defaultexpired = static::has_expired($purpose->get('retentionperiod'), $comparisondate);
              }
  
              return new expiry_info($defaultexpired, $purpose->get('protected'), [], [], []);
          } else {
              $protectedroles = [];
              foreach ($overrides as $override) {
                  if (static::has_expired($override->get('retentionperiod'), $comparisondate)) {
                      // This role has expired.
                      $expiredroles[] = $override->get('roleid');
                  } else {
                      // This role has not yet expired.
                      $unexpiredroles[] = $override->get('roleid');
  
                      if ($override->get('protected')) {
                          $protectedroles[$override->get('roleid')] = true;
                      }
                  }
              }
  
              $defaultexpired = false;
              if (static::has_expired($purpose->get('retentionperiod'), $comparisondate)) {
                  $defaultexpired = true;
              }
  
              if ($defaultexpired) {
                  $expiredroles = [];
              }
  
              return new expiry_info($defaultexpired, $purpose->get('protected'), $expiredroles, $unexpiredroles, $protectedroles);
          }
      }
code: protected static function get_expiry_info(purpose $purpose, int $comparisondate = 0) : expiry_info {
          $overrides = $purpose->get_purpose_overrides();
          $expiredroles = $unexpiredroles = [];
          if (empty($overrides)) {
              // There are no overrides for this purpose.
              if (empty($comparisondate)) {
                  // The date is empty, therefore this context cannot be considered for automatic expiry.
                  $defaultexpired = false;
              } else {
                  $defaultexpired = static::has_expired($purpose->get('retentionperiod'), $comparisondate);
              }
  
              return new expiry_info($defaultexpired, $purpose->get('protected'), [], [], []);
          } else {
              $protectedroles = [];
              foreach ($overrides as $override) {
                  if (static::has_expired($override->get('retentionperiod'), $comparisondate)) {
                      // This role has expired.
                      $expiredroles[] = $override->get('roleid');
                  } else {
                      // This role has not yet expired.
                      $unexpiredroles[] = $override->get('roleid');
  
                      if ($override->get('protected')) {
                          $protectedroles[$override->get('roleid')] = true;
                      }
                  }
              }
  
              $defaultexpired = false;
              if (static::has_expired($purpose->get('retentionperiod'), $comparisondate)) {
                  $defaultexpired = true;
              }
  
              if ($defaultexpired) {
                  $expiredroles = [];
              }
  
              return new expiry_info($defaultexpired, $purpose->get('protected'), $expiredroles, $unexpiredroles, $protectedroles);
          }
      }
code_tokens: protected static function get_expiry_info ( purpose $ purpose , int $ comparisondate = 0 ) : expiry_info { $ overrides = $ purpose -> get_purpose_overrides ( ) ; $ expiredroles = $ unexpiredroles = [ ] ; if ( empty ( $ overrides ) ) { // There are no overrides for this purpose. if ( empty ( $ comparisondate ) ) { // The date is empty, therefore this context cannot be considered for automatic expiry. $ defaultexpired = false ; } else { $ defaultexpired = static :: has_expired ( $ purpose -> get ( 'retentionperiod' ) , $ comparisondate ) ; } return new expiry_info ( $ defaultexpired , $ purpose -> get ( 'protected' ) , [ ] , [ ] , [ ] ) ; } else { $ protectedroles = [ ] ; foreach ( $ overrides as $ override ) { if ( static :: has_expired ( $ override -> get ( 'retentionperiod' ) , $ comparisondate ) ) { // This role has expired. $ expiredroles [ ] = $ override -> get ( 'roleid' ) ; } else { // This role has not yet expired. $ unexpiredroles [ ] = $ override -> get ( 'roleid' ) ; if ( $ override -> get ( 'protected' ) ) { $ protectedroles [ $ override -> get ( 'roleid' ) ] = true ; } } } $ defaultexpired = false ; if ( static :: has_expired ( $ purpose -> get ( 'retentionperiod' ) , $ comparisondate ) ) { $ defaultexpired = true ; } if ( $ defaultexpired ) { $ expiredroles = [ ] ; } return new expiry_info ( $ defaultexpired , $ purpose -> get ( 'protected' ) , $ expiredroles , $ unexpiredroles , $ protectedroles ) ; } }
docstring: Get the expiry info object for the specified purpose and comparison date.
  
  @param   purpose     $purpose The purpose of this context
  @param   int         $comparisondate The date for comparison
  @return  expiry_info
docstring_tokens: Get the expiry info object for the specified purpose and comparison date .