Completed
Push — master ( 096673...3f861c )
by Stéphane
11:15
created

Field   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 24
ccs 6
cts 8
cp 0.75
rs 10
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A toArray() 0 4 1
A revision() 0 4 1
1
<?php namespace Rocket\Entities;
2
3
use Illuminate\Database\Eloquent\Model;
4
5
/**
6
 * Field
7
 *
8
 * @property int $id The field id
9
 * @property string $name The name of the field
10
 * @property int $weight The order of this field
11
 * @property int $revision_id The field's revision id
12
 * @property-read \DateTime $created_at
13
 * @property-read \DateTime $updated_at
14
 */
15
class Field extends Model
16
{
17 27
    public function __construct(array $attributes = [])
18
    {
19 27
        $this->bootIfNotBooted();
20
21 27
        $this->syncOriginal();
22 27
    }
23
24
    //TODO :: validate values
25
26 9
    public function toArray()
27
    {
28 9
        return $this->getAttribute('value');
29
    }
30
31
    /**
32
     * Get the revisions for this class
33
     */
34
    public function revision()
35
    {
36
        return $this->belongsTo(Revision::class);
37
    }
38
}
39