original_string: protected function can_expand_course($course) {
          $cache = $this->get_expand_course_cache();
          $canexpand = $cache->get($course->id);
          if ($canexpand === false) {
              $canexpand = isloggedin() && can_access_course($course, null, '', true);
              $canexpand = (int)$canexpand;
              $cache->set($course->id, $canexpand);
          }
          return ($canexpand === 1);
      }
code: protected function can_expand_course($course) {
          $cache = $this->get_expand_course_cache();
          $canexpand = $cache->get($course->id);
          if ($canexpand === false) {
              $canexpand = isloggedin() && can_access_course($course, null, '', true);
              $canexpand = (int)$canexpand;
              $cache->set($course->id, $canexpand);
          }
          return ($canexpand === 1);
      }
code_tokens: protected function can_expand_course ( $ course ) { $ cache = $ this -> get_expand_course_cache ( ) ; $ canexpand = $ cache -> get ( $ course -> id ) ; if ( $ canexpand === false ) { $ canexpand = isloggedin ( ) && can_access_course ( $ course , null , '' , true ) ; $ canexpand = ( int ) $ canexpand ; $ cache -> set ( $ course -> id , $ canexpand ) ; } return ( $ canexpand === 1 ) ; }
docstring: Checks if a user can expand a course in the navigation.
  
  We use a cache here because in order to be accurate we need to call can_access_course which is a costly function.
  Because this functionality is basic + non-essential and because we lack good event triggering this cache
  permits stale data.
  In the situation the user is granted access to a course after we've initialised this session cache the cache
  will be stale.
  It is brought up to date in only one of two ways.
  1. The user logs out and in again.
  2. The user browses to the course they've just being given access to.
  
  Really all this controls is whether the node is shown as expandable or not. It is uber un-important.
  
  @param stdClass $course
  @return bool
docstring_tokens: Checks if a user can expand a course in the navigation .