diff --git a/src/Controllers/FrontendController.php b/src/Controllers/FrontendController.php index 7e16117..4f86185 100644 --- a/src/Controllers/FrontendController.php +++ b/src/Controllers/FrontendController.php @@ -3,8 +3,8 @@ namespace Aheenam\Mozhi\Controllers; use Aheenam\Mozhi\RouteResolver; -use Aheenam\Mozhi\TemplateRenderer; use Illuminate\Routing\Controller; +use Aheenam\Mozhi\TemplateRenderer; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class FrontendController extends Controller diff --git a/src/Models/Page.php b/src/Models/Page.php index dc4807a..824471d 100644 --- a/src/Models/Page.php +++ b/src/Models/Page.php @@ -51,7 +51,7 @@ public function meta($key = null) if ($key === null) { return $this->meta; } - if (!isset($this->meta[$key])) { + if (! isset($this->meta[$key])) { return; } diff --git a/src/RouteResolver.php b/src/RouteResolver.php index 525e957..56550d9 100644 --- a/src/RouteResolver.php +++ b/src/RouteResolver.php @@ -2,8 +2,8 @@ namespace Aheenam\Mozhi; -use Aheenam\Mozhi\Models\Page; use Storage; +use Aheenam\Mozhi\Models\Page; class RouteResolver { @@ -17,7 +17,7 @@ public function getPageByRoute($route = null) $contentStorage = Storage::disk(config('mozhi.content_disk')); $filePath = 'contents/'.$route.'.md'; - if ($route === null || !$contentStorage->exists($filePath)) { + if ($route === null || ! $contentStorage->exists($filePath)) { return; } diff --git a/src/TemplateRenderer.php b/src/TemplateRenderer.php index ba02acc..ef150d4 100644 --- a/src/TemplateRenderer.php +++ b/src/TemplateRenderer.php @@ -2,8 +2,8 @@ namespace Aheenam\Mozhi; -use Aheenam\Mozhi\Exceptions\TemplateNotFoundException; use Aheenam\Mozhi\Models\Page; +use Aheenam\Mozhi\Exceptions\TemplateNotFoundException; class TemplateRenderer { @@ -46,9 +46,10 @@ public function render($data = []) $currentTheme = self::getCurrentTheme(); $template = $this->getTemplate(); - if (!view()->exists("theme::$currentTheme.$template")) { + if (! view()->exists("theme::$currentTheme.$template")) { throw new TemplateNotFoundException("Template [$template] was not found in theme [$currentTheme]"); } + return view("theme::$currentTheme.$template", collect([ 'meta' => $this->page->meta(), 'content' => $this->page->getParsedContent(), diff --git a/tests/TemplateRendererTest.php b/tests/TemplateRendererTest.php index d64c10e..89e3923 100644 --- a/tests/TemplateRendererTest.php +++ b/tests/TemplateRendererTest.php @@ -2,10 +2,10 @@ namespace Aheenam\Mozhi\Test; -use Aheenam\Mozhi\Exceptions\TemplateNotFoundException; use Aheenam\Mozhi\RouteResolver; use Aheenam\Mozhi\TemplateRenderer; use Spatie\Snapshots\MatchesSnapshots; +use Aheenam\Mozhi\Exceptions\TemplateNotFoundException; class TemplateRendererTest extends TestCase {