original_string: public static function get_available_in_context($contexts) {
          $params = self::validate_parameters(self::get_available_in_context_parameters(), array('contexts' => $contexts));
          $filters = $warnings = array();
  
          foreach ($params['contexts'] as $contextinfo) {
              try {
                  $context = self::get_context_from_params($contextinfo);
                  self::validate_context($context);
                  $contextinfo['contextid'] = $context->id;
              } catch (Exception $e) {
                  $warnings[] = array(
                      'item' => 'context',
                      'itemid' => $context['instanceid'],
                      'warningcode' => $e->getCode(),
                      'message' => $e->getMessage(),
                  );
                  continue;
              }
              $contextfilters = filter_get_available_in_context($context);
  
              foreach ($contextfilters as $filter) {
                  $filters[] = array_merge($contextinfo, (array) $filter);
              }
          }
  
          return array(
              'filters' => $filters,
              'warnings' => $warnings,
          );
      }
code: public static function get_available_in_context($contexts) {
          $params = self::validate_parameters(self::get_available_in_context_parameters(), array('contexts' => $contexts));
          $filters = $warnings = array();
  
          foreach ($params['contexts'] as $contextinfo) {
              try {
                  $context = self::get_context_from_params($contextinfo);
                  self::validate_context($context);
                  $contextinfo['contextid'] = $context->id;
              } catch (Exception $e) {
                  $warnings[] = array(
                      'item' => 'context',
                      'itemid' => $context['instanceid'],
                      'warningcode' => $e->getCode(),
                      'message' => $e->getMessage(),
                  );
                  continue;
              }
              $contextfilters = filter_get_available_in_context($context);
  
              foreach ($contextfilters as $filter) {
                  $filters[] = array_merge($contextinfo, (array) $filter);
              }
          }
  
          return array(
              'filters' => $filters,
              'warnings' => $warnings,
          );
      }
code_tokens: public static function get_available_in_context ( $ contexts ) { $ params = self :: validate_parameters ( self :: get_available_in_context_parameters ( ) , array ( 'contexts' => $ contexts ) ) ; $ filters = $ warnings = array ( ) ; foreach ( $ params [ 'contexts' ] as $ contextinfo ) { try { $ context = self :: get_context_from_params ( $ contextinfo ) ; self :: validate_context ( $ context ) ; $ contextinfo [ 'contextid' ] = $ context -> id ; } catch ( Exception $ e ) { $ warnings [ ] = array ( 'item' => 'context' , 'itemid' => $ context [ 'instanceid' ] , 'warningcode' => $ e -> getCode ( ) , 'message' => $ e -> getMessage ( ) , ) ; continue ; } $ contextfilters = filter_get_available_in_context ( $ context ) ; foreach ( $ contextfilters as $ filter ) { $ filters [ ] = array_merge ( $ contextinfo , ( array ) $ filter ) ; } } return array ( 'filters' => $ filters , 'warnings' => $ warnings , ) ; }
docstring: Returns the filters available in the given contexts.
  
  @param array $contexts the list of contexts to check
  @return array with the filters information and warnings
  @since Moodle 3.4
docstring_tokens: Returns the filters available in the given contexts .