Skip to content

Commit

Permalink
Merge pull request #157 from hydephp/Replace-deprecated-method-usages…
Browse files Browse the repository at this point in the history
…-with-new-helper

Replace deprecated method usages with new output directory helper hydephp/develop@780e4e1
  • Loading branch information
github-actions committed Jul 3, 2022
1 parent e1a8e6a commit 49cc57f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/Actions/GeneratesNavigationMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Hyde\Framework\Helpers\Features;
use Hyde\Framework\Hyde;
use Hyde\Framework\Models\Pages\DocumentationPage;
use Hyde\Framework\Services\CollectionService;
use Illuminate\Support\Str;

Expand Down Expand Up @@ -81,8 +82,8 @@ protected function getLinks(): array
'title' => 'Docs',
'route' => $this->getRelativeRoutePathForSlug(
file_exists(Hyde::getDocumentationPagePath('/index.md'))
? Hyde::getDocumentationOutputDirectory().'/index'
: Hyde::getDocumentationOutputDirectory().'/readme'
? DocumentationPage::getOutputDirectory().'/index'
: DocumentationPage::getOutputDirectory().'/readme'
),
'current' => false,
'priority' => config('docs.navigation_link_priority', 1000),
Expand Down
11 changes: 5 additions & 6 deletions src/Concerns/Internal/FileHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ trait FileHelpers
/**
* Get the subdirectory compiled documentation files are stored in.
*
* @since 0.39.x (replaces `Hyde::docsDirectory()`)
* @deprecated v0.44.x (handled in the page model property `outputDirectory`)
* @deprecated v0.44.x Use DocumentationPage::getOutputDirectory() instead
*
* @return string
*/
Expand All @@ -37,11 +36,11 @@ public static function getDocumentationOutputDirectory(): string
public static function docsIndexPath(): string|false
{
if (file_exists(static::path(DocumentationPage::getSourceDirectory().'/index.md'))) {
return trim(static::pageLink(static::getDocumentationOutputDirectory().'/index.html'), '/');
return trim(static::pageLink(DocumentationPage::getOutputDirectory().'/index.html'), '/');
}

if (file_exists(static::path(DocumentationPage::getSourceDirectory().'/readme.md'))) {
return trim(static::pageLink(static::getDocumentationOutputDirectory().'/readme.html'), '/');
return trim(static::pageLink(DocumentationPage::getOutputDirectory().'/readme.html'), '/');
}

return false;
Expand Down Expand Up @@ -92,8 +91,8 @@ public static function pageLink(string $destination): string
if ($destination === 'index.html') {
return '/';
}
if ($destination === static::getDocumentationOutputDirectory().'/index.html') {
return static::getDocumentationOutputDirectory().'/';
if ($destination === DocumentationPage::getOutputDirectory().'/index.html') {
return DocumentationPage::getOutputDirectory().'/';
}

return substr($destination, 0, -5);
Expand Down
4 changes: 1 addition & 3 deletions src/Models/Pages/DocumentationPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Hyde\Framework\Concerns\HasTableOfContents;
use Hyde\Framework\Contracts\AbstractMarkdownPage;
use Hyde\Framework\Hyde;
use Hyde\Framework\Models\Parsers\DocumentationPageParser;

class DocumentationPage extends AbstractMarkdownPage
Expand Down Expand Up @@ -34,8 +33,7 @@ public function getOnlineSourcePath(): string|false
}

/**
* @since 0.39.x (replaces `Hyde::docsDirectory()`)
* @deprecated v0.44.x (handled in the page model property `outputDirectory`)
* @deprecated v0.44.x Use DocumentationPage::getOutputDirectory() instead
*/
public static function getDocumentationOutputPath(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Services/SitemapService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function generate(): self
if (Features::hasDocumentationPages()) {
$this->addPageModelUrls(
DocumentationPage::class,
Hyde::getDocumentationOutputDirectory().'/'
DocumentationPage::getOutputDirectory().'/'
);
}

Expand Down

0 comments on commit 49cc57f

Please sign in to comment.