Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 23... Línea 23...
23
 */
23
 */
Línea 24... Línea 24...
24
 
24
 
Línea 25... Línea 25...
25
namespace core;
25
namespace core;
-
 
26
 
26
 
27
use coding_exception;
27
use coding_exception;
28
use core\dataformat\base;
Línea 28... Línea 29...
28
use core_php_time_limit;
29
use core_php_time_limit;
29
use stored_file;
30
use stored_file;
Línea 39... Línea 40...
39
 
40
 
40
    /**
41
    /**
41
     * Return an instance of a dataformat writer from given dataformat type
42
     * Return an instance of a dataformat writer from given dataformat type
42
     *
43
     *
43
     * @param string $dataformat
44
     * @param string $dataformat
-
 
45
     * @return base
44
     * @return dataformat\base
46
     *
45
     * @throws coding_exception
47
     * @throws coding_exception For unknown dataformat
46
     */
48
     */
47
    protected static function get_format_instance(string $dataformat): \core\dataformat\base {
49
    public static function get_format_instance(string $dataformat): base {
48
        $classname = 'dataformat_' . $dataformat . '\writer';
50
        $classname = 'dataformat_' . $dataformat . '\writer';
49
        if (!class_exists($classname)) {
51
        if (!class_exists($classname)) {
50
            throw new coding_exception('Invalid dataformat', $dataformat);
52
            throw new coding_exception('Invalid dataformat', $dataformat);
51
        }
-
 
52
 
53
        }
53
        return new $classname();
54
        return new $classname();
Línea 54... Línea 55...
54
    }
55
    }
55
 
56