Passed
Push — master ( c12552...22ad80 )
by Gabor
04:56
created

PostAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 54
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTemplateName() 0 4 1
B getTemplateData() 0 36 2
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\View;
15
16
use WebHemi\DateTime;
17
use WebHemi\Middleware\Action\AbstractMiddlewareAction;
18
19
/**
20
 * Class PostAction
21
 */
22
class PostAction extends AbstractMiddlewareAction
23
{
24
    /**
25
     * Gets template map name or template file path.
26
     *
27
     * @return string
28
     */
29
    public function getTemplateName() : string
30
    {
31
        return 'website-post-view';
32
    }
33
34
    /**
35
     * Gets template data.
36
     *
37
     * @return array
38
     */
39
    public function getTemplateData() : array
40
    {
41
        $routingParams = $this->getRoutingParameters();
42
43
        $content = 'Lorem ipsum dolor sit amet...';
44
        $testFile = __DIR__ . '/../../../../../data/temp/markdownTest.md';
45
46
        if (file_exists($testFile)) {
47
            $content = file_get_contents(__DIR__ . '/../../../../../data/temp/markdownTest.md');
48
        }
49
50
        return [
51
            'activeMenu' => '',
52
            'blogPost' => [
53
                'title'       => 'Hogy indítsuk jól a napot: egy finom, gőzőlgő tea esete',
54
                'summary'     => 'Jó tudni...',
55
                'category'    => ['useful' => 'Hasznos infók'],
56
                'tags'        => ['php' => 'PHP', 'coding' => 'Coding'],
57
                'illustration'=> '/data/upload/filesystem/images/Nature.jpg',
58
                'path'        => 'posts/view/a_perfect_day.html',
59
                'publishedAt' => new DateTime('now'),
60
                'location'    => 'München',
61
                'author'      => [
62
                    'name'   => 'Admin',
63
                    'username'=> 'admin',
64
                    'avatar' => '/data/upload/avatars/admin.png',
65
                    'mood'   => ['szeretve érzi magát', 'hugging'],
66
                ],
67
                'contentLead' => 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod 
68
                                       tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At 
69
                                       vero eos et accusam et justo duo dolores et ea rebum.',
70
                'content'     => $content,
71
                'parameter'   => $routingParams
72
            ]
73
        ];
74
    }
75
}
76