Completed
Push — master ( 262514...7f6fe3 )
by Elf
08:38 queued 39s
created

SexAttribute::getSexAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
namespace ElfSundae\Laravel\Support\Traits\Eloquent;
4
5
use ElfSundae\Laravel\Support\Constants\Sex;
6
7
trait SexAttribute
8
{
9
    /**
10
     * Get the 'sex' attribute.
11
     *
12
     * @param  int  $value
13
     * @return string|null
14
     */
15
    public function getSexAttribute($value)
16
    {
17
        return Sex::string($value);
18
    }
19
20
    /**
21
     * Set the 'sex' attribute.
22
     *
23
     * @param  mixed  $value
24
     */
25
    public function setSexAttribute($value)
26
    {
27
        $this->attributes['sex'] = Sex::type($value);
28
    }
29
}
30