From e95f5af116262d0b06bef0cd9929b094efcc135c Mon Sep 17 00:00:00 2001 From: Alex Puiu Date: Tue, 22 Mar 2022 18:16:49 +0200 Subject: [PATCH] Fix #34. --- app/SearchDisplace/SearchAndDisplaceJSON.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app/SearchDisplace/SearchAndDisplaceJSON.php b/app/SearchDisplace/SearchAndDisplaceJSON.php index 444ce4c..9f1a3e3 100644 --- a/app/SearchDisplace/SearchAndDisplaceJSON.php +++ b/app/SearchDisplace/SearchAndDisplaceJSON.php @@ -9,17 +9,31 @@ class SearchAndDisplaceJSON { protected $file; protected $searchers; + protected $searchOnly; + protected $content; - public function __construct($file, $searchers) + public function __construct($file, $searchers, $searchOnly) { - $this->file = $file . '/document.json'; + $searchOnly ? $this->content = $file : $this->file = $file . '/document.json'; $this->searchers = $searchers; - + $this->storage = Storage::disk('local'); } public function execute() { + if(isset($this->content)) { + $search = new SearchAndDisplace( + stripslashes($this->content), + [ + 'searchers' => $this->searchers, + ], + true + ); + + return $search->execute(); + } + if(! $this->storage->exists("contracts/$this->file")) { return; }