Tag   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateColor() 0 6 1
1
<?php
2
3
/**
4
 * This file is part of laravel.su package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
declare(strict_types=1);
10
11
namespace App\Models;
12
13
use App\Services\ColorGenerator;
14
use Illuminate\Database\Eloquent\Model;
15
16
/**
17
 * Class Tag.
18
 */
19
class Tag extends Model
20
{
21
    /**
22
     * @var bool
23
     */
24
    public $timestamps = false;
25
26
    /**
27
     * @var string
28
     */
29
    protected $table = 'tags';
30
31
    /**
32
     * @var array
33
     */
34
    protected $fillable = [
35
        'name', 'color',
36
    ];
37
38
    /**
39
     * @param  ColorGenerator $generator
40
     * @return Tag
41
     */
42
    public function updateColor(ColorGenerator $generator): Tag
43
    {
44
        $this->color = $generator->make(true);
45
46
        return $this;
47
    }
48
}
49