GlobalConfigWithCheckServerId   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getServerId() 0 3 1
A setServerId() 0 5 1
1
<?php
2
3
namespace Fwolf\Config;
4
5
/**
6
 * Limit or check app running on server with preferred id
7
 *
8
 * @copyright   Copyright 2013-2017 Fwolf
9
 * @license     https://opensource.org/licenses/MIT MIT
10
 */
11
class GlobalConfigWithCheckServerId extends GlobalConfig
12
{
13
    use CheckServerIdTrait;
14
15
16
    const KEY_SERVER_ID = 'server.id';
17
18
19
    /**
20
     * @return  string
21
     */
22
    public function getServerId()
23
    {
24
        return $this->get(static::KEY_SERVER_ID);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get(static::KEY_SERVER_ID) also could return the type array which is incompatible with the documented return type string.
Loading history...
25
    }
26
27
28
    /**
29
     * @param   string|int $serverId
30
     * @return  $this
31
     */
32
    public function setServerId($serverId)
33
    {
34
        $this->set(static::KEY_SERVER_ID, $serverId);
35
36
        return $this;
37
    }
38
}
39