public static function read_plan($id) {
        static::require_enabled();
        $plan = new plan($id);

        if (!$plan->can_read()) {
            $context = context_user::instance($plan->get('userid'));
            throw new required_capability_exception($context, 'moodle/competency:planview', 'nopermissions', '');
        }

        return $plan;
    }
public static function read_plan($id) {
        static::require_enabled();
        $plan = new plan($id);

        if (!$plan->can_read()) {
            $context = context_user::instance($plan->get('userid'));
            throw new required_capability_exception($context, 'moodle/competency:planview', 'nopermissions', '');
        }

        return $plan;
    }
public static function read_plan ( $ id ) { static :: require_enabled ( ) ; $ plan = new plan ( $ id ) ; if ( ! $ plan -> can_read ( ) ) { $ context = context_user :: instance ( $ plan -> get ( 'userid' ) ) ; throw new required_capability_exception ( $ context , 'moodle/competency:planview' , 'nopermissions' , '' ) ; } return $ plan ; }
Returns a plan data.

@param int $id
@return \core_competency\plan
Returns a plan data .