AnonymizableValue::setValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
nc 1
nop 1
1
<?php
2
/**
3
 * integer_net Magento Module
4
 *
5
 * @category   IntegerNet
6
 * @package    IntegerNet_Anonymizer
7
 * @copyright  Copyright (c) 2015 integer_net GmbH (http://www.integer-net.de/)
8
 * @author     Fabian Schmengler <[email protected]>
9
 */
10
11
namespace IntegerNet\Anonymizer;
12
13
14
class AnonymizableValue
15
{
16
    const __CLASS = __CLASS__;
17
    /**
18
     * @var string
19
     */
20
    private $formatter;
21
    /**
22
     * @var string
23
     */
24
    private $value;
25
    /**
26
     * @var bool
27
     */
28
    private $unique;
29
30
    public function __construct($formatter, $value, $unique = false)
31
    {
32
        $this->formatter = $formatter;
33
        $this->value = $value;
34
        $this->unique = (bool) $unique;
35
    }
36
    /**
37
     * @return string
38
     */
39
    public function getFakerFormatter()
40
    {
41
        return $this->formatter;
42
    }
43
44
    /**
45
     * If the value is optional, returns probability of presence.
46
     *   1.0 = not optional
47
     *   0.0 = always empty
48
     *
49
     * @return float
50
     */
51
    public function getOptionalWeight()
52
    {
53
        //TODO use this
54
        //TODO or add a FakerFormatterOptions property for more customizability
55
        return 1.0;
56
    }
57
58
    public function isUnique()
59
    {
60
        return $this->unique;
61
    }
62
63
    /**
64
     * @return mixed
65
     */
66
    public function getValue()
67
    {
68
        return $this->value;
69
    }
70
71
    /**
72
     * @param mixed $value
73
     * @return void
74
     */
75
    public function setValue($value)
76
    {
77
        $this->value = $value;
78
    }
79
}