Test Failed
Push — master ( 5904eb...0e6af8 )
by Phaniraj
05:25
created

ImportExportLog::setDataAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace LWS\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
     * Relationship with import model.
13
     *
14
     * @return void
15
     */
16
    public function import()
17
    {
18
        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...
Bug introduced by
The type Ladybirdweb\ImportExport\Models\Import was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
    }
20
21
    /**
22
     * Model Map accessor.
23
     *
24
     * Unserialize data while retriving.
25
     * @param $value
26
     * @return string
27
     */
28
    public function getDataAttribute($value)
29
    {
30
        return unserialize($value);
31
    }
32
33
    /**
34
     * Model Map mulator.
35
     *
36
     * Serialize data while storing.
37
     * @param $value
38
     * @return void
39
     */
40
    public function setDataAttribute($value)
41
    {
42
        $this->attributes['data'] = serialize($value);
43
    }
44
45
    /**
46
     * Model Map accessor.
47
     *
48
     * Unserialize message while retriving.
49
     * @param $value
50
     * @return string
51
     */
52
    public function getMessageAttribute($value)
53
    {
54
        return unserialize($value);
55
    }
56
57
    /**
58
     * Model Map mulator.
59
     *
60
     * Serialize message while storing.
61
     * @param $value
62
     * @return void
63
     */
64
    public function setMessageAttribute($value)
65
    {
66
        $this->attributes['message'] = serialize($value);
67
    }
68
}
69