SingleBlogEntryAction::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
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
}