public function collect($messages, $final) { $this->messages = array_merge($this->messages, $messages); if ($final) { $this->export(); } }