original_string: public function merge_with_child(expiry_info $child) : expiry_info {
          if ($child->is_fully_expired()) {
              return $this;
          }
  
          // If the child is not fully expired, then none of the parents can be either.
          $this->fullyexpired = false;
  
          // Remove any role in this node which is not expired in the child.
          foreach ($this->expired as $key => $roleid) {
              if (!$child->is_role_expired($roleid)) {
                  unset($this->expired[$key]);
              }
          }
  
          array_merge($this->unexpired, $child->get_unexpired_roles());
  
          if (!$child->is_default_expired()) {
              $this->defaultexpiryreached = false;
          }
  
          return $this;
      }
code: public function merge_with_child(expiry_info $child) : expiry_info {
          if ($child->is_fully_expired()) {
              return $this;
          }
  
          // If the child is not fully expired, then none of the parents can be either.
          $this->fullyexpired = false;
  
          // Remove any role in this node which is not expired in the child.
          foreach ($this->expired as $key => $roleid) {
              if (!$child->is_role_expired($roleid)) {
                  unset($this->expired[$key]);
              }
          }
  
          array_merge($this->unexpired, $child->get_unexpired_roles());
  
          if (!$child->is_default_expired()) {
              $this->defaultexpiryreached = false;
          }
  
          return $this;
      }
code_tokens: public function merge_with_child ( expiry_info $ child ) : expiry_info { if ( $ child -> is_fully_expired ( ) ) { return $ this ; } // If the child is not fully expired, then none of the parents can be either. $ this -> fullyexpired = false ; // Remove any role in this node which is not expired in the child. foreach ( $ this -> expired as $ key => $ roleid ) { if ( ! $ child -> is_role_expired ( $ roleid ) ) { unset ( $ this -> expired [ $ key ] ) ; } } array_merge ( $ this -> unexpired , $ child -> get_unexpired_roles ( ) ) ; if ( ! $ child -> is_default_expired ( ) ) { $ this -> defaultexpiryreached = false ; } return $ this ; }
docstring: Merge this expiry_info object with another belonging to a child context in order to set the 'safest' heritage.
  
  It is not possible to delete any part of a context that is not deleted by a parent.
  So if a course's retention policy has been reached, then only parts where the children have also expired can be
  deleted.
  
  @param   expiry_info $child The child record to merge with.
  @return  $this
docstring_tokens: Merge this expiry_info object with another belonging to a child context in order to set the safest heritage .