Differences Between: [Versions 402 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 namespace core_external; 18 19 /** 20 * Common ancestor of all parameter description classes 21 * 22 * @package core_external 23 * @copyright 2009 Petr Skodak 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 abstract class external_description { 27 /** @var string Description of element */ 28 public $desc; 29 30 /** @var bool Element value required, null not allowed */ 31 public $required; 32 33 /** @var mixed Default value */ 34 public $default; 35 36 /** 37 * Contructor. 38 * 39 * @param string $desc Description of element 40 * @param int $required Whether the element value is required. Valid values are VALUE_DEFAULT, VALUE_REQUIRED, VALUE_OPTIONAL. 41 * @param mixed $default The default value 42 */ 43 public function __construct($desc, $required, $default) { 44 if (!in_array($required, [VALUE_DEFAULT, VALUE_REQUIRED, VALUE_OPTIONAL], true)) { 45 $requiredstr = $required; 46 if (is_array($required)) { 47 $requiredstr = "Array: " . implode(" ", $required); 48 } 49 debugging("Invalid \$required parameter value: '{$requiredstr}' . 50 It must be either VALUE_DEFAULT, VALUE_REQUIRED, or VALUE_OPTIONAL", DEBUG_DEVELOPER); 51 } 52 $this->desc = $desc; 53 $this->required = $required; 54 $this->default = $default; 55 } 56 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body