|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace kalanis\kw_mapper\Records; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
use kalanis\kw_mapper\Interfaces\ICanFill; |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class Entry |
|
11
|
|
|
* @package kalanis\kw_mapper\Records |
|
12
|
|
|
* Simple entry to fill |
|
13
|
|
|
*/ |
|
14
|
|
|
class Entry |
|
15
|
|
|
{ |
|
16
|
|
|
protected int $type = 0; |
|
17
|
|
|
/** @var null|int|string|float|bool|array<int|string, int|string|float|bool|ARecord|array<int|string, int|string>>|ICanFill|false */ |
|
18
|
|
|
protected $data = false; |
|
19
|
|
|
/** @var string|int|array<string|int, string|int>|null */ |
|
20
|
|
|
protected $params = null; |
|
21
|
|
|
protected bool $isFromStorage = false; |
|
22
|
|
|
|
|
23
|
180 |
|
public static function getInstance(): self |
|
24
|
|
|
{ |
|
25
|
180 |
|
return new self(); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
180 |
|
public function setType(int $type): self |
|
29
|
|
|
{ |
|
30
|
180 |
|
$this->type = $type; |
|
31
|
180 |
|
return $this; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
130 |
|
public function getType(): int |
|
35
|
|
|
{ |
|
36
|
130 |
|
return $this->type; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @param null|int|string|float|bool|array<int|string, int|string|float|bool|ARecord|array<int|string, int|string>>|ICanFill $data |
|
41
|
|
|
* @param bool $isFromStorage |
|
42
|
|
|
* @return $this |
|
43
|
|
|
*/ |
|
44
|
99 |
|
public function setData($data, bool $isFromStorage = false): self |
|
45
|
|
|
{ |
|
46
|
99 |
|
$this->data = $data; |
|
47
|
99 |
|
$this->isFromStorage = $isFromStorage; |
|
48
|
99 |
|
return $this; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @return null|int|string|float|bool|array<int|string, int|string|float|bool|ARecord|array<int|string, int|string>>|ICanFill|false |
|
53
|
|
|
* False is for no use - rest is available as data |
|
54
|
|
|
* If you want to save false in your db, just cast it through integer |
|
55
|
|
|
*/ |
|
56
|
103 |
|
public function getData() |
|
57
|
|
|
{ |
|
58
|
103 |
|
return $this->data; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param string|int|array<string|int, string|int>|null $params |
|
63
|
|
|
* @return $this |
|
64
|
|
|
*/ |
|
65
|
173 |
|
public function setParams($params): self |
|
66
|
|
|
{ |
|
67
|
173 |
|
$this->params = $params; |
|
68
|
173 |
|
return $this; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @return string|int|array<string|int, string|int>|null |
|
73
|
|
|
*/ |
|
74
|
9 |
|
public function getParams() |
|
75
|
|
|
{ |
|
76
|
9 |
|
return $this->params; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
58 |
|
public function isFromStorage(): bool |
|
80
|
|
|
{ |
|
81
|
58 |
|
return $this->isFromStorage; |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|