EventCategory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 8
c 0
b 0
f 0
dl 0
loc 31
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCategoryName() 0 5 1
1
<?php
2
3
namespace DavideCasiraghi\LaravelEventsCalendar\Models;
4
5
use Astrotomic\Translatable\Translatable;
6
use Illuminate\Database\Eloquent\Model;
7
8
class EventCategory extends Model
9
{
10
    /***************************************************************************/
11
    /**
12
     * The table associated with the model.
13
     *
14
     * @var string
15
     */
16
    protected $table = 'event_categories';
17
18
    /***************************************************************************/
19
20
    use Translatable;
0 ignored issues
show
Bug introduced by
The trait Astrotomic\Translatable\Translatable requires the property $each which is not provided by DavideCasiraghi\LaravelE...ar\Models\EventCategory.
Loading history...
21
22
    public $translatedAttributes = ['name', 'slug'];
23
    protected $fillable = [];
24
    public $useTranslationFallback = true;
25
26
    /***************************************************************************/
27
28
    /*
29
     * Return the category name.
30
     *
31
     * @param  int  $categoryId
32
     * @return string
33
     */
34 3
    public static function getCategoryName($categoryId): string
35
    {
36 3
        $ret = self::find($categoryId)->name;
0 ignored issues
show
Bug introduced by
The property name does not seem to exist on DavideCasiraghi\LaravelE...ar\Models\EventCategory. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
37
38 3
        return $ret;
39
    }
40
}
41