original_string: protected function validate_category(category_controller $category) : category_controller {
          $categories = $this->get_categories_with_fields();
          if (!array_key_exists($category->get('id'), $categories)) {
              throw new \moodle_exception('categorynotfound', 'core_customfield');
          }
          return $categories[$category->get('id')];
      }
code: protected function validate_category(category_controller $category) : category_controller {
          $categories = $this->get_categories_with_fields();
          if (!array_key_exists($category->get('id'), $categories)) {
              throw new \moodle_exception('categorynotfound', 'core_customfield');
          }
          return $categories[$category->get('id')];
      }
code_tokens: protected function validate_category ( category_controller $ category ) : category_controller { $ categories = $ this -> get_categories_with_fields ( ) ; if ( ! array_key_exists ( $ category -> get ( 'id' ) , $ categories ) ) { throw new \ moodle_exception ( 'categorynotfound' , 'core_customfield' ) ; } return $ categories [ $ category -> get ( 'id' ) ] ; }
docstring: Validate that the given category belongs to this handler
  
  @param category_controller $category
  @return category_controller
  @throws \moodle_exception
docstring_tokens: Validate that the given category belongs to this handler