ProfileProperty   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 14
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getNameAttribute() 0 8 2
1
<?php
2
3
namespace App\Models;
4
5
use App\Helpers\Macros\Traits\Languages;
6
use App\Models\Traits\BelongsToProfile;
7
use Culpa\Traits\Blameable;
8
use Culpa\Traits\CreatedBy;
9
use Culpa\Traits\DeletedBy;
10
use Culpa\Traits\UpdatedBy;
11
use Illuminate\Database\Eloquent\Model as Model;
12
use Illuminate\Database\Eloquent\SoftDeletes;
13
14
/**
15
 * App\Models\ProfileProperty
16
 *
17
 * @property int $id
18
 * @property int $skos_id
19
 * @property \Carbon\Carbon|null $created_at
20
 * @property \Carbon\Carbon|null $updated_at
21
 * @property \Carbon\Carbon|null $deleted_at
22
 * @property int|null $created_by
23
 * @property int|null $updated_by
24
 * @property int|null $deleted_by
25
 * @property int $profile_id
26
 * @property int|null $skos_parent_id
27
 * @property string $name
28
 * @property string $label
29
 * @property string|null $definition
30
 * @property string|null $comment
31
 * @property string $type
32
 * @property string|null $uri
33
 * @property int $status_id
34
 * @property string $language
35
 * @property string|null $note
36
 * @property int|null $display_order Display order of properties
37
 * @property int|null $export_order Display order of properties
38
 * @property int|null $picklist_order
39
 * @property string|null $examples Link to example usage
40
 * @property int $is_required boolean -- id this value required
41
 * @property int $is_reciprocal boolean - subject and object must both have this property
42
 * @property int $is_singleton boolean -- is this property allowed to repeat for a concept
43
 * @property int $is_in_picklist boolean - is in the property picklist
44
 * @property int $is_in_export
45
 * @property int|null $inverse_profile_property_id
46
 * @property int $is_in_class_picklist boolean - is in the property picklist
47
 * @property int $is_in_property_picklist boolean - is in the property picklist
48
 * @property int $is_in_rdf boolean - should this display in the RDF
49
 * @property int $is_in_xsd boolean - should this display in the XSD
50
 * @property int $is_attribute boolean - is this an attribute? attributes are not editable outside the main form
51
 * @property int $has_language Boolean that determines whether language attribute is displayed for this property
52
 * @property int $is_object_prop
53
 * @property int $is_in_form
54
 * @property string $namespce
55
 * @property-read \App\Models\Access\User\User|null $creator
56
 * @property-read \App\Models\Access\User\User|null $eraser
57
 * @property mixed $languages
58
 * @property-read \App\Models\Profile $profile
59
 * @property-read \App\Models\Access\User\User|null $updater
60
 * @method static bool|null forceDelete()
61
 * @method static \Illuminate\Database\Query\Builder|\App\Models\ProfileProperty onlyTrashed()
62
 * @method static bool|null restore()
63
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereComment($value)
64
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereCreatedAt($value)
65
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereCreatedBy($value)
66
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereDefinition($value)
67
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereDeletedAt($value)
68
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereDeletedBy($value)
69
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereDisplayOrder($value)
70
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereExamples($value)
71
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereExportOrder($value)
72
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereHasLanguage($value)
73
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereId($value)
74
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereInverseProfilePropertyId($value)
75
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsAttribute($value)
76
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsInClassPicklist($value)
77
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsInExport($value)
78
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsInForm($value)
79
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsInPicklist($value)
80
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsInPropertyPicklist($value)
81
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsInRdf($value)
82
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsInXsd($value)
83
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsObjectProp($value)
84
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsReciprocal($value)
85
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsRequired($value)
86
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereIsSingleton($value)
87
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereLabel($value)
88
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereLanguage($value)
89
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereName($value)
90
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereNamespce($value)
91
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereNote($value)
92
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty wherePicklistOrder($value)
93
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereProfileId($value)
94
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereSkosId($value)
95
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereSkosParentId($value)
96
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereStatusId($value)
97
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereType($value)
98
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereUpdatedAt($value)
99
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereUpdatedBy($value)
100
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProfileProperty whereUri($value)
101
 * @method static \Illuminate\Database\Query\Builder|\App\Models\ProfileProperty withTrashed()
102
 * @method static \Illuminate\Database\Query\Builder|\App\Models\ProfileProperty withoutTrashed()
103
 * @mixin \Eloquent
104
 */
105
class ProfileProperty extends Model
106
{
107
    const TABLE      = 'profile_property';
108
    protected $table = self::TABLE;
109
    use SoftDeletes, Blameable, CreatedBy, UpdatedBy, DeletedBy;
110
    use Languages, BelongsToProfile;
111
    protected $blameable = [
112
        'created' => 'created_by',
113
        'updated' => 'updated_by',
114
        'deleted' => 'deleted_by',
115
    ];
116
    protected $dates   = ['deleted_at'];
117
    protected $guarded = ['id'];
118
119
    public function getNameAttribute($value)
120
    {
121
        //this is necessary to use the legacy database, where range was at one time a reserved word
122
        if ('orange' === $value) {
123
            return 'range';
124
        }
125
126
        return $value;
127
    }
128
}
129