| Total Complexity | 11 |
| Total Lines | 93 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | class User |
||
| 22 | { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var array |
||
| 26 | */ |
||
| 27 | private $data = []; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Set Data |
||
| 31 | * @param array $data |
||
| 32 | * @return $this |
||
| 33 | */ |
||
| 34 | public function setData(array $data): self |
||
| 35 | { |
||
| 36 | $this->data = $data; |
||
| 37 | return $this; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get Data |
||
| 42 | * @return array |
||
| 43 | */ |
||
| 44 | public function getData(): array |
||
| 45 | { |
||
| 46 | return $this->data; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Get Fields |
||
| 51 | * @return array |
||
| 52 | */ |
||
| 53 | public function getFields(): array |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Set Fields |
||
| 60 | * @param array $schema |
||
| 61 | * @return $this |
||
| 62 | */ |
||
| 63 | public function setFields(array $schema): self |
||
| 64 | { |
||
| 65 | foreach ($schema as $field) { |
||
| 66 | if (isset($field['name'])) { |
||
| 67 | $this->data[$field['name']] = ''; |
||
| 68 | } |
||
| 69 | } |
||
| 70 | |||
| 71 | return $this; |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Get Field Value |
||
| 76 | * @param string $field |
||
| 77 | * @return string|null |
||
| 78 | */ |
||
| 79 | public function getFieldValue(string $field): ?string |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Set Fields Value |
||
| 86 | * @param string $field |
||
| 87 | * @param string|null $value |
||
| 88 | * @return $this |
||
| 89 | */ |
||
| 90 | public function setFieldValue(string $field, ?string $value): self |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Has Field |
||
| 98 | * @param string $field |
||
| 99 | * @return bool |
||
| 100 | */ |
||
| 101 | public function hasField(string $field): bool |
||
| 104 | } |
||
| 105 | |||
| 106 | /** |
||
| 107 | * Gets the user property |
||
| 108 | * @param string $property |
||
| 109 | * @return mixed |
||
| 110 | */ |
||
| 111 | public function __get(string $property) |
||
| 117 |