Settings   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A readingSpeed() 0 4 1
A isRoundingUpEnabled() 0 4 1
1
<?php
2
3
namespace GinoPane\BlogTimeToRead\Models;
4
5
use Model;
6
use System\Behaviors\SettingsModel;
7
8
/**
9
 * Class Settings
10
 *
11
 * @package GinoPane\BlogTimeToRead\Models
12
 */
13
class Settings extends Model {
14
15
    const DEFAULT_READING_SPEED = 300;
16
    const DEFAULT_ROUNDING_UP_ENABLED = true;
17
18
    const READING_SPEED_KEY = 'default_reading_speed';
19
    const ROUNDING_UP_ENABLED_KEY = 'rounding_up_enabled';
20
21
    const SETTINGS_CODE = 'ginopane_blogtimetoread';
22
23
    public $implement = [SettingsModel::class];
24
25
    public $settingsCode = self::SETTINGS_CODE;
26
27
    public $settingsFields = 'fields.yaml';
28
29
    protected $cache = [];
30
31
    /**
32
     * @return int
33
     */
34
    public function readingSpeed() : int
35
    {
36
        return (int)$this->{self::READING_SPEED_KEY};
37
    }
38
39
    /**
40
     * @return bool
41
     */
42
    public function isRoundingUpEnabled(): bool
43
    {
44
        return (bool)$this->{self::ROUNDING_UP_ENABLED_KEY};
45
    }
46
}