series = []; } public function render(): array { if (0 === count($this->series)) { throw new FireflyException('No series added to chart'); } return $this->series; } /** * @param array $data * * @return void * @throws FireflyException */ public function add(array $data): void { if (array_key_exists('currency_id', $data)) { $data['currency_id'] = (string) $data['currency_id']; } if (array_key_exists('native_currency_id', $data)) { $data['native_currency_id'] = (string) $data['native_currency_id']; } if (!array_key_exists('start', $data)) { throw new FireflyException('Data-set is missing the "start"-variable.'); } if (!array_key_exists('end', $data)) { throw new FireflyException('Data-set is missing the "end"-variable.'); } if (!array_key_exists('period', $data)) { throw new FireflyException('Data-set is missing the "period"-variable.'); } $this->series[] = $data; } }