From 93ecfa56701662fe4dc72ecbc9af4626a113b80b Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Thu, 14 Dec 2023 19:50:38 +0100 Subject: [PATCH] Inline added simplified experimental method --- .../framework/src/Console/Commands/BuildSearchCommand.php | 4 +++- packages/framework/src/Foundation/HydeCoreExtension.php | 4 +++- .../Framework/Actions/GeneratesDocumentationSearchIndex.php | 6 ------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/framework/src/Console/Commands/BuildSearchCommand.php b/packages/framework/src/Console/Commands/BuildSearchCommand.php index 563778da0b1..58de7ef86e6 100644 --- a/packages/framework/src/Console/Commands/BuildSearchCommand.php +++ b/packages/framework/src/Console/Commands/BuildSearchCommand.php @@ -4,11 +4,13 @@ namespace Hyde\Console\Commands; +use Hyde\Pages\InMemoryPage; use Hyde\Foundation\Facades\Pages; use Hyde\Framework\Actions\StaticPageBuilder; use LaravelZero\Framework\Commands\Command; use Hyde\Framework\Actions\GeneratesDocumentationSearchIndex; use Hyde\Framework\Features\Documentation\DocumentationSearchPage; +use Hyde\Framework\Features\Documentation\DocumentationSearchIndex; /** * Run the build process for the documentation search index. @@ -23,7 +25,7 @@ class BuildSearchCommand extends Command public function handle(): int { - StaticPageBuilder::handle(Pages::get('search.json') ?? GeneratesDocumentationSearchIndex::makePage()); + StaticPageBuilder::handle(Pages::get('search.json') ?? DocumentationSearchIndex::make()); if (DocumentationSearchPage::enabled()) { StaticPageBuilder::handle(Pages::get('docs/search') ?? new DocumentationSearchPage()); diff --git a/packages/framework/src/Foundation/HydeCoreExtension.php b/packages/framework/src/Foundation/HydeCoreExtension.php index 50d5d40a0ed..87f1bdfc707 100644 --- a/packages/framework/src/Foundation/HydeCoreExtension.php +++ b/packages/framework/src/Foundation/HydeCoreExtension.php @@ -8,6 +8,7 @@ use Hyde\Pages\BladePage; use Hyde\Pages\MarkdownPage; use Hyde\Pages\MarkdownPost; +use Hyde\Pages\InMemoryPage; use Hyde\Pages\DocumentationPage; use Hyde\Foundation\Kernel\PageCollection; use Hyde\Foundation\Concerns\HydeExtension; @@ -15,6 +16,7 @@ use Hyde\Framework\Actions\GeneratesDocumentationSearchIndex; use Hyde\Framework\Features\Documentation\DocumentationSearchPage; +use Hyde\Framework\Features\Documentation\DocumentationSearchIndex; use function array_filter; use function array_keys; @@ -35,7 +37,7 @@ public static function getPageClasses(): array public function discoverPages(PageCollection $collection): void { if (Features::hasDocumentationSearch()) { - $collection->addPage(GeneratesDocumentationSearchIndex::makePage()); + $collection->addPage(DocumentationSearchIndex::make()); if (DocumentationSearchPage::enabled()) { $collection->addPage(new DocumentationSearchPage()); diff --git a/packages/framework/src/Framework/Actions/GeneratesDocumentationSearchIndex.php b/packages/framework/src/Framework/Actions/GeneratesDocumentationSearchIndex.php index e76c20496dd..c9418b88791 100644 --- a/packages/framework/src/Framework/Actions/GeneratesDocumentationSearchIndex.php +++ b/packages/framework/src/Framework/Actions/GeneratesDocumentationSearchIndex.php @@ -52,12 +52,6 @@ public static function generate(): string return $service->index->toJson(); } - /** @experimental May be moved to a DocumentationSearch class */ - public static function makePage(): InMemoryPage - { - return DocumentationSearchIndex::make(); - } - protected function __construct() { $this->index = new Collection();