private static function get_element_instance($element, $id) {
        if ($element !== 'purpose' && $element !== 'category') {
            throw new coding_exception('No other elements than purpose and category are allowed');
        }

        $classname = '\tool_dataprivacy\\' . $element;
        return new $classname($id);
    }
private static function get_element_instance($element, $id) {
        if ($element !== 'purpose' && $element !== 'category') {
            throw new coding_exception('No other elements than purpose and category are allowed');
        }

        $classname = '\tool_dataprivacy\\' . $element;
        return new $classname($id);
    }
private static function get_element_instance ( $ element , $ id ) { if ( $ element !== 'purpose' && $ element !== 'category' ) { throw new coding_exception ( 'No other elements than purpose and category are allowed' ) ; } $ classname = '\tool_dataprivacy\\' . $ element ; return new $ classname ( $ id ) ; }
Returns an instance of the provided element.

@throws \coding_exception
@param string $element The element name 'purpose' or 'category'
@param int $id The element id
@return \core\persistent
Returns an instance of the provided element .