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

Type.php « Measurable « core - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7f04d92181dfaff0d099c0344f3b1f7cecacc86b (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 */
namespace Piwik\Measurable;

class Type
{
    const ID = '';
    protected $name = 'General_Measurable';
    protected $namePlural = 'General_Measurables';
    protected $description = 'Default measurable type';
    protected $howToSetupUrl = '';

    public function isType($typeId)
    {
        // here we should add some point also check whether id matches any extended ID. Eg if
        // MetaSites extends Websites, then we expected $metaSite->isType('website') to be true (maybe)
        return $this->getId() === $typeId;
    }

    public function getId()
    {
        $id = static::ID;

        if (empty($id)) {
            $message = 'Type %s does not define an ID. Set the ID constant to fix this issue';;
            throw new \Exception(sprintf($message, get_called_class()));
        }

        return $id;
    }

    public function getDescription()
    {
        return $this->description;
    }

    public function getName()
    {
        return $this->name;
    }

    public function getNamePlural()
    {
        return $this->namePlural;
    }

    public function getHowToSetupUrl()
    {
        return $this->howToSetupUrl;
    }

}