Completed
Push — master ( 5d1103...9c9133 )
by Sherif
02:40
created

PushNotificationDevice::getUpdatedAtAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %
Metric Value
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php namespace App\Modules\V1\Notifications;
2
3
use Illuminate\Database\Eloquent\Model;
4
use Illuminate\Database\Eloquent\SoftDeletes;
5
6 View Code Duplication
class PushNotificationDevice extends Model{
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
7
8
    use SoftDeletes;
9
    protected $table    = 'push_notifications_devices';
10
    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
    protected $hidden   = ['deleted_at'];
12
    protected $guarded  = ['id'];
13
    protected $fillable = ['device_token', 'device_type', 'user_id', 'active'];
14
15
    public function getCreatedAtAttribute($value)
16
    {
17
        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
18
    }
19
20
    public function getUpdatedAtAttribute($value)
21
    {
22
        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
23
    }
24
25
    public function getDeletedAtAttribute($value)
26
    {
27
        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
28
    }
29
    
30
    public function user()
31
    {
32
        return $this->belongsTo('App\Modules\V1\Acl\AclUser');
33
    }
34
35
    public static function boot()
36
    {
37
        parent::boot();
38
        parent::observe(\App::make('App\Modules\V1\Notifications\ModelObservers\PushNotificationDeviceObserver'));
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (observe() instead of boot()). Are you sure this is correct? If so, you might want to change this to $this->observe().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
39
    }
40
}
41