Valuator::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the overtrue/laravel-revaluation.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Overtrue\LaravelRevaluation\Valuators;
13
14
use Overtrue\LaravelRevaluation\Revaluable;
15
16
/**
17
 * Class Valuator.
18
 */
19
class Valuator implements Revaluable
20
{
21
    protected $value;
22
23
    public function __construct($value)
24
    {
25
        $this->value = $value;
26
    }
27
28
    public function jsonSerialize()
29
    {
30
        return $this->toDefaultFormat();
31
    }
32
33
    public function getRaw()
34
    {
35
        return $this->value;
36
    }
37
38
    public function toDefaultFormat()
39
    {
40
        return $this->value;
41
    }
42
43
    public function __toString()
44
    {
45
        return $this->toDefaultFormat();
46
    }
47
48
    public static function toStorableValue($value)
49
    {
50
        return $value;
51
    }
52
}
53