original_string: public static function search_courses_count($search, $options = array(), $requiredcapabilities = array()) {
          $coursecatcache = cache::make('core', 'coursecat');
          $cntcachekey = 'scnt-'. serialize($search) . serialize($requiredcapabilities);
          if (($cnt = $coursecatcache->get($cntcachekey)) === false) {
              // Cached value not found. Retrieve ALL courses and return their count.
              unset($options['offset']);
              unset($options['limit']);
              unset($options['summary']);
              unset($options['coursecontacts']);
              $options['idonly'] = true;
              $courses = self::search_courses($search, $options, $requiredcapabilities);
              $cnt = count($courses);
          }
          return $cnt;
      }
code: public static function search_courses_count($search, $options = array(), $requiredcapabilities = array()) {
          $coursecatcache = cache::make('core', 'coursecat');
          $cntcachekey = 'scnt-'. serialize($search) . serialize($requiredcapabilities);
          if (($cnt = $coursecatcache->get($cntcachekey)) === false) {
              // Cached value not found. Retrieve ALL courses and return their count.
              unset($options['offset']);
              unset($options['limit']);
              unset($options['summary']);
              unset($options['coursecontacts']);
              $options['idonly'] = true;
              $courses = self::search_courses($search, $options, $requiredcapabilities);
              $cnt = count($courses);
          }
          return $cnt;
      }
code_tokens: public static function search_courses_count ( $ search , $ options = array ( ) , $ requiredcapabilities = array ( ) ) { $ coursecatcache = cache :: make ( 'core' , 'coursecat' ) ; $ cntcachekey = 'scnt-' . serialize ( $ search ) . serialize ( $ requiredcapabilities ) ; if ( ( $ cnt = $ coursecatcache -> get ( $ cntcachekey ) ) === false ) { // Cached value not found. Retrieve ALL courses and return their count. unset ( $ options [ 'offset' ] ) ; unset ( $ options [ 'limit' ] ) ; unset ( $ options [ 'summary' ] ) ; unset ( $ options [ 'coursecontacts' ] ) ; $ options [ 'idonly' ] = true ; $ courses = self :: search_courses ( $ search , $ options , $ requiredcapabilities ) ; $ cnt = count ( $ courses ) ; } return $ cnt ; }
docstring: Returns number of courses in the search results
  
  It is recommended to call this function after {@link core_course_category::search_courses()}
  and not before because only course ids are cached. Otherwise search_courses() may
  perform extra DB queries.
  
  @param array $search search criteria, see method search_courses() for more details
  @param array $options display options. They do not affect the result but
  the 'sort' property is used in cache key for storing list of course ids
  @param array $requiredcapabilities List of capabilities required to see return course.
  @return int
docstring_tokens: Returns number of courses in the search results