|
|
@ -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; |
|
|
|
} |
|
|
|