Completed
Push — master ( 3ed8ee...9dd9ae )
by Kentaro
21:09 queued 07:36
created

CacheController::index()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 27
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 4.432

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 27
ccs 7
cts 10
cp 0.7
rs 8.5806
cc 4
eloc 14
nc 4
nop 2
crap 4.432
1
<?php
2
/*
3
 * This file is part of EC-CUBE
4
 *
5
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
6
 *
7
 * http://www.lockon.co.jp/
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
 */
23
24
25
namespace Eccube\Controller\Admin\Content;
26
27
use Eccube\Application;
28
use Eccube\Controller\AbstractController;
29
use Eccube\Util\Cache;
30
use Symfony\Component\HttpFoundation\Request;
31
32
class CacheController extends AbstractController
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
33
{
34
35 2
    public function index(Application $app, Request $request)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
36
    {
37
38
        $form = $app->form()->getForm();
39
40
        if ('POST' === $request->getMethod()) {
41
42
            $form->handleRequest($request);
43
44
            if ($form->isValid()) {
45
46 1
                switch ($request->get('mode')) {
47 1
                    case 'twig':
48
                        // Twigキャッシュクリア
49
                        Cache::clear($app, false, true);
0 ignored issues
show
Documentation introduced by
$app is of type object<Eccube\Application>, but the function expects a object<Eccube\Util\Application>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
50
                        $app->addSuccess('admin.content.twig.cache.save.complete', 'admin');
51 1
                        break;
52
                    default:
53
                        break;
54
                }
55
            }
56
        }
57
58 2
        return $app->render('Content/cache.twig', array(
59 2
            'form' => $form->createView(),
60
        ));
61 2
    }
62
}
63