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\Renderer\Helper; |
15
|
|
|
|
16
|
|
|
use WebHemi\Environment\ServiceInterface as EnvironmentInterface; |
17
|
|
|
use WebHemi\Renderer\HelperInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Class GetCategoriesHelper |
21
|
|
|
*/ |
22
|
|
|
class GetCategoriesHelper implements HelperInterface |
23
|
|
|
{ |
24
|
|
|
/** @var EnvironmentInterface */ |
25
|
|
|
private $environmentManager; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* GetTagsHelper constructor. |
29
|
|
|
* |
30
|
|
|
* @param EnvironmentInterface $environmentManager |
31
|
|
|
*/ |
32
|
|
|
public function __construct(EnvironmentInterface $environmentManager) |
33
|
|
|
{ |
34
|
|
|
$this->environmentManager = $environmentManager; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Should return the name of the helper. |
39
|
|
|
* |
40
|
|
|
* @return string |
41
|
|
|
*/ |
42
|
|
|
public static function getName() : string |
43
|
|
|
{ |
44
|
|
|
return 'getCategories'; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Should return the name of the helper. |
49
|
|
|
* |
50
|
|
|
* @return string |
51
|
|
|
*/ |
52
|
|
|
public static function getDefinition() : string |
53
|
|
|
{ |
54
|
|
|
return '{{ getCategories(order_by, limit) }}'; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Gets helper options for the render. |
59
|
|
|
* |
60
|
|
|
* @return array |
61
|
|
|
* @codeCoverageIgnore - empty array |
62
|
|
|
*/ |
63
|
|
|
public static function getOptions() : array |
64
|
|
|
{ |
65
|
|
|
return []; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Should return a description text. |
70
|
|
|
* |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
public static function getDescription() : string |
74
|
|
|
{ |
75
|
|
|
return 'Returns the categories for the current application.'; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* A renderer helper should be called with its name. |
80
|
|
|
* |
81
|
|
|
* @return array |
82
|
|
|
*/ |
83
|
|
|
public function __invoke() : array |
84
|
|
|
{ |
85
|
|
|
/* TODO: tbd */ |
86
|
|
|
|
87
|
|
|
return [ |
88
|
|
|
['url' => 'posts', 'title' => 'Posts', 'total' => 280, 'new' => 1], |
89
|
|
|
['url' => 'useful', 'title' => 'Useful infos', 'total' => 280, 'new' => 0], |
90
|
|
|
['url' => 'events', 'title' => 'Events', 'total' => 280, 'new' => 0], |
91
|
|
|
['url' => 'something', 'title' => 'Something', 'total' => 280, 'new' => 8], |
92
|
|
|
]; |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|