1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace HDNET\OnpageIntegration\Controller; |
4
|
|
|
|
5
|
|
|
use HDNET\OnpageIntegration\Provider\MetaDataProvider; |
6
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
7
|
|
|
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; |
8
|
|
|
|
9
|
|
|
class BackendController extends ActionController |
10
|
|
|
{ |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @var \HDNET\OnpageIntegration\Loader\ApiResultLoader |
14
|
|
|
* @inject |
15
|
|
|
*/ |
16
|
|
|
protected $loader; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Represent the index page |
20
|
|
|
*/ |
21
|
|
|
public function indexAction() |
22
|
|
|
{ |
23
|
|
|
$metaDataProvider = GeneralUtility::makeInstance(MetaDataProvider::class); |
24
|
|
|
|
25
|
|
|
$this->view->assignMultiple([ |
26
|
|
|
'lastCrawl' => $this->loader->load('zoom_lastcrawl'), |
27
|
|
|
'seoMetaData' => $metaDataProvider->getMetaData('seoaspects'), |
28
|
|
|
'contentMetaData' => $metaDataProvider->getMetaData('contentaspects'), |
29
|
|
|
'technicalMetaData' => $metaDataProvider->getMetaData('technicalaspects'), |
30
|
|
|
'moduleName' => 'Zoom Module' |
31
|
|
|
]); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Detail Page |
36
|
|
|
* |
37
|
|
|
* @param string $call |
38
|
|
|
*/ |
39
|
|
View Code Duplication |
public function seoAction($call) |
|
|
|
|
40
|
|
|
{ |
41
|
|
|
$apiCallString = 'zoom_' . $call . '_table'; |
42
|
|
|
|
43
|
|
|
$table = $this->loader->load($apiCallString); |
44
|
|
|
$this->view->assignMultiple([ |
45
|
|
|
'table' => $table, |
46
|
|
|
'moduleName' => 'SEO Aspekte' |
47
|
|
|
]); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param string $call |
52
|
|
|
*/ |
53
|
|
View Code Duplication |
public function contentAction($call) |
|
|
|
|
54
|
|
|
{ |
55
|
|
|
$apiCallString = 'zoom_' . $call . '_table'; |
56
|
|
|
|
57
|
|
|
$table = $this->loader->load($apiCallString); |
58
|
|
|
$this->view->assignMultiple([ |
59
|
|
|
'table' => $table, |
60
|
|
|
'moduleName' => 'Inhaltliche Aspekte' |
61
|
|
|
]); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param string $call |
66
|
|
|
*/ |
67
|
|
View Code Duplication |
public function technicalAction($call) |
|
|
|
|
68
|
|
|
{ |
69
|
|
|
$apiCallString = 'zoom_' . $call . '_table'; |
70
|
|
|
|
71
|
|
|
$table = $this->loader->load($apiCallString); |
72
|
|
|
$this->view->assignMultiple([ |
73
|
|
|
'table' => $table, |
74
|
|
|
'moduleName' => 'Technische Aspekte' |
75
|
|
|
]); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* |
80
|
|
|
*/ |
81
|
|
|
public function keywordAction() |
82
|
|
|
{ |
83
|
|
|
$this->view->assignMultiple([ |
84
|
|
|
'moduleName' => 'Keyword' |
85
|
|
|
]); |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.