Completed
Push — master ( a18085...d4249c )
by Fabien
03:34
created

ImageEditorController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 34.15 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 14
loc 41
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeAction() 14 14 2
A showAction() 0 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Fab\Media\Controller;
3
4
/**
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
use Fab\Media\Module\MediaModule;
18
use TYPO3\CMS\Backend\Utility\BackendUtility;
19
use TYPO3\CMS\Core\Resource\File;
20
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
21
22
/**
23
 * Controller which handles actions related to Image Editor.
24
 */
25
class ImageEditorController extends ActionController
26
{
27
28
    /**
29
     * @var \TYPO3\CMS\Core\Page\PageRenderer
30
     * @inject
31
     */
32
    protected $pageRenderer;
33
34
    /**
35
     * Initializes the controller before invoking an action method.
36
     */
37 View Code Duplication
    public function initializeAction()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
38
    {
39
        $this->pageRenderer->addInlineLanguageLabelFile('EXT:media/Resources/Private/Language/locallang.xlf');
40
41
        // Configure property mapping to retrieve the file object.
42
        if ($this->arguments->hasArgument('file')) {
43
44
            /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */
45
            $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter');
46
47
            $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration();
48
            $propertyMappingConfiguration->setTypeConverter($typeConverter);
49
        }
50
    }
51
52
    /**
53
     * Handle GUI for inserting an image in the RTE.
54
     *
55
     * @param File $file
56
     * @return void
57
     */
58
    public function showAction(File $file)
59
    {
60
        $this->view->assign('file', $file);
61
        $moduleSignature = MediaModule::getSignature();
62
        $this->view->assign('moduleUrl', BackendUtility::getModuleUrl($moduleSignature));
63
    }
64
65
}
66