From e5e37411d3a943b5bea61b6903d1c81923b2cfa3 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 19 Jan 2022 16:48:25 +0100 Subject: [PATCH] wip #4804 --- .idea/cubist_minisearch.iml | 1 - .idea/php.xml | 1 - src/Index.php | 7 ++++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.idea/cubist_minisearch.iml b/.idea/cubist_minisearch.iml index cf5cda5..a82870c 100644 --- a/.idea/cubist_minisearch.iml +++ b/.idea/cubist_minisearch.iml @@ -21,7 +21,6 @@ - diff --git a/.idea/php.xml b/.idea/php.xml index 796581a..6d2ca67 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -19,7 +19,6 @@ - diff --git a/src/Index.php b/src/Index.php index 70fa6ee..389c519 100644 --- a/src/Index.php +++ b/src/Index.php @@ -16,6 +16,11 @@ class Index implements ShouldQueue, ShouldBeUnique /** @var Document[] */ protected $documents = []; + /** + * @var string + */ + protected $varname='documents'; + /** * @var string */ @@ -65,6 +70,6 @@ class Index implements ShouldQueue, ShouldBeUnique foreach ($this->documents as $document) { $res = array_merge($res, $document->process()); } - return 'const documents = ' . json_encode($res) . ';'; + return 'const '.$this->varname.' = ' . json_encode($res) . ';'; } } \ No newline at end of file -- 2.39.5