Test Failed
Branch develop (5056e3)
by Abhishek Kumar
05:17
created

ImportExportLog   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 65
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMessageAttribute() 0 3 1
A setMessageAttribute() 0 3 1
A setDataAttribute() 0 3 1
A getDataAttribute() 0 3 1
A import() 0 3 1
1
<?php
2
3
namespace Ladybirdweb\ImportExport\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class ImportExportLog extends Model
8
{
9
    protected $fillable = ['op_id', 'data', 'message'];
10
11
12
    /**
13
    * Relationship with import model
14
    *
15
    * @return void
16
    */
17
    public function import()
18
    {
19
    	return $this->belongsTo( \Ladybirdweb\ImportExport\Models\Import::class );
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->belongsTo(...t\Models\Import::class) returns the type Illuminate\Database\Eloquent\Relations\BelongsTo which is incompatible with the documented return type void.
Loading history...
20
    }
21
22
23
    /**
24
    * Model Map accessor
25
    *
26
    * Unserialize data while retriving.
27
    * @param $value
28
    * @return string
29
    */
30
    public function getDataAttribute($value)
31
    {
32
        return unserialize( $value );
33
    }
34
35
36
    /**
37
    * Model Map mulator
38
    *
39
    * Serialize data while storing.
40
    * @param $value
41
    * @return void
42
    */
43
    public function setDataAttribute($value)
44
    {
45
        $this->attributes['data'] = serialize( $value );
46
    }
47
48
49
    /**
50
    * Model Map accessor
51
    *
52
    * Unserialize message while retriving.
53
    * @param $value
54
    * @return string
55
    */
56
    public function getMessageAttribute($value)
57
    {
58
        return unserialize( $value );
59
    }
60
61
62
    /**
63
    * Model Map mulator
64
    *
65
    * Serialize message while storing.
66
    * @param $value
67
    * @return void
68
    */
69
    public function setMessageAttribute($value)
70
    {
71
        $this->attributes['message'] = serialize( $value );
72
    }
73
}
74