Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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_competency;
18
 
19
/**
20
 * Abstract class for core_competency objects saved to the DB.
21
 *
22
 * This is a legacy class which all core_competency persistent classes created prior
23
 * to 3.3 must extend.
24
 *
25
 * @copyright  2015 Damyon Wiese
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 */
28
abstract class persistent extends \core\persistent {
29
    /**
30
     * Magic method to capture getters and setters.
31
     * This is only available for competency persistents for backwards compatibility.
32
     * It is recommended to use get('propertyname') and set('propertyname', 'value') directly.
33
     *
34
     * @param  string $method Callee.
35
     * @param  array $arguments List of arguments.
36
     * @return mixed
37
     */
38
    final public function __call($method, $arguments) {
39
        debugging('Use of magic setters and getters is deprecated. Use get() and set().', DEBUG_DEVELOPER);
40
        if (strpos($method, 'get_') === 0) {
41
            return $this->get(substr($method, 4));
42
        } else if (strpos($method, 'set_') === 0) {
43
            return $this->set(substr($method, 4), $arguments[0]);
44
        }
45
        throw new \coding_exception('Unexpected method call: ' . $method);
46
    }
47
 
48
}