SessionRecording::setRecordingsAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Kalizi\LaravelSpyhole\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Class SessionRecording
9
 *
10
 * @property int id
11
 * @property string path
12
 * @property string session_id
13
 * @property array recordings
14
 * @property string|null user_id
15
 * @package Kalizi\LaravelSpyhole\Models
16
 */
17
class SessionRecording extends Model
18
{
19
    /**
20
     * The table associated with the model.
21
     *
22
     * @var string
23
     */
24
    protected $table = 'session_recordings';
25
26
    public function getRecordingsAttribute()
27
    {
28
        return json_decode(gzdecode(base64_decode($this->attributes['recordings'])));
29
    }
30
31
    public function setRecordingsAttribute($value)
32
    {
33
        $this->attributes['recordings'] = base64_encode(gzencode(json_encode($value)));
34
    }
35
}
36