Completed
Push — master ( c616f0...8421f8 )
by Vincenzo
03:02
created

MatchResult   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 2
c 3
b 0
f 1
lcom 0
cbo 1
dl 0
loc 35
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A castAttributes() 0 7 2
1
<?php
2
3
namespace App\Lib\DsManager\Models\Orm;
4
5
/**
6
 * Class MatchResult
7
 * @package App\Lib\DsManager\Models\Orm
8
 */
9
class MatchResult extends Match
10
{
11
    /**
12
     * @var array
13
     */
14
    protected $fillable = [
15
        'goal_home',
16
        'goal_away',
17
        'info',
18
        'simulated'
19
    ];
20
21
    protected $hidden = [
22
        'home_team_id',
23
        'away_team_id',
24
        'created_at',
25
        'updated_at'
26
    ];
27
28
    /**
29
     * @var array
30
     */
31
    protected $casts = [
32
        'info' => 'json',
33
        'simulated' => 'boolean'
34
    ];
35
36
    public static function castAttributes($attributes = [])
37
    {
38
        if (array_key_exists('info', $attributes)) {
39
            $attributes['info'] = json_encode($attributes['info']);
40
        }
41
        return $attributes;
42
    }
43
}