Passed
Push — master ( 3d3d69...b10d98 )
by Julito
21:59
created

EditorController::customEditorFileManager()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 83
Code Lines 50

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 50
nc 2
nop 5
dl 0
loc 83
rs 9.0909
c 1
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Controller;
8
9
use Chamilo\CoreBundle\Component\Editor\CkEditor\CkEditor;
10
use Chamilo\CoreBundle\Traits\ControllerTrait;
11
use Chamilo\CoreBundle\Traits\CourseControllerTrait;
12
use Chamilo\CoreBundle\Traits\ResourceControllerTrait;
13
use Symfony\Component\HttpFoundation\Response;
14
use Symfony\Component\Routing\Annotation\Route;
15
use Symfony\Component\Routing\RouterInterface;
16
use Symfony\Contracts\Translation\TranslatorInterface;
17
18
#[Route('/editor')]
19
class EditorController extends BaseController
20
{
21
    use ControllerTrait;
22
    use ResourceControllerTrait;
23
    use CourseControllerTrait;
24
25
    /**
26
     * Get templates (left column when creating a document).
27
     *
28
     * @Route("/templates", methods={"GET"}, name="editor_templates")
29
     *
30
     * @return Response
31
     */
32
    public function editorTemplatesAction(TranslatorInterface $translator, RouterInterface $router)
33
    {
34
        $editor = new CkEditor(
35
            $translator,
36
            $router
37
        );
38
        $templates = $editor->simpleFormatTemplates();
39
40
        return $this->render(
41
            '@ChamiloCore/Editor/templates.html.twig',
42
            [
43
                'templates' => $templates,
44
            ]
45
        );
46
    }
47
}
48