Theme   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A updateColors() 0 18 1
A disableOtherThemes() 0 4 1
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Theme extends Model
8
{
9
    public function updateColors($array)
10
    {
11
        $this->background = $array['background'] ?? 'white';
12
        $this->container_background = $array['container_background'] ?? 'grey';
13
        $this->title = $array['title'] ?? 'black';
14
        $this->text = $array['text'] ?? 'black';
15
16
        $this->menu_item_text = $array['menu_item_text'] ?? 'white';
17
        $this->menu_item_background = $array['menu_item_background'] ?? 'black';
18
        $this->menu_item_active_text = $array['menu_item_active_text'] ?? 'black';
19
        $this->menu_item_active_background = $array['menu_item_active_background'] ?? 'white';
20
21
        $this->categories_list_text = $array['categories_list_text'] ?? 'white';
22
        $this->categories_list_background = $array['categories_list_background'] ?? 'black';
23
24
        $this->tags_list_text = $array['tags_list_text'] ?? 'white';
25
        $this->tags_list_background = $array['tags_list_background'] ?? 'black';
26
    }
27
28
    public function disableOtherThemes()
29
    {
30
        \DB::table('themes')->where('id', '!=', $this->id)->update(['selected' => false]);
31
    }
32
}
33