aboutsummaryrefslogtreecommitdiff
path: root/app/class/Modelconfig.php
blob: 6c074ebbaa2322dde3122d799b17cb344580fdaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

namespace Wcms;

abstract class Modelconfig extends Model
{
    public static function readconfig()
    {
        if (file_exists(self::CONFIG_FILE)) {
            $current = file_get_contents(self::CONFIG_FILE);
            $donnees = json_decode($current, true);
            return new Config($donnees);
        } else {
            return 0;
        }
    }

    public static function createconfig(array $donnees)
    {
        return new Config($donnees);
    }


    public static function savejson(string $json)
    {
        file_put_contents(self::CONFIG_FILE, $json);
    }
}