| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function load(string $type, FieldOptions $options): Field |
||
| 18 | { |
||
| 19 | $hash = md5(serialize($options)) . $type; |
||
| 20 | |||
| 21 | if (isset($this->fields[$hash])) { |
||
| 22 | return $this->fields[$hash]; |
||
| 23 | } |
||
| 24 | |||
| 25 | $field = $this->fieldRegistry->get($type); |
||
| 26 | $field = new Field($field, $options); |
||
| 27 | |||
| 28 | $this->fields[$hash] = $field; |
||
| 29 | |||
| 30 | return $field; |
||
| 31 | } |
||
| 32 | } |
||
| 33 |