Lines 0.00% 0 / 9
Functions and Methods 0.00% 0 / 5
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
Mailtemplate 0.00% 0 / 9 0.00% 0 / 5 90 0.00% 0 / 1
 getDefaults 0.00% 0 / 2 0.00% 0 / 1 2
 hasType 0.00% 0 / 1 0.00% 0 / 1 6
 hasPreference 0.00% 0 / 1 0.00% 0 / 1 12
 getPreference 0.00% 0 / 1 0.00% 0 / 1 2
 setPreference 0.00% 0 / 4 0.00% 0 / 1 6
1<?php
2
3namespace BO\Zmsentities;
4
5class Mailtemplate extends Schema\Entity
6{
7    public static $schema = "mailtemplate.json";
8
9    /**
10     * @return array
11     *
12     */
13    #[\Override]
14    public function getDefaults()
15    {
16        return [
17        ];
18    }
19
20    public function hasType(mixed $type): bool
21    {
22        return (isset($this[$type])) ? true : false;
23    }
24
25    public function hasPreference(mixed $type, mixed $key): bool
26    {
27        return ($this->hasType($type) && isset($this[$type][$key])) ? true : false;
28    }
29
30    public function getPreference(mixed $type, mixed $key): mixed
31    {
32        return $this->toProperty()->$type->$key->get();
33    }
34
35    public function setPreference(mixed $type, mixed $key, mixed $value): static
36    {
37        $preference = $this->toProperty()->$type->$key->get();
38        if (null !== $preference) {
39            $this[$type][$key] = $value;
40        }
41        return $this;
42    }
43}