original_string: public static function create_from_expiry_info(\context $context, expiry_info $info, bool $save = true) : expired_context {
          $record = (object) [
              'contextid' => $context->id,
              'status' => self::STATUS_EXPIRED,
              'defaultexpired' => (int) $info->is_default_expired(),
          ];
  
          $expiredcontext = new static(0, $record);
          $expiredcontext->set('expiredroles', $info->get_expired_roles());
          $expiredcontext->set('unexpiredroles', $info->get_unexpired_roles());
  
          if ($save) {
              $expiredcontext->save();
          }
  
          return $expiredcontext;
      }
code: public static function create_from_expiry_info(\context $context, expiry_info $info, bool $save = true) : expired_context {
          $record = (object) [
              'contextid' => $context->id,
              'status' => self::STATUS_EXPIRED,
              'defaultexpired' => (int) $info->is_default_expired(),
          ];
  
          $expiredcontext = new static(0, $record);
          $expiredcontext->set('expiredroles', $info->get_expired_roles());
          $expiredcontext->set('unexpiredroles', $info->get_unexpired_roles());
  
          if ($save) {
              $expiredcontext->save();
          }
  
          return $expiredcontext;
      }
code_tokens: public static function create_from_expiry_info ( \ context $ context , expiry_info $ info , bool $ save = true ) : expired_context { $ record = ( object ) [ 'contextid' => $ context -> id , 'status' => self :: STATUS_EXPIRED , 'defaultexpired' => ( int ) $ info -> is_default_expired ( ) , ] ; $ expiredcontext = new static ( 0 , $ record ) ; $ expiredcontext -> set ( 'expiredroles' , $ info -> get_expired_roles ( ) ) ; $ expiredcontext -> set ( 'unexpiredroles' , $ info -> get_unexpired_roles ( ) ) ; if ( $ save ) { $ expiredcontext -> save ( ) ; } return $ expiredcontext ; }
docstring: Create a new expired_context based on the context, and expiry_info object.
  
  @param   \context        $context
  @param   expiry_info     $info
  @param   boolean         $save
  @return  expired_context
docstring_tokens: Create a new expired_context based on the context and expiry_info object .