TableSyncable   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 7
c 1
b 0
f 0
dl 0
loc 24
ccs 9
cts 9
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getTableSyncableAttributes() 0 3 1
A bootTableSyncable() 0 4 2
A classForSync() 0 3 1
A exists() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\TableSync\Integration\Laravel;
6
7
trait TableSyncable
8
{
9
    public static $isTableSyncEnabled = true;
10
11 14
    public static function bootTableSyncable()
12
    {
13 14
        if (static::$isTableSyncEnabled) {
14 13
            static::observe(TableSyncObserver::class);
15
        }
16
    }
17
18 10
    public function getTableSyncableAttributes(): array
19
    {
20 10
        return $this->getAttributes();
0 ignored issues
show
Bug introduced by
It seems like getAttributes() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        return $this->/** @scrutinizer ignore-call */ getAttributes();
Loading history...
21
    }
22
23 12
    public function classForSync(): string
24
    {
25 12
        return static::class;
26
    }
27
28 12
    public function exists(): bool
29
    {
30 12
        return $this->exists;
31
    }
32
}
33