*/ private $data; private string $name; private function __construct() { } /** * @param array $raw */ public static function fromRaw(array $raw, string $name): self { $obj = new self(); $obj->data = $raw; $obj->name = $name; return $obj; } /** * Get a name. */ public function getName(): string { return $this->name; } /** * Get a type. */ public function getType(): string { $type = $this->data['type'] ?? null; if ($type === null) { throw new RuntimeException("Field '{$this->name}' has no type."); } return $type; } /** * Whether is not-storable. */ public function isNotStorable(): bool { return $this->data['notStorable'] ?? false; } /** * Get a parameter value by a name. * * @return mixed */ public function getParam(string $name) { return $this->data[$name] ?? null; } }