Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Config.php « lib - github.com/sualko/cloud_piwik.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0889d417aadf7ac5a57e33edeb00e2adbade8686 (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
29
30
31
32
33
34
<?php
namespace OCA\Piwik;

use OCP\IConfig;

class Config
{
    public function __construct($appName, IConfig $config)
    {
        $this->appName = $appName;
        $this->config = $config;
    }

    public function getAppValue($key, $default = null)
    {
        $value = $this->config->getAppValue($this->appName, $key, $default);
        return (empty($value)) ? $default : $value;
    }

    public function setAppValue($key, $value)
    {
        return $this->config->setAppValue($this->appName, $key, $value);
    }

    public function getBooleanAppValue($key)
    {
        return $this->validateBoolean($this->getAppValue($key));
    }

    private function validateBoolean($val)
    {
        return $val === true || $val === 'true';
    }
}