Skip to content

Commit 2577bc2

Browse files
author
github-actions
committed
Merge pull request #522 from hydephp/refactor-page-constructors
Refactor page constructors hydephp/develop@d461716
1 parent ef17c0c commit 2577bc2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Actions/SourceFileParser.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ public function __construct(string $pageClass, string $identifier)
3030
$this->validateExistence($pageClass, $identifier);
3131
$this->identifier = $identifier;
3232

33-
$this->page = $pageClass === BladePage::class
34-
? $this->parseBladePage()
35-
: $this->parseMarkdownPage($pageClass);
33+
$this->page = $this->constructPage($pageClass);
3634
}
3735

3836
protected function parseBladePage(): BladePage
3937
{
4038
return new BladePage(
4139
$this->identifier,
42-
(BladeMatterParser::parseFile(BladePage::sourcePath($this->identifier)))
40+
BladeMatterParser::parseFile(BladePage::sourcePath($this->identifier))
4341
);
4442
}
4543

@@ -61,4 +59,13 @@ public function get(): HydePage
6159
{
6260
return $this->page;
6361
}
62+
63+
protected function constructPage(string $pageClass): BladePage|BaseMarkdownPage
64+
{
65+
if ($pageClass === BladePage::class) {
66+
return $this->parseBladePage();
67+
}
68+
69+
return $this->parseMarkdownPage($pageClass);
70+
}
6471
}

0 commit comments

Comments
 (0)