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')];
    }
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')];
    }
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' ) ] ; }
Validate that the given category belongs to this handler

@param category_controller $category
@return category_controller
@throws \moodle_exception
Validate that the given category belongs to this handler