'array', ]; public function applyToPost(array $data): array { $result = [ 'title' => $this->title, 'body' => $this->body, 'type' => $this->type, 'target' => $this->target, ]; // Replace placeholders in all text fields if ($this->placeholders && is_array($data)) { foreach ($data as $key => $value) { if (in_array($key, $this->placeholders)) { foreach (['title', 'body', 'target'] as $field) { if ($result[$field]) { $result[$field] = str_replace("{{$key}}", $value, $result[$field]); } } } } } return $result; } }