Completed
Push — master ( a76360...3b8ebd )
by Manuel
04:51 queued 03:32
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\Options\Models;
4
5
use Illuminate\Support\Carbon;
6
use Oscer\Cms\Core\Models\BaseModel;
7
8
/**
9
 * @property int id
10
 * @property string key
11
 * @property string value
12
 * @property Carbon created_at
13
 * @property Carbon updated_at
14
 */
15
class Option extends BaseModel
16
{
17
    public static function getValueByKey(string $key, $default = null): ?string
18
    {
19
        $option = static::query()->where('key', $key)->first();
20
21
        return $option ? $option->value : $default;
22
    }
23
}
24