{{!
    This file is part of Moodle - https://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template common/boilerplate_php

    Common heading boilerplate of PHP files.

    Context variables required for this template:
    * description - one line description of the file purpose
    * component - plugin component name
    * extratags - additional phpdoc tags, e.g. subpackage or category
    * copyright - copyright holder(s)
    * namespace - if it is namespaced file
    * use - list of classes imported form other namespaces
    * check_moodle_internal - assert that MOODLE_INTERNAL is defined
    * is_single_declaration - does the file provide a single declaration (e.g. class)
    * path_to_config - if the file is not internal, this is the path to config.php to be required

    Example context (json):
    {
        "component": "local_test",
        "copyright": "2021 David Mudrák <david@moodle.com>"
    }
}}
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <https://www.gnu.org/licenses/>.

{{^ is_single_declaration }}
{{> common/phpdoc_block }}

{{! If this is namespaced file, the namespace must be first. }}
{{$ namespace }}{{/ namespace }}

{{! Import classes from other namespaces. }}
{{$ use }}{{/ use }}

{{# check_moodle_internal }}defined('MOODLE_INTERNAL') || die();{{/ check_moodle_internal }}
{{# is_web_file }}require({{{ self.pathtoconfig }}});{{/ is_web_file }}
{{# is_cli_file }}
define('CLI_SCRIPT', true);

require({{{ self.pathtoconfig }}});
require_once($CFG->libdir.'/clilib.php');
{{/ is_cli_file }}
{{/ is_single_declaration }}
{{# is_single_declaration }}
{{! If this is namespaced file, the namespace must be first. }}
{{$ namespace }}{{/ namespace }}

{{! Import classes from other namespaces. }}
{{$ use }}{{/ use }}

{{# self.has_extra_requirements }}
defined('MOODLE_INTERNAL') || die();

{{$ requires }}{{/ requires }}
{{/ self.has_extra_requirements }}

{{> common/phpdoc_block }}
{{/ is_single_declaration }}
