label !== null && $this->value !== null; } /** * Populates the object properties from the given array. * * @param array $array An associative array containing data with keys 'key' and 'value'. * * @return void */ public function fromArray(array $array): void { if (isset($array['label']) && $array['label'] !== '') { $this->label = sanitize_text_field($array['label']); } if (isset($array['value']) && $array['value'] !== '') { $this->value = is_string($array['value']) ? sanitize_text_field($array['value']) : $array['value']; } if (isset($array['isDefault']) && is_bool($array['isDefault'])) { $this->isDefault = $array['isDefault']; } } #[\ReturnTypeWillChange] public function jsonSerialize() { return [ 'label' => $this->label, 'value' => $this->value, 'isDefault' => $this->isDefault ]; } }