From 816ad3a24e5f95dff5aa1f1cfd581764fd1a1389 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Mon, 21 Mar 2022 21:09:58 +0100 Subject: [PATCH] Add the Core files (with temporary namespace) --- composer.json | 4 +- src/Actions/ConvertsArrayToFrontMatter.php | 27 +++ src/Actions/ConvertsFooterMarkdown.php | 24 +++ src/Actions/CreatesDefaultDirectories.php | 34 ++++ src/Actions/CreatesNewMarkdownPostFile.php | 73 +++++++ src/Actions/GeneratesDocumentationSidebar.php | 58 ++++++ src/Actions/GeneratesNavigationMenu.php | 189 ++++++++++++++++++ src/Actions/GetMarkdownPostList.php | 26 +++ src/Actions/MarkdownConverter.php | 41 ++++ src/DocumentationPageParser.php | 91 +++++++++ src/Features.php | 105 ++++++++++ src/Hyde.php | 52 +++++ src/MarkdownPageParser.php | 146 ++++++++++++++ src/MarkdownPostParser.php | 162 +++++++++++++++ src/Models/BladePage.php | 27 +++ src/Models/DocumentationPage.php | 58 ++++++ src/Models/MarkdownPage.php | 59 ++++++ src/Models/MarkdownPost.php | 60 ++++++ src/Services/CollectionService.php | 103 ++++++++++ src/StaticPageBuilder.php | 145 ++++++++++++++ vendor/autoload.php | 2 +- vendor/composer/autoload_psr4.php | 2 +- vendor/composer/autoload_real.php | 8 +- vendor/composer/autoload_static.php | 14 +- 24 files changed, 1495 insertions(+), 15 deletions(-) create mode 100644 src/Actions/ConvertsArrayToFrontMatter.php create mode 100644 src/Actions/ConvertsFooterMarkdown.php create mode 100644 src/Actions/CreatesDefaultDirectories.php create mode 100644 src/Actions/CreatesNewMarkdownPostFile.php create mode 100644 src/Actions/GeneratesDocumentationSidebar.php create mode 100644 src/Actions/GeneratesNavigationMenu.php create mode 100644 src/Actions/GetMarkdownPostList.php create mode 100644 src/Actions/MarkdownConverter.php create mode 100644 src/DocumentationPageParser.php create mode 100644 src/Features.php create mode 100644 src/Hyde.php create mode 100644 src/MarkdownPageParser.php create mode 100644 src/MarkdownPostParser.php create mode 100644 src/Models/BladePage.php create mode 100644 src/Models/DocumentationPage.php create mode 100644 src/Models/MarkdownPage.php create mode 100644 src/Models/MarkdownPost.php create mode 100644 src/Services/CollectionService.php create mode 100644 src/StaticPageBuilder.php diff --git a/composer.json b/composer.json index 05d8a0f3..21e34deb 100644 --- a/composer.json +++ b/composer.json @@ -1,10 +1,10 @@ { - "name": "hyde/framework", + "name": "app/core", "description": "The HydePHP Framework", "license": "MIT", "autoload": { "psr-4": { - "Hyde\\Framework\\": "app/" + "App\\Core\\": "src/" } }, "authors": [ diff --git a/src/Actions/ConvertsArrayToFrontMatter.php b/src/Actions/ConvertsArrayToFrontMatter.php new file mode 100644 index 00000000..1afa8eec --- /dev/null +++ b/src/Actions/ConvertsArrayToFrontMatter.php @@ -0,0 +1,27 @@ + $value) { + $yaml[] = "$key: $value"; + } + + $yaml[] = '---'; + $yaml[] = ''; + return implode("\n", $yaml); + } +} diff --git a/src/Actions/ConvertsFooterMarkdown.php b/src/Actions/ConvertsFooterMarkdown.php new file mode 100644 index 00000000..cd914a96 --- /dev/null +++ b/src/Actions/ConvertsFooterMarkdown.php @@ -0,0 +1,24 @@ +requiredDirectories as $directory) { + // Does the directory exist? // Otherwise, create it. + is_dir(Hyde::path($directory)) || mkdir(Hyde::path($directory)); + } + } + + #[Pure] public static function getRequiredDirectories(): array + { + return (new CreatesDefaultDirectories)->requiredDirectories; + } +} diff --git a/src/Actions/CreatesNewMarkdownPostFile.php b/src/Actions/CreatesNewMarkdownPostFile.php new file mode 100644 index 00000000..88cefad9 --- /dev/null +++ b/src/Actions/CreatesNewMarkdownPostFile.php @@ -0,0 +1,73 @@ +title = $title ?? 'My Awesome Blog Post'; + $this->description = $description ?? 'A short description used in previews and SEO'; + $this->category = $category ?? 'blog'; + $this->author = $author ?? 'Mr. Hyde'; + if ($date === null) { + $this->date = date('Y-m-d H:i'); + } + if ($slug === null) { + $this->slug = Str::slug($title) ; + } + } + + /** + * Save the class object to a Markdown file. + * + * @param bool $force Should the file be created even if a file with the same path already exists? + * @return string|false Returns the path to the file if successful, or false if the file could not be saved. + * @throws Exception if a file with the same slug already exists and the force flag is not set. + */ + public function save(bool $force = false): string|false + { + + $path = Hyde::path("_posts/$this->slug.md"); + + if ($force !== true && file_exists($path)) { + throw new Exception("File at $path already exists! ", 409); + } + + $arrayWithoutSlug = ((array) $this); + + unset($arrayWithoutSlug['slug']); + + $contents = (new ConvertsArrayToFrontMatter)->execute($arrayWithoutSlug) . + "\n## Write something awesome.\n\n"; + + return file_put_contents($path, $contents) ? $path : false; + } +} diff --git a/src/Actions/GeneratesDocumentationSidebar.php b/src/Actions/GeneratesDocumentationSidebar.php new file mode 100644 index 00000000..2bd3716e --- /dev/null +++ b/src/Actions/GeneratesDocumentationSidebar.php @@ -0,0 +1,58 @@ + $value) { + $orderArray[$key] = Str::slug($value); + } + + $array = []; + + foreach (CollectionService::getSourceSlugsOfModels(DocumentationPage::class) as $slug) { + if ($slug == 'index') { + continue; + } + + $order = array_search($slug, $orderArray); + + if ($order === false) { + $order = 999; + } + + $array[] = [ + 'slug' => $slug, + 'title' => Str::title(str_replace('-', ' ', $slug)), + 'active' => 'docs/' . $slug == $current, + 'order' => $order, + ]; + } + + krsort($array); + + usort($array, function ($a, $b) { + return $a['order'] <=> $b['order']; + }); + + return $array; + } +} diff --git a/src/Actions/GeneratesNavigationMenu.php b/src/Actions/GeneratesNavigationMenu.php new file mode 100644 index 00000000..4fb26a1e --- /dev/null +++ b/src/Actions/GeneratesNavigationMenu.php @@ -0,0 +1,189 @@ +currentPage = $currentPage; + + $this->links = $this->getLinks(); + } + + /** + * Create the link array + * + * @todo Cache the base array and only update the 'current' attribute on each request. + * + * @return array + */ + private function getLinks(): array + { + $links = $this->getLinksFromConfig(); + + // Automatically add top level pages + foreach ($this->getListOfCustomPages() as $slug) { + $title = $this->getTitleFromSlug($slug); + // Only add the automatic link if it is not present in the config array + if (!in_array($title, array_column($links, 'title'))) { + $links[] = [ + 'title' => $title, + 'route' => $this->getRelativeRoutePathForSlug($slug), + 'current' => $this->currentPage == $slug, + 'priority' => $slug == "index" ? 100 : 999, + ]; + } + } + + // Add extra links + + // If the documentation feature is enabled... + if (Features::hasDocumentationPages()) { + // And there is no link to the docs... + if (!in_array('Docs', array_column($links, 'title'))) { + // But a suitable file exists... + if (file_exists('_docs/index.md') || file_exists('_docs/readme.md')) { + // Then we can add a link. + $links[] = [ + 'title' => 'Docs', + 'route' => $this->getRelativeRoutePathForSlug( + file_exists('_docs/index.md') ? 'docs/index' : 'docs/readme' + ), + 'current' => false, + 'priority' => 500, + ]; + } + } + } + + // Remove config defined blacklisted links + foreach ($links as $key => $link) { + if (in_array(Str::slug($link['title']), config('hyde.navigationMenuBlacklist', []))) { + unset($links[$key]); + } + } + + // Sort + + $columns = array_column($links, 'priority'); + array_multisort($columns, SORT_ASC, $links); + + return $links; + } + + /** + * Get the custom navigation links from the config, if there are any + * @return array + */ + private function getLinksFromConfig(): array + { + $configLinks = config('hyde.navigationMenuLinks', []); + + $links = []; + + if (sizeof($configLinks) > 0) { + foreach ($configLinks as $link) { + $links[] = [ + 'title' => $link['title'], + 'route' => $link['destination'] ?? $this->getRelativeRoutePathForSlug($link['slug']), + 'current' => isset($link['slug']) ? $this->currentPage == $link['slug'] : false, + 'priority' => $link['priority'] ?? 999, + ]; + } + } + + return $links; + } + + /** + * Get the page title + * + * @todo fetch this from the front matter + * + * @param string $slug + * @return string + */ + public function getTitleFromSlug(string $slug): string + { + if ($slug == "index") { + return "Home"; + } + return Str::title(str_replace('-', ' ', $slug)); + } + + /** + * Get a list of all the top level pages + * @return array + */ + private function getListOfCustomPages(): array + { + $array = []; + + foreach (glob(Hyde::path('resources/views/pages/*.blade.php')) as $path) { + $array[] = basename($path, '.blade.php'); + } + + return array_unique(array_merge($array, array_keys(MarkdownPage::allAsArray()))); + } + + /** + * Inject the proper number of `../` before the links + * @param string $slug + * @return string + */ + private function getRelativeRoutePathForSlug(string $slug): string + { + $nestCount = substr_count($this->currentPage, '/'); + $route = ""; + if ($nestCount > 0) { + $route .= str_repeat('../', $nestCount); + } + $route .= $slug . '.html'; + return $route; + } + + /** + * Static helper to get the array of navigation links + * @param string $currentPage + * @return array + */ + public static function getNavigationLinks(string $currentPage = 'index'): array + { + $generator = new self($currentPage); + return $generator->links; + } +} diff --git a/src/Actions/GetMarkdownPostList.php b/src/Actions/GetMarkdownPostList.php new file mode 100644 index 00000000..aa861111 --- /dev/null +++ b/src/Actions/GetMarkdownPostList.php @@ -0,0 +1,26 @@ +getEnvironment()->addExtension(new GithubFlavoredMarkdownExtension()); + + if (Hyde::hasTorchlight()) { + $converter->getEnvironment()->addExtension(new TorchlightExtension()); + } + + $html = $converter->convert($markdown); + + if (Hyde::hasTorchlight() + && config('torchlight.attribution', true) + && str_contains($html, 'Syntax highlighted by torchlight.dev')) { + $html .= file_get_contents(Hyde::path('src/resources/stubs/torchlight-badge.html')); + } + + return $html; + } +} diff --git a/src/DocumentationPageParser.php b/src/DocumentationPageParser.php new file mode 100644 index 00000000..9e929f00 --- /dev/null +++ b/src/DocumentationPageParser.php @@ -0,0 +1,91 @@ +filepath = Hyde::path("_docs/$slug.md"); + if (!file_exists($this->filepath)) { + throw new Exception("File _docs/$slug.md not found.", 404); + } + + $this->execute(); + } + + /** + * Handle the parsing job. + * @return void + */ + #[NoReturn] + public function execute(): void + { + // Get the text stream from the markdown file + $stream = file_get_contents($this->filepath); + + $this->title = $this->findTitleTag($stream) ?? Str::title(str_replace('-', ' ', $this->slug)); + + $this->body = $stream; + } + + /** + * Attempt to find the title based on the first H1 tag + */ + public function findTitleTag(string $stream): string|false + { + $lines = explode("\n", $stream); + + foreach ($lines as $line) { + if (str_starts_with($line, '# ')) { + return substr($line, 2); + } + } + + return false; + } + + /** + * Get the Documentation Page Object. + * @return DocumentationPage + */ + #[Pure] + public function get(): DocumentationPage + { + return new DocumentationPage($this->slug, $this->title, $this->body); + } +} diff --git a/src/Features.php b/src/Features.php new file mode 100644 index 00000000..140ad05d --- /dev/null +++ b/src/Features.php @@ -0,0 +1,105 @@ +filepath = Hyde::path("_pages/$slug.md"); + if (!file_exists($this->filepath)) { + throw new Exception("File _pages/$slug.md not found.", 404); + } + + $this->execute(); + } + + /** + * Handle the parsing job. + * @return void + */ + #[NoReturn] + public function execute(): void + { + // Get the text stream from the markdown file + $stream = file_get_contents($this->filepath); + + // Split out the front matter and markdown + $split = $this->split($stream); + + $this->matter = array_merge($this->parseFrontMatter($split['matter']), [ + 'slug' => $this->slug // Make sure to use the filename as the slug and not any potential override + ]); + + // Implode the line array back into a markdown string + $this->body = implode("\n", $split['markdown']); + } + + /** + * Split the front matter from the markdown. + * @param string $stream + * @return array + */ + #[ArrayShape(['matter' => "array", 'markdown' => "array"])] + public function split(string $stream): array + { + $lines = explode("\n", $stream); + + // Find the start and end position of the YAML block. + // Note that unless something is wrong with the file the start index should always be 0. + $matterSectionIndex = []; + foreach ($lines as $lineNumber => $lineContents) { + if (str_starts_with($lineContents, '---')) { + if (sizeof($matterSectionIndex) === 0) { + $matterSectionIndex['start'] = $lineNumber; + } elseif (sizeof($matterSectionIndex) === 1) { + $matterSectionIndex['end'] = $lineNumber; + break; + } + } + } + + // If the start and end tags don't exist, the file probably does not have any front matter. + if (!isset($matterSectionIndex['start']) && !isset($matterSectionIndex['end'])) { + throw new Exception("File _pages/$this->slug.md is missing front matter.", 400); + } + + // Construct the new line arrays + $matter = []; + $markdown = []; + foreach ($lines as $lineNumber => $lineContents) { + if ($lineNumber <= $matterSectionIndex['end']) { + $matter[] = $lineContents; + } else { + $markdown[] = $lineContents; + } + } + + // Remove the dashes + unset($matter[$matterSectionIndex['start']]); + unset($matter[$matterSectionIndex['end']]); + + return [ + 'matter' => $matter, + 'markdown' => $markdown, + ]; + } + + /** + * Parse lines of Front Matter YAML into an associative array. + * @param array $lines + * @return array + */ + public function parseFrontMatter(array $lines): array + { + $matter = []; + foreach ($lines as $line) { + $array = (explode(': ', $line, 2)); + $matter[$array[0]] = $array[1]; + } + return $matter; + } + + /** + * Get the Markdown Page Object. + * @return MarkdownPage + */ + #[Pure] + public function get(): MarkdownPage + { + return new MarkdownPage($this->slug, $this->matter['title'], $this->body); + } +} diff --git a/src/MarkdownPostParser.php b/src/MarkdownPostParser.php new file mode 100644 index 00000000..a6b4754e --- /dev/null +++ b/src/MarkdownPostParser.php @@ -0,0 +1,162 @@ +filepath = Hyde::path("_posts/$slug.md"); + if (!file_exists($this->filepath)) { + throw new Exception("File _posts/$slug.md not found.", 404); + } + + $this->execute(); + } + + /** + * Handle the parsing job. + * @return void + */ + #[NoReturn] + public function execute(): void + { + // Get the text stream from the markdown file + $stream = file_get_contents($this->filepath); + + // Split out the front matter and markdown + $split = $this->split($stream); + + $this->matter = array_merge($this->parseFrontMatter($split['matter']), [ + 'slug' => $this->slug // Make sure to use the filename as the slug and not any potential override + ]); + + // Implode the line array back into a markdown string + $this->body = implode("\n", $split['markdown']); + } + + /** + * Split the front matter from the markdown. + * @param string $stream + * @return array + */ + #[ArrayShape(['matter' => "array", 'markdown' => "array"])] + public function split(string $stream): array + { + $lines = explode("\n", $stream); + + // Find the start and end position of the YAML block. + // Note that unless something is wrong with the file the start index should always be 0. + $matterSectionIndex = []; + foreach ($lines as $lineNumber => $lineContents) { + if (str_starts_with($lineContents, '---')) { + if (sizeof($matterSectionIndex) === 0) { + $matterSectionIndex['start'] = $lineNumber; + } elseif (sizeof($matterSectionIndex) === 1) { + $matterSectionIndex['end'] = $lineNumber; + break; + } + } + } + + // Construct the new line arrays + $matter = []; + $markdown = []; + foreach ($lines as $lineNumber => $lineContents) { + if ($lineNumber <= $matterSectionIndex['end']) { + $matter[] = $lineContents; + } else { + $markdown[] = $lineContents; + } + } + + // Remove the dashes + unset($matter[$matterSectionIndex['start']]); + unset($matter[$matterSectionIndex['end']]); + + return [ + 'matter' => $matter, + 'markdown' => $markdown, + ]; + } + + /** + * Parse lines of Front Matter YAML into an associative array. + * @param array $lines + * @return array + */ + public function parseFrontMatter(array $lines): array + { + $matter = []; + foreach ($lines as $line) { + if (!str_contains($line, ':')) { + continue; // The front matter is invalid, so we skip the line. + } + + // Separate the key from the value + $array = (explode(': ', $line, 2)); + + // Assign the split values into variables so it's easier to keep track of them. + $key = $array[0]; + $value = $array[1]; + + // Filter the value to ensure a predictable state + + // Remove quotes while allowing quotes within the actual text + if (str_starts_with($value, '"') && str_ends_with($value, '"')) { + $value = substr($value, 1); + $value = substr($value, 0, -1); + } + + // Trim trailing whitespace + $value = trim($value, ' '); + + $matter[$key] = $value; + } + return $matter; + } + + /** + * Get the Markdown Post Object. + * @return MarkdownPost + */ + #[Pure] + public function get(): MarkdownPost + { + return new MarkdownPost($this->matter, $this->body, $this->slug); + } +} diff --git a/src/Models/BladePage.php b/src/Models/BladePage.php new file mode 100644 index 00000000..67d22921 --- /dev/null +++ b/src/Models/BladePage.php @@ -0,0 +1,27 @@ +view = $view; + } +} diff --git a/src/Models/DocumentationPage.php b/src/Models/DocumentationPage.php new file mode 100644 index 00000000..cac3b2cb --- /dev/null +++ b/src/Models/DocumentationPage.php @@ -0,0 +1,58 @@ +slug = $slug; + $this->title = $title; + $this->content = $content; + } + + /** + * Get an array of all the available Markdown Pages + * @return array + */ + public static function allAsArray(): array + { + $array = []; + + foreach (glob(Hyde::path('_docs/*.md')) as $filepath) { + $array[basename($filepath, '.md')] = $filepath; + } + + return $array; + } +} diff --git a/src/Models/MarkdownPage.php b/src/Models/MarkdownPage.php new file mode 100644 index 00000000..5b4e7b17 --- /dev/null +++ b/src/Models/MarkdownPage.php @@ -0,0 +1,59 @@ +slug = $slug; + $this->title = $title; + $this->content = $content; + } + + + /** + * Get an array of all the available Markdown Pages + * @return array + */ + public static function allAsArray(): array + { + $array = []; + + foreach (glob(Hyde::path('_pages/*.md')) as $filepath) { + $array[basename($filepath, '.md')] = $filepath; + } + + return $array; + } +} diff --git a/src/Models/MarkdownPost.php b/src/Models/MarkdownPost.php new file mode 100644 index 00000000..861e0af6 --- /dev/null +++ b/src/Models/MarkdownPost.php @@ -0,0 +1,60 @@ +matter = $matter; + $this->body = $body; + $this->slug = $slug; + } + + /** + * Get a Laravel Collection of all Posts as MarkdownPost objects. + * @return Collection + */ + public static function getCollection(): Collection + { + $collection = new Collection(); + + foreach (glob(Hyde::path('_posts/*.md')) as $filepath) { + $collection->push((new MarkdownPostParser(basename($filepath, '.md')))->get()); + } + + return $collection->sortByDesc('matter.date'); + } +} diff --git a/src/Services/CollectionService.php b/src/Services/CollectionService.php new file mode 100644 index 00000000..9c6aa394 --- /dev/null +++ b/src/Services/CollectionService.php @@ -0,0 +1,103 @@ + 'path.md'] + * @param string $model + * @return array|false array on success, false if the class was not found + */ + public static function getSourceSlugsOfModels(string $model): array|false + { + if ($model == BladePage::class) { + return self::getBladePageList(); + } + + if ($model == MarkdownPage::class) { + return self::getMarkdownPageList(); + } + + if ($model == MarkdownPost::class) { + return self::getMarkdownPostList(); + } + + if ($model == DocumentationPage::class) { + return self::getDocumentationPageList(); + } + + return false; + } + + /** + * Get all the Blade files in the resources/views/pages directory. + * @return array + */ + public static function getBladePageList(): array + { + $array = []; + + foreach (glob(Hyde::path('resources/views/pages/*.blade.php')) as $filepath) { + $array[] = basename($filepath, '.blade.php'); + } + + return $array; + } + + /** + * Get all the Markdown files in the _pages directory. + * @return array + */ + public static function getMarkdownPageList(): array + { + $array = []; + + foreach (glob(Hyde::path('_pages/*.md')) as $filepath) { + $array[] = basename($filepath, '.md'); + } + + return $array; + } + + /** + * Get all the Markdown files in the _posts directory. + * @return array + */ + public static function getMarkdownPostList(): array + { + $array = []; + + foreach (glob(Hyde::path('_posts/*.md')) as $filepath) { + $array[] = basename($filepath, '.md'); + } + + return $array; + } + + + /** + * Get all the Markdown files in the _docs directory. + * @return array + */ + public static function getDocumentationPageList(): array + { + $array = []; + + foreach (glob(Hyde::path('_docs/*.md')) as $filepath) { + $array[] = basename($filepath, '.md'); + } + + return $array; + } +} diff --git a/src/StaticPageBuilder.php b/src/StaticPageBuilder.php new file mode 100644 index 00000000..e89615bc --- /dev/null +++ b/src/StaticPageBuilder.php @@ -0,0 +1,145 @@ +createdFileSize = $this->__invoke(); + } + } + + /** + * Run the page builder. + * @return bool|int|void + */ + public function __invoke() + { + if ($this->page instanceof MarkdownPost) { + return $this->save('posts/' . $this->page->slug, $this->compilePost()); + } + + if ($this->page instanceof MarkdownPage) { + return $this->save($this->page->slug, $this->compilePage()); + } + + if ($this->page instanceof BladePage) { + return $this->save($this->page->view, $this->compileView()); + } + + if ($this->page instanceof DocumentationPage) { + return $this->save('docs/' . $this->page->slug, $this->compileDocs()); + } + } + + /** + * Get the debug data. + * @param bool $relativeFilePath should the returned filepath be relative instead of absolute? + * @return array + */ + #[ArrayShape(['createdFileSize' => "mixed", 'createdFilePath' => "mixed"])] + public function getDebugOutput(bool $relativeFilePath = true): array + { + return [ + 'createdFileSize' => $this->createdFileSize, + 'createdFilePath' => $relativeFilePath + ? str_replace(Hyde::path(), '', $this->createdFilePath) + : $this->createdFilePath , + ]; + } + + /** + * Save the compiled HTML to file. + * @param string $location of the output file relative to _site/ + * @param string $contents to save to the file + */ + private function save(string $location, string $contents): bool|int + { + $path = Hyde::path("_site/$location.html"); + $this->createdFilePath = $path; + return file_put_contents($path, $contents); + } + + /** + * Compile a Post into HTML using the Blade View. + * @return string + */ + private function compilePost(): string + { + return view('post')->with([ + 'post' => $this->page, + 'title' => $this->page->matter['title'], + 'markdown' => MarkdownConverter::parse($this->page->body), + 'currentPage' => 'posts/' . $this->page->slug + ])->render(); + } + + /** + * Compile a Documentation page into HTML using the Blade View. + * @return string + */ + private function compileDocs(): string + { + return view('docs')->with([ + 'docs' => $this->page, + 'title' => $this->page->title, + 'markdown' => MarkdownConverter::parse($this->page->content), + 'currentPage' => 'docs/' . $this->page->slug + ])->render(); + } + + /** + * Compile a Markdown Page into HTML using the Blade View. + * @return string + */ + private function compilePage(): string + { + return view('page')->with([ + 'title' => $this->page->title, + 'markdown' => MarkdownConverter::parse($this->page->content), + 'currentPage' => $this->page->slug + ])->render(); + } + + + /** + * Compile a custom Blade View into HTML. + * @return string + */ + private function compileView(): string + { + return view('pages/' . $this->page->view, [ + 'currentPage' => $this->page->view + ])->render(); + } +} diff --git a/vendor/autoload.php b/vendor/autoload.php index 2c9bc13b..1e3dd555 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitfefba013dff19f8d70a8c96b2f9ac511::getLoader(); +return ComposerAutoloaderInit8f76c0c929628c41939054002fc957e9::getLoader(); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 80323f06..e92d3117 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,5 +6,5 @@ $baseDir = dirname($vendorDir); return array( - 'Hyde\\Framework\\' => array($baseDir . '/src'), + 'App\\Core\\' => array($baseDir . '/src'), ); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 78e55ce6..57f14b4e 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitfefba013dff19f8d70a8c96b2f9ac511 +class ComposerAutoloaderInit8f76c0c929628c41939054002fc957e9 { private static $loader; @@ -22,15 +22,15 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitfefba013dff19f8d70a8c96b2f9ac511', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit8f76c0c929628c41939054002fc957e9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInitfefba013dff19f8d70a8c96b2f9ac511', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit8f76c0c929628c41939054002fc957e9', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitfefba013dff19f8d70a8c96b2f9ac511::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit8f76c0c929628c41939054002fc957e9::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index d607d6b3..c98f1150 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,17 +4,17 @@ namespace Composer\Autoload; -class ComposerStaticInitfefba013dff19f8d70a8c96b2f9ac511 +class ComposerStaticInit8f76c0c929628c41939054002fc957e9 { public static $prefixLengthsPsr4 = array ( - 'H' => + 'A' => array ( - 'Hyde\\Framework\\' => 15, + 'App\\Core\\' => 9, ), ); public static $prefixDirsPsr4 = array ( - 'Hyde\\Framework\\' => + 'App\\Core\\' => array ( 0 => __DIR__ . '/../..' . '/src', ), @@ -27,9 +27,9 @@ class ComposerStaticInitfefba013dff19f8d70a8c96b2f9ac511 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitfefba013dff19f8d70a8c96b2f9ac511::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitfefba013dff19f8d70a8c96b2f9ac511::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitfefba013dff19f8d70a8c96b2f9ac511::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit8f76c0c929628c41939054002fc957e9::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit8f76c0c929628c41939054002fc957e9::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit8f76c0c929628c41939054002fc957e9::$classMap; }, null, ClassLoader::class); }