SettingMapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 7
c 0
b 0
f 0
dl 0
loc 21
rs 10
ccs 0
cts 9
cp 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A find() 0 11 2
1
<?php
2
3
namespace mQueue\Model;
4
5
abstract class SettingMapper extends AbstractMapper
6
{
7
    /**
8
     * Returns the setting, with a default value set if none was found.
9
     *
10
     * @param string $id
11
     * @param mixed $defaultValue
12
     *
13
     * @return Setting
14
     */
15
    public static function find($id, $defaultValue)
16
    {
17
        $result = self::getDbTable()->find([$id])->current();
18
19
        if ($result == null) {
20
            $result = self::getDbTable()->createRow();
21
            $result->id = $id;
22
            $result->value = $defaultValue;
23
        }
24
25
        return $result;
26
    }
27
}
28