Completed
Push — master ( 55fdf1...0c48af )
by Johannes
02:35
created

SingleBlogEntryAction::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 4
1
<?php
2
/**
3
 * Lichtenwallner  (https://lichtenwallner.at)
4
 *
5
 * @see https://github.com/jolicht/markdown-cms for the canonical source repository
6
 * @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
7
 * @copyright Copyright (c) Johannes Lichtenwallner
8
 */
9
declare(strict_types = 1);
10
namespace Jolicht\MarkdownCms\Action;
11
12
use Psr\Http\Message\ServerRequestInterface;
13
use Psr\Http\Message\ResponseInterface;
14
use Zend\Diactoros\Response\HtmlResponse;
15
16
class SingleBlogEntryAction extends AbstractAction
17
{
18
    /**
19
     * Get single blog entry
20
     * {@inheritDoc}
21
     * @see \Jolicht\MarkdownCms\Action\AbstractAction::__invoke()
22
     */
23
    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next = null)
24
    {
25
        $entry = ($this->getEntryParser())($request->getAttribute('id'));
26
        return new HtmlResponse($this->getTemplateRenderer()->render($entry->getTemplate(), ['entry' => $entry]));
27
    }
28
}