original_string: public function update_from_expiry_info(expiry_info $info) : expired_context {
          $save = false;
  
          // Compare the expiredroles.
          $thisexpired = $this->get('expiredroles');
          $infoexpired = $info->get_expired_roles();
  
          sort($thisexpired);
          sort($infoexpired);
          if ($infoexpired != $thisexpired) {
              $this->set('expiredroles', $infoexpired);
              $save = true;
          }
  
          // Compare the unexpiredroles.
          $thisunexpired = $this->get('unexpiredroles');
          $infounexpired = $info->get_unexpired_roles();
  
          sort($thisunexpired);
          sort($infounexpired);
          if ($infounexpired != $thisunexpired) {
              $this->set('unexpiredroles', $infounexpired);
              $save = true;
          }
  
          if (empty($this->get('defaultexpired')) == $info->is_default_expired()) {
              $this->set('defaultexpired', (int) $info->is_default_expired());
              $save = true;
          }
  
          if ($save) {
              $this->set('status', self::STATUS_EXPIRED);
              $this->save();
          }
  
          return $this;
  
      }
code: public function update_from_expiry_info(expiry_info $info) : expired_context {
          $save = false;
  
          // Compare the expiredroles.
          $thisexpired = $this->get('expiredroles');
          $infoexpired = $info->get_expired_roles();
  
          sort($thisexpired);
          sort($infoexpired);
          if ($infoexpired != $thisexpired) {
              $this->set('expiredroles', $infoexpired);
              $save = true;
          }
  
          // Compare the unexpiredroles.
          $thisunexpired = $this->get('unexpiredroles');
          $infounexpired = $info->get_unexpired_roles();
  
          sort($thisunexpired);
          sort($infounexpired);
          if ($infounexpired != $thisunexpired) {
              $this->set('unexpiredroles', $infounexpired);
              $save = true;
          }
  
          if (empty($this->get('defaultexpired')) == $info->is_default_expired()) {
              $this->set('defaultexpired', (int) $info->is_default_expired());
              $save = true;
          }
  
          if ($save) {
              $this->set('status', self::STATUS_EXPIRED);
              $this->save();
          }
  
          return $this;
  
      }
code_tokens: public function update_from_expiry_info ( expiry_info $ info ) : expired_context { $ save = false ; // Compare the expiredroles. $ thisexpired = $ this -> get ( 'expiredroles' ) ; $ infoexpired = $ info -> get_expired_roles ( ) ; sort ( $ thisexpired ) ; sort ( $ infoexpired ) ; if ( $ infoexpired != $ thisexpired ) { $ this -> set ( 'expiredroles' , $ infoexpired ) ; $ save = true ; } // Compare the unexpiredroles. $ thisunexpired = $ this -> get ( 'unexpiredroles' ) ; $ infounexpired = $ info -> get_unexpired_roles ( ) ; sort ( $ thisunexpired ) ; sort ( $ infounexpired ) ; if ( $ infounexpired != $ thisunexpired ) { $ this -> set ( 'unexpiredroles' , $ infounexpired ) ; $ save = true ; } if ( empty ( $ this -> get ( 'defaultexpired' ) ) == $ info -> is_default_expired ( ) ) { $ this -> set ( 'defaultexpired' , ( int ) $ info -> is_default_expired ( ) ) ; $ save = true ; } if ( $ save ) { $ this -> set ( 'status' , self :: STATUS_EXPIRED ) ; $ this -> save ( ) ; } return $ this ; }
docstring: Update the expired_context from an expiry_info object which relates to this context.
  
  @param   expiry_info     $info
  @return  $this
docstring_tokens: Update the expired_context from an expiry_info object which relates to this context .