forked from webnet-fr/database-anonymizer
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathConstant.php
More file actions
40 lines (34 loc) · 782 Bytes
/
Constant.php
File metadata and controls
40 lines (34 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace WebnetFr\DatabaseAnonymizer\Generator;
use WebnetFr\DatabaseAnonymizer\Exception\InvalidConstantException;
/**
* Generator that always return constant.
*
* @author Vlad Riabchenko <vriabchenko@webnet.fr>
*/
class Constant implements GeneratorInterface
{
/**
* Arbitrary constant value.
*
* @var mixed
*/
private $constant;
/**
* @param $constant
*/
public function __construct($constant)
{
if (null !== $constant && !\is_string($constant)) {
throw new InvalidConstantException('Constant value must be null or string');
}
$this->constant = $constant;
}
/**
* {@inheritdoc}
*/
public function generate()
{
return $this->constant;
}
}