ModelTranslation::getDataAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 10
1
<?php
2
3
namespace Translation\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Translation\Traits\HasTranslationsTrait;
0 ignored issues
show
Bug introduced by
The type Translation\Traits\HasTranslationsTrait 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...
7
8
class ModelTranslation extends Model
9
{
10
    public $table = 'model_translations';
11
12
    public $primaryKey = 'id';
13
14
    protected $guarded = [];
15
16
    public $rules = [];
17
18
    protected $fillable = [
19
        // 'item',
20
        // 'group',
21
        // 'text',
22
        // 'locale',
23
24
        'entity_id',
25
        'entity_type',
26
        'entity_data',
27
        'country_code',
28
        'language_code',
29
    ];
30
31
    public function getDataAttribute()
32
    {
33
        $object = app($this->entity_type);
0 ignored issues
show
Bug introduced by
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        $object = /** @scrutinizer ignore-call */ app($this->entity_type);
Loading history...
34
35
        $attributes = (array) json_decode($this->text);
0 ignored issues
show
Bug introduced by
The property text does not seem to exist on Translation\Models\ModelTranslation. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
36
        $object->attributes = array_merge(
37
            $attributes, [
38
            $object->getKey() => $this->item,
0 ignored issues
show
Bug introduced by
The property item does not seem to exist on Translation\Models\ModelTranslation. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
39
            ]
40
        );
41
42
        return $object;
43
    }
44
}
45