original_string: protected function get_purpose_for_expiry(expired_context $expiredcontext) : purpose {
          $context = context_helper::instance_by_id($expiredcontext->get('contextid'));
  
          if (empty($this->purposemap[$context->id])) {
              $purpose = api::get_effective_context_purpose($context);
              $this->purposemap[$context->id] = $purpose->get('id');
  
              if (empty($this->purposes[$purpose->get('id')])) {
                  $this->purposes[$purpose->get('id')] = $purpose;
              }
          }
  
          return $this->purposes[$this->purposemap[$context->id]];
      }
code: protected function get_purpose_for_expiry(expired_context $expiredcontext) : purpose {
          $context = context_helper::instance_by_id($expiredcontext->get('contextid'));
  
          if (empty($this->purposemap[$context->id])) {
              $purpose = api::get_effective_context_purpose($context);
              $this->purposemap[$context->id] = $purpose->get('id');
  
              if (empty($this->purposes[$purpose->get('id')])) {
                  $this->purposes[$purpose->get('id')] = $purpose;
              }
          }
  
          return $this->purposes[$this->purposemap[$context->id]];
      }
code_tokens: protected function get_purpose_for_expiry ( expired_context $ expiredcontext ) : purpose { $ context = context_helper :: instance_by_id ( $ expiredcontext -> get ( 'contextid' ) ) ; if ( empty ( $ this -> purposemap [ $ context -> id ] ) ) { $ purpose = api :: get_effective_context_purpose ( $ context ) ; $ this -> purposemap [ $ context -> id ] = $ purpose -> get ( 'id' ) ; if ( empty ( $ this -> purposes [ $ purpose -> get ( 'id' ) ] ) ) { $ this -> purposes [ $ purpose -> get ( 'id' ) ] = $ purpose ; } } return $ this -> purposes [ $ this -> purposemap [ $ context -> id ] ] ; }
docstring: Get the purpose for the specified expired context.
  
  @param   expired_context $expiredcontext
  @return  purpose
docstring_tokens: Get the purpose for the specified expired context .