From: Vincent Vanwaelscappel Date: Wed, 19 Jan 2022 15:48:25 +0000 (+0100) Subject: wip #4804 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e5e37411d3a943b5bea61b6903d1c81923b2cfa3;p=cubist_minisearch.git wip #4804 --- 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