Completed
Push — master ( e0ed7b...0e5eef )
by Jakub
03:22
created

Classes/Controller/AdministrationController.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace DCNGmbH\MooxCore\Controller;
3
4
/***************************************************************
5
 *  Copyright notice
6
 *
7
 *  (c) 2014 Jakub Czyz <[email protected]>
8
 *
9
 *  All rights reserved
10
 *
11
 *  This script is part of the TYPO3 project. The TYPO3 project is
12
 *  free software; you can redistribute it and/or modify
13
 *  it under the terms of the GNU General Public License as published by
14
 *  the Free Software Foundation; either version 2 of the License, or
15
 *  (at your option) any later version.
16
 *
17
 *  The GNU General Public License can be found at
18
 *  http://www.gnu.org/copyleft/gpl.html.
19
 *
20
 *  This script is distributed in the hope that it will be useful,
21
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 *  GNU General Public License for more details.
24
 *
25
 *  This copyright notice MUST APPEAR in all copies of the script!
26
 ***************************************************************/
27
28
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
29
 
30
/**
31
 * The main Controller, managing all the tasks for moox core dashboard management
32
 */
33
class AdministrationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
34
35
    /**
36
     * extConf
37
     *
38
     * @var boolean
39
     */
40
    protected $extConf;
41
42
    /**
43
     * initialize the controller
44
     *
45
     * @return void
46
     */
47
    protected function initializeAction() {
0 ignored issues
show
initializeAction uses the super-global variable $GLOBALS which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
48
        parent::initializeAction();
49
        $this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['moox_core']);
50
    }
51
 
52
    /**
53
     * action dashboard
54
     *
55
     * @return void
56
     */
57
    public function dashboardAction() {
58
    }
59
60
    /**
61
     * action designer
62
     *
63
     * @return void
64
     */
65
    public function designerAction() {
66
    }
67
}