Code Duplication    Length = 22-27 lines in 2 locations

src/models/Rrd.php 1 location

@@ 14-35 (lines=22) @@
11
12
namespace hipanel\modules\server\models;
13
14
class Rrd extends \hipanel\base\Model
15
{
16
    use \hipanel\base\ModelTrait;
17
18
    public function rules()
19
    {
20
        return [
21
            [['id'], 'integer'],
22
            [['graphs'], 'safe'],
23
        ];
24
    }
25
26
    public function getServer()
27
    {
28
        return $this->hasOne(Server::class, ['id' => 'id']);
29
    }
30
31
    public function getImages()
32
    {
33
        return $this->hasMany(RrdImage::class, ['id' => 'id']);
34
    }
35
}
36

src/models/SwitchGraph.php 1 location

@@ 14-40 (lines=27) @@
11
12
namespace hipanel\modules\server\models;
13
14
class SwitchGraph extends \hipanel\base\Model
15
{
16
    use \hipanel\base\ModelTrait;
17
18
    public static function tableName()
19
    {
20
        return 'switchgraph';
21
    }
22
23
    public function rules()
24
    {
25
        return [
26
            [['id'], 'integer'],
27
            [['graphs'], 'safe'],
28
        ];
29
    }
30
31
    public function getServer()
32
    {
33
        return $this->hasOne(Server::class, ['id' => 'id']);
34
    }
35
36
    public function getImages()
37
    {
38
        return $this->hasMany(RrdImage::class, ['id' => 'id']);
39
    }
40
}
41