Completed
Pull Request — master (#212)
by Alexandru
43:58 queued 01:14
created

ModelTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 21
c 0
b 0
f 0
ccs 0
cts 10
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDynamoDbTableName() 0 3 1
A boot() 0 8 1
A getObserverClassName() 0 3 1
1
<?php
2
3
namespace Rennokki\DynamoDb;
4
5
use Illuminate\Support\Facades\App;
6
7
trait ModelTrait
8
{
9
    public static function boot()
10
    {
11
        parent::boot();
12
13
        $observer = static::getObserverClassName();
14
15
        static::observe(new $observer(
16
            App::make('Rennokki\DynamoDb\DynamoDbClientInterface')
17
        ));
18
    }
19
20
    public static function getObserverClassName()
21
    {
22
        return 'Rennokki\DynamoDb\ModelObserver';
23
    }
24
25
    public function getDynamoDbTableName()
26
    {
27
        return $this->getTable();
28
    }
29
}
30