EnumCastable::getValue()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 1
1
<?php
2
3
namespace MadWeb\Enum;
4
5
/**
6
 * @mixin \MadWeb\Enum\Enum
7 12
 * @internal Uses for custom casting implementation
8
 */
9 12
trait EnumCastable
10
{
11 12
    abstract public function __construct($value = null);
12 9
13
    abstract public function getValue();
14 9
15 9
    public function get($model, string $key, $value, array $attributes)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $key is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $attributes is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
    {
17
        return new static($value);
18
    }
19 12
20
    public function set($model, string $key, $value, array $attributes)
0 ignored issues
show
Unused Code introduced by
The parameter $model is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $key is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $attributes is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
21
    {
22
        if ($value instanceof static) {
23
            return $value->getValue();
24
        }
25
26
        return (new static($value))->getValue();
27
    }
28
}
29