Failed Conditions
Pull Request — experimental/3.1 (#2449)
by Kiyotaka
52:40
created

FrontControllerProvider::connect()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 92
Code Lines 57

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 56
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 57
nc 2
nop 1
dl 0
loc 92
ccs 56
cts 57
cp 0.9825
crap 2
rs 8.491
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
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23
 */
24
25
namespace Eccube\ControllerProvider;
26
27
use Silex\Api\ControllerProviderInterface;
28
use Silex\Application;
29
30
class FrontControllerProvider implements ControllerProviderInterface
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
31
{
32 1100
    public function connect(Application $app)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
33
    {
34 1100
        $c = $app['controllers_factory'];
35
36
        // 強制SSL
37 1100
        if ($app['config']['force_ssl'] == \Eccube\Common\Constant::ENABLED) {
38
            $c->requireHttps();
39
        }
40
41
        // user定義
42 1100
        $c->match('/'.$app['config']['user_data_route'].'/{route}', '\Eccube\Controller\UserDataController::index')->assert('route', '([0-9a-zA-Z_\-]+\/?)+(?<!\/)')->bind('user_data');
43
44
        // root
45 1100
        $c->match('/', '\Eccube\Controller\TopController::index')->bind('homepage');
46 1100
        $c->match('/', '\Eccube\Controller\TopController::index')->bind('top'); // deprecated since 3.0.0, to be removed in 3.1
47 1100
        $c->match('/', '\Eccube\Controller\TopController::index')->bind('index'); // deprecated since 3.0.0, to be removed in 3.1
48
49
        // cart
50 1100
        $c->match('/cart', '\Eccube\Controller\CartController::index')->bind('cart');
51 1100
        $c->match('/cart/buystep', '\Eccube\Controller\CartController::buystep')->bind('cart_buystep');
52
53
        // contact
54 1100
        $c->match('/contact', '\Eccube\Controller\ContactController::index')->bind('contact');
55 1100
        $c->match('/contact/complete', '\Eccube\Controller\ContactController::complete')->bind('contact_complete');
56
57
        // entry
58 1100
        $c->match('/entry', '\Eccube\Controller\EntryController::index')->bind('entry');
59 1100
        $c->match('/entry/complete', '\Eccube\Controller\EntryController::complete')->bind('entry_complete');
60 1100
        $c->match('/entry/activate/{secret_key}', '\Eccube\Controller\EntryController::activate')->bind('entry_activate');
61
62
        // forgot
63 1100
        $c->match('/forgot', '\Eccube\Controller\ForgotController::index')->bind('forgot');
64 1100
        $c->match('/forgot/complete', '\Eccube\Controller\ForgotController::complete')->bind('forgot_complete');
65 1100
        $c->match('/forgot/reset/{reset_key}', '\Eccube\Controller\ForgotController::reset')->bind('forgot_reset');
66
67
        // block
68 1100
        $c->match('/block/category', '\Eccube\Controller\Block\CategoryController::index')->bind('block_category');
69 1100
        $c->match('/block/cart', '\Eccube\Controller\Block\CartController::index')->bind('block_cart');
70 1100
        $c->match('/block/search_product', '\Eccube\Controller\Block\SearchProductController::index')->bind('block_search_product');
71 1100
        $c->match('/block/news', '\Eccube\Controller\Block\NewsController::index')->bind('block_news');
72 1100
        $c->match('/block/login', '\Eccube\Controller\Block\LoginController::index')->bind('block_login');
73
74
        // 特定商取引 order -> help/traderaw
75 1100
        $c->match('/help/about', '\Eccube\Controller\HelpController::about')->bind('help_about');
76 1100
        $c->match('/help/guide', '\Eccube\Controller\HelpController::guide')->bind('help_guide');
77 1100
        $c->match('/help/privacy', '\Eccube\Controller\HelpController::privacy')->bind('help_privacy');
78 1100
        $c->match('/help/tradelaw', '\Eccube\Controller\HelpController::tradelaw')->bind('help_tradelaw');
79 1100
        $c->match('/help/agreement', '\Eccube\Controller\HelpController::agreement')->bind('help_agreement');
80
81
        // mypage
82 1100
        $c->match('/mypage', '\Eccube\Controller\Mypage\MypageController::index')->bind('mypage');
83 1100
        $c->match('/mypage/login', '\Eccube\Controller\Mypage\MypageController::login')->bind('mypage_login');
84 1100
        $c->match('/mypage/change', '\Eccube\Controller\Mypage\ChangeController::index')->bind('mypage_change');
85 1100
        $c->match('/mypage/change_complete', '\Eccube\Controller\Mypage\ChangeController::complete')->bind('mypage_change_complete');
86
87 1100
        $c->match('/mypage/delivery', '\Eccube\Controller\Mypage\DeliveryController::index')->bind('mypage_delivery');
88 1100
        $c->match('/mypage/delivery/new', '\Eccube\Controller\Mypage\DeliveryController::edit')->bind('mypage_delivery_new');
89 1100
        $c->match('/mypage/delivery/{id}/edit', '\Eccube\Controller\Mypage\DeliveryController::edit')->assert('id', '\d+')->bind('mypage_delivery_edit');
90 1100
        $c->delete('/mypage/delivery/{id}/delete', '\Eccube\Controller\Mypage\DeliveryController::delete')->assert('id', '\d+')->bind('mypage_delivery_delete');
91
92 1100
        $c->match('/mypage/favorite', '\Eccube\Controller\Mypage\MypageController::favorite')->bind('mypage_favorite');
93 1100
        $c->delete('/mypage/favorite/{id}/delete', '\Eccube\Controller\Mypage\MypageController::delete')->assert('id', '\d+')->bind('mypage_favorite_delete');
94 1100
        $c->match('/mypage/history/{id}', '\Eccube\Controller\Mypage\MypageController::history')->bind('mypage_history')->assert('id', '\d+');
95 1100
        $c->put('/mypage/order/{id}', '\Eccube\Controller\Mypage\MypageController::order')->bind('mypage_order')->assert('id', '\d+');
96 1100
        $c->match('/mypage/withdraw', '\Eccube\Controller\Mypage\WithdrawController::index')->bind('mypage_withdraw');
97 1100
        $c->match('/mypage/withdraw_complete', '\Eccube\Controller\Mypage\WithdrawController::complete')->bind('mypage_withdraw_complete');
98
99
        // products
100 1100
        $c->match('/products/list', '\Eccube\Controller\ProductController::index')->bind('product_list');
101 1100
        $c->match('/products/detail/{id}', '\Eccube\Controller\ProductController::detail')->bind('product_detail')->assert('id', '\d+');
102
103
        // shopping
104
        //$c->match('/shopping', '\Eccube\Controller\ShoppingController::index')->bind('shopping');
105 1100
        $c->match('/shopping/redirect', '\Eccube\Controller\ShoppingController::redirectTo')->bind('shopping_redirect_to');
106
        //$c->match('/shopping/confirm', '\Eccube\Controller\ShoppingController::confirm')->bind('shopping_confirm');
107
        // $c->match('/shopping/delivery', '\Eccube\Controller\ShoppingController::delivery')->bind('shopping_delivery');
108
        //$c->match('/shopping/payment', '\Eccube\Controller\ShoppingController::payment')->bind('shopping_payment');
109
        //$c->match('/shopping/shipping_change/{id}', '\Eccube\Controller\ShoppingController::shippingChange')->assert('id', '\d+')->bind('shopping_shipping_change');
110 1100
        $c->match('/shopping/shipping/{id}', '\Eccube\Controller\ShoppingController::shipping')->assert('id', '\d+')->bind('shopping_shipping');
111 1100
        $c->match('/shopping/shipping_edit_change/{id}', '\Eccube\Controller\ShoppingController::shippingEditChange')->assert('id', '\d+')->bind('shopping_shipping_edit_change');
112 1100
        $c->match('/shopping/shipping_edit/{id}', '\Eccube\Controller\ShoppingController::shippingEdit')->assert('id', '\d+')->bind('shopping_shipping_edit');
113 1100
        $c->match('/shopping/complete', '\Eccube\Controller\ShoppingController::complete')->bind('shopping_complete');
114 1100
        $c->match('/shopping/login', '\Eccube\Controller\ShoppingController::login')->bind('shopping_login');
115 1100
        $c->match('/shopping/nonmember', '\Eccube\Controller\NonMemberShoppingController::index')->bind('shopping_nonmember');
116 1100
        $c->match('/shopping/customer', '\Eccube\Controller\NonMemberShoppingController::customer')->bind('shopping_customer');
117 1100
        $c->match('/shopping/shopping_error', '\Eccube\Controller\ShoppingController::shoppingError')->bind('shopping_error');
118 1100
        $c->match('/shopping/shipping_multiple_change', '\Eccube\Controller\ShoppingController::shippingMultipleChange')->bind('shopping_shipping_multiple_change');
119 1100
        $c->match('/shopping/shipping_multiple', '\Eccube\Controller\ShippingMultipleController::index')->bind('shopping_shipping_multiple');
120 1100
        $c->match('/shopping/shipping_multiple_edit', '\Eccube\Controller\ShoppingController::shippingMultipleEdit')->bind('shopping_shipping_multiple_edit');
121
122 1100
        return $c;
123
    }
124
}
125