Passed
Push — master ( 749b16...167cfa )
by Gabor
04:47
created

PostViewAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTemplateName() 0 4 1
A getTemplateData() 0 16 1
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 7.1
6
 *
7
 * @copyright 2012 - 2017 Gixx-web (http://www.gixx-web.com)
8
 * @license   https://opensource.org/licenses/MIT The MIT License (MIT)
9
 *
10
 * @link      http://www.gixx-web.com
11
 */
12
declare(strict_types=1);
13
14
namespace WebHemi\Middleware\Action\Website;
15
16
use WebHemi\Adapter\Http\ServerRequestInterface;
17
use WebHemi\Middleware\AbstractMiddlewareAction;
18
19
class PostViewAction extends AbstractMiddlewareAction
20
{
21
    /**
22
     * Gets template map name or template file path.
23
     *
24
     * @return string
25
     */
26
    public function getTemplateName() : string
27
    {
28
        return 'website-post-view';
29
    }
30
31
    /**
32
     * Gets template data.
33
     *
34
     * @return array
35
     */
36
    public function getTemplateData() : array
37
    {
38
        $routingParams = $this->request->getAttribute(ServerRequestInterface::REQUEST_ATTR_ROUTING_PARAMETERS);
39
40
        return [
41
            'blogPost' => [
42
                'title'       => 'Fake test',
43
                'publishedAt' => time(),
44
                'author'      => [
45
                    'name' => 'Some User'
46
                ],
47
                'content'     => 'Lorem ipsum dolor sit amet...',
48
                'parameter'   => $routingParams
49
            ]
50
        ];
51
    }
52
}
53