Completed
Push — experimental/3.1 ( a17b3e...f391d2 )
by Kiyotaka
50:54
created
src/Eccube/Application.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $this->register(new MobileDetectServiceProvider());
235 235
         $this->register(new TwigLintServiceProvider());
236 236
 
237
-        $this->error(function (\Exception $e, Request $request, $code) {
237
+        $this->error(function(\Exception $e, Request $request, $code) {
238 238
             if ($this['debug']) {
239 239
                 return;
240 240
             }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
         $pluginSubDirs = (function($dirName) use ($enabledPluginDirs) {
301 301
             return array_map(function($pluginDir) use ($dirName) {
302
-                return $pluginDir . '/' . $dirName;
302
+                return $pluginDir.'/'.$dirName;
303 303
             }, $enabledPluginDirs);
304 304
         });
305 305
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
             return $router;
376 376
         });
377 377
 
378
-        $this['eccube.router.origin'] = function ($app) {
378
+        $this['eccube.router.origin'] = function($app) {
379 379
             $resource = __DIR__.'/Controller';
380 380
             $cachePrefix = 'Origin';
381 381
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
         $this['eccube.routers.plugin'] = [];
386 386
 
387 387
         if (isset($this['config']['vendor_dir']) && file_exists($this['config']['vendor_dir'].'/Controller')) {
388
-            $this['eccube.router.extend'] = function ($app) {
388
+            $this['eccube.router.extend'] = function($app) {
389 389
                 $resource = $app['config']['vendor_dir'].'/Controller';
390 390
                 $cachePrefix = 'Extend';
391 391
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                 return $router;
395 395
             };
396 396
         }
397
-        $this->extend('request_matcher', function ($matcher, $app) {
397
+        $this->extend('request_matcher', function($matcher, $app) {
398 398
             $matchers = [];
399 399
             if (isset($app['eccube.router.extend'])) {
400 400
                 $matchers[] = $app['eccube.router.extend'];
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
             return new ChainUrlMatcher($matchers, $app['request_context']);
409 409
         });
410 410
 
411
-        $this->extend('url_generator', function ($generator, $app) {
411
+        $this->extend('url_generator', function($generator, $app) {
412 412
             $generators = [];
413 413
             if (isset($app['eccube.router.extend'])) {
414 414
                 $generators[] = $app['eccube.router.extend'];
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         });
424 424
 
425 425
         // Route CollectionにEC-CUBEで定義したルーティングを追加(debug tool barに出力するため)
426
-        $this->extend('routes', function ($routes, $app) {
426
+        $this->extend('routes', function($routes, $app) {
427 427
             if (isset($app['eccube.router.extend'])) {
428 428
                 $routes->addCollection($app['eccube.router.extend']->getRouteCollection());
429 429
             }
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
             'translator.cache_dir' => $this['debug'] ? null : $this['config']['root_dir'].'/app/cache/translator',
459 459
             'locale_fallbacks' => ['ja', 'en'],
460 460
         ));
461
-        $this->extend('translator', function ($translator, \Silex\Application $app) {
461
+        $this->extend('translator', function($translator, \Silex\Application $app) {
462 462
             $translator->addLoader('php', new \Symfony\Component\Translation\Loader\PhpFileLoader());
463 463
 
464 464
             $file = __DIR__.'/Resource/locale/messages.'.$app['locale'].'.php';
@@ -501,14 +501,14 @@  discard block
 block discarded – undo
501 501
         $this->register(new \Silex\Provider\TwigServiceProvider(), array(
502 502
             'twig.form.templates' => array('Form/form_div_layout.twig'),
503 503
         ));
504
-        $this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) {
504
+        $this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) {
505 505
             $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app));
506 506
             $twig->addExtension(new \Twig_Extension_StringLoader());
507 507
 
508 508
             return $twig;
509 509
         });
510 510
 
511
-        $this->before(function (Request $request, \Silex\Application $app) {
511
+        $this->before(function(Request $request, \Silex\Application $app) {
512 512
             $app['admin'] = $app['front'] = false;
513 513
             $pathinfo = rawurldecode($request->getPathInfo());
514 514
             if (strpos($pathinfo, '/'.trim($app['config']['admin_route'], '/').'/') === 0) {
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
                 }
525 525
                 $paths[] = $app['config']['template_admin_realdir'];
526 526
                 $paths[] = __DIR__.'/../../app/Plugin';
527
-                $cacheDir =  __DIR__.'/../../app/cache/twig/admin';
527
+                $cacheDir = __DIR__.'/../../app/cache/twig/admin';
528 528
             } else {
529 529
                 // モバイル端末時、smartphoneディレクトリを探索パスに追加する.
530 530
                 if ($app['mobile_detect.device_type'] == \Eccube\Entity\Master\DeviceType::DEVICE_TYPE_SP) {
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
                 }
540 540
                 $paths[] = $app['config']['template_default_realdir'];
541 541
                 $paths[] = __DIR__.'/../../app/Plugin';
542
-                $cacheDir =  __DIR__.'/../../app/cache/twig/'.$app['config']['template_code'];
542
+                $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code'];
543 543
             }
544 544
             $app['twig']->setCache($app['debug'] ? null : $cacheDir);
545 545
             $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths));
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
         }, self::EARLY_EVENT);
558 558
 
559 559
         // twigのグローバル変数を定義.
560
-        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) {
560
+        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) {
561 561
             // 未ログイン時にマイページや管理画面以下にアクセスするとSubRequestで実行されるため,
562 562
             // $event->isMasterRequest()ではなく、グローバル変数が初期化済かどうかの判定を行う
563 563
             if (isset($this['twig_global_initialized']) && $this['twig_global_initialized'] === true) {
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
         // メール送信時の文字エンコード指定(デフォルトはUTF-8)
643 643
         if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) {
644 644
             if ($this['config']['mail']['charset_iso_2022_jp'] === true) {
645
-                \Swift::init(function () {
645
+                \Swift::init(function() {
646 646
                     \Swift_DependencyContainer::getInstance()
647 647
                         ->register('mime.qpheaderencoder')
648 648
                         ->asAliasOf('mime.base64headerencoder');
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
         $this->register(new \Saxulum\DoctrineOrmManagerRegistry\Provider\DoctrineOrmManagerRegistryProvider());
678 678
 
679 679
         $app = $this;
680
-        $this->extend('db.event_manager', function ($evm) use ($app) {
680
+        $this->extend('db.event_manager', function($evm) use ($app) {
681 681
             $initSubscriber = new InitSubscriber($app);
682 682
             $evm->addEventSubscriber($initSubscriber);
683 683
 
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 
795 795
         $this->extend(
796 796
             'orm.em.config',
797
-            function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
797
+            function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
798 798
 
799 799
                 /** @var $chain \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain */
800 800
                 $chain = $config->getMetadataDriverImpl();
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
             }
817 817
         );
818 818
 
819
-        $this->extend('orm.em', function (\Doctrine\ORM\EntityManager $em, \Silex\Application $app) {
819
+        $this->extend('orm.em', function(\Doctrine\ORM\EntityManager $em, \Silex\Application $app) {
820 820
             // save
821 821
             $saveEventSubscriber = new \Eccube\Doctrine\EventSubscriber\SaveEventSubscriber($app);
822 822
             $em->getEventManager()->addEventSubscriber($saveEventSubscriber);
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
             // second level cacheの設定.
842 842
             $this->extend(
843 843
                 'orm.em.config',
844
-                function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
844
+                function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
845 845
                     $config->setSecondLevelCacheEnabled();
846 846
                     $cacheConfig = $config->getSecondLevelCacheConfiguration();
847 847
                     $regionConfig = $cacheConfig->getRegionsConfiguration();
@@ -930,31 +930,31 @@  discard block
 block discarded – undo
930 930
             array('^/mypage', 'ROLE_USER', $channel),
931 931
         );
932 932
 
933
-        $this['eccube.password_encoder'] = function ($app) {
933
+        $this['eccube.password_encoder'] = function($app) {
934 934
             return new \Eccube\Security\Core\Encoder\PasswordEncoder($app['config']);
935 935
         };
936
-        $this['security.encoder_factory'] = function ($app) {
936
+        $this['security.encoder_factory'] = function($app) {
937 937
             return new \Symfony\Component\Security\Core\Encoder\EncoderFactory(array(
938 938
                 'Eccube\Entity\Customer' => $app['eccube.password_encoder'],
939 939
                 'Eccube\Entity\Member' => $app['eccube.password_encoder'],
940 940
             ));
941 941
         };
942
-        $this['eccube.event_listner.security'] = function ($app) {
942
+        $this['eccube.event_listner.security'] = function($app) {
943 943
             return new \Eccube\EventListener\SecurityEventListener($app['orm.em']);
944 944
         };
945 945
 
946 946
         // Voterの設定
947
-        $this['authority_voter'] = function ($app) {
947
+        $this['authority_voter'] = function($app) {
948 948
             return new \Eccube\Security\Voter\AuthorityVoter($app);
949 949
         };
950 950
 
951
-        $this->extend('security.voters', function ($voters, \Silex\Application $app) {
951
+        $this->extend('security.voters', function($voters, \Silex\Application $app) {
952 952
             $voters[] = $app['authority_voter'];
953 953
 
954 954
             return $voters;
955 955
         });
956 956
 
957
-        $this['security.access_manager'] = function ($app) {
957
+        $this['security.access_manager'] = function($app) {
958 958
             return new \Symfony\Component\Security\Core\Authorization\AccessDecisionManager($app['security.voters'], 'unanimous');
959 959
         };
960 960
 
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
         // ロードバランサやプロキシの設定をする
970 970
         $config = $this['config'];
971 971
         if (isset($config['trusted_proxies_connection_only']) && !empty($config['trusted_proxies_connection_only'])) {
972
-            $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($config) {
972
+            $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($config) {
973 973
                 // サブリクエストのREMOTE_ADDRも動的に設定を行う必要があるため、KernelEvents::REQUESTを使用する
974 974
                 Request::setTrustedProxies(array_merge(array($event->getRequest()->server->get('REMOTE_ADDR')), $config['trusted_proxies']));
975 975
             }, self::EARLY_EVENT);
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
         $this->register(new ServiceProvider\EccubePluginServiceProvider());
989 989
 
990 990
         // TODO Acme\ServiceProvider の初期化はここで OK?
991
-        if (array_key_exists('service',$this['config'])) {
991
+        if (array_key_exists('service', $this['config'])) {
992 992
             foreach ($this['config']['service'] as $service) {
993 993
                 $this->register(new $service);
994 994
             }
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
         $app = $this;
1111 1111
 
1112 1112
         // Response Event(http cache対応、event実行は一番遅く設定)
1113
-        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
1113
+        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
1114 1114
 
1115 1115
             if (!$event->isMasterRequest()) {
1116 1116
                 return;
Please login to merge, or discard this patch.