Completed
Push — master ( 0a8774...ab7e17 )
by Manuel
02:49 queued 11s
created

Option   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getValueByKey() 0 6 2
1
<?php
2
3
namespace Oscer\Cms\Core\Models;
4
5
use Illuminate\Support\Carbon;
6
7
/**
8
 * @property int id
9
 * @property string key
10
 * @property string value
11
 * @property Carbon created_at
12
 * @property Carbon updated_at
13
 */
14
class Option extends BaseModel
15
{
16
    public static function getValueByKey(string $key, $default = null): ?string
17
    {
18
        $option = static::query()->where('key', $key)->first();
19
20
        return $option ? $option->value : $default;
21
    }
22
}
23