Completed
Pull Request — experimental/3.1 (#2563)
by
unknown
156:09 queued 121:56
created
src/Eccube/Application.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         $this->register(new MobileDetectServiceProvider());
207 207
         $this->register(new TwigLintServiceProvider());
208 208
 
209
-        $this->error(function (\Exception $e, Request $request, $code) {
209
+        $this->error(function(\Exception $e, Request $request, $code) {
210 210
             if ($this['debug']) {
211 211
                 return;
212 212
             }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
         $pluginSubDirs = (function($dirName) use ($enabledPluginDirs) {
275 275
             return array_map(function($pluginDir) use ($dirName) {
276
-                return $pluginDir . '/' . $dirName;
276
+                return $pluginDir.'/'.$dirName;
277 277
             }, $enabledPluginDirs);
278 278
         });
279 279
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             return $router;
345 345
         });
346 346
 
347
-        $this['eccube.router.origin'] = function ($app) {
347
+        $this['eccube.router.origin'] = function($app) {
348 348
             $resource = __DIR__.'/Controller';
349 349
             $cachePrefix = 'Origin';
350 350
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         $this['eccube.routers.plugin'] = [];
355 355
 
356 356
         if (isset($this['config']['vendor_dir']) && file_exists($this['config']['vendor_dir'].'/Controller')) {
357
-            $this['eccube.router.extend'] = function ($app) {
357
+            $this['eccube.router.extend'] = function($app) {
358 358
                 $resource = $app['config']['vendor_dir'].'/Controller';
359 359
                 $cachePrefix = 'Extend';
360 360
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
                 return $router;
364 364
             };
365 365
         }
366
-        $this->extend('request_matcher', function ($matcher, $app) {
366
+        $this->extend('request_matcher', function($matcher, $app) {
367 367
             $matchers = [];
368 368
             if (isset($app['eccube.router.extend'])) {
369 369
                 $matchers[] = $app['eccube.router.extend'];
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             return new ChainUrlMatcher($matchers, $app['request_context']);
378 378
         });
379 379
 
380
-        $this->extend('url_generator', function ($generator, $app) {
380
+        $this->extend('url_generator', function($generator, $app) {
381 381
             $generators = [];
382 382
             if (isset($app['eccube.router.extend'])) {
383 383
                 $generators[] = $app['eccube.router.extend'];
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
         });
393 393
 
394 394
         // Route CollectionにEC-CUBEで定義したルーティングを追加(debug tool barに出力するため)
395
-        $this->extend('routes', function ($routes, $app) {
395
+        $this->extend('routes', function($routes, $app) {
396 396
             if (isset($app['eccube.router.extend'])) {
397 397
                 $routes->addCollection($app['eccube.router.extend']->getRouteCollection());
398 398
             }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
             'translator.cache_dir' => $this['debug'] ? null : $this['config']['root_dir'].'/app/cache/translator',
428 428
             'locale_fallbacks' => ['ja', 'en'],
429 429
         ));
430
-        $this->extend('translator', function ($translator, \Silex\Application $app) {
430
+        $this->extend('translator', function($translator, \Silex\Application $app) {
431 431
             $translator->addLoader('php', new \Symfony\Component\Translation\Loader\PhpFileLoader());
432 432
 
433 433
             $file = __DIR__.'/Resource/locale/messages.'.$app['locale'].'.php';
@@ -470,14 +470,14 @@  discard block
 block discarded – undo
470 470
         $this->register(new \Silex\Provider\TwigServiceProvider(), array(
471 471
             'twig.form.templates' => array('Form/form_div_layout.twig'),
472 472
         ));
473
-        $this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) {
473
+        $this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) {
474 474
             $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app));
475 475
             $twig->addExtension(new \Twig_Extension_StringLoader());
476 476
 
477 477
             return $twig;
478 478
         });
479 479
 
480
-        $this->before(function (Request $request, \Silex\Application $app) {
480
+        $this->before(function(Request $request, \Silex\Application $app) {
481 481
             $app['admin'] = $app['front'] = false;
482 482
             $pathinfo = rawurldecode($request->getPathInfo());
483 483
             if (strpos($pathinfo, '/'.trim($app['config']['admin_route'], '/').'/') === 0) {
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
                 }
494 494
                 $paths[] = $app['config']['template_admin_realdir'];
495 495
                 $paths[] = __DIR__.'/../../app/Plugin';
496
-                $cacheDir =  __DIR__.'/../../app/cache/twig/admin';
496
+                $cacheDir = __DIR__.'/../../app/cache/twig/admin';
497 497
             } else {
498 498
                 // モバイル端末時、smartphoneディレクトリを探索パスに追加する.
499 499
                 if ($app['mobile_detect.device_type'] == \Eccube\Entity\Master\DeviceType::DEVICE_TYPE_SP) {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
                 }
509 509
                 $paths[] = $app['config']['template_default_realdir'];
510 510
                 $paths[] = __DIR__.'/../../app/Plugin';
511
-                $cacheDir =  __DIR__.'/../../app/cache/twig/'.$app['config']['template_code'];
511
+                $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code'];
512 512
             }
513 513
             $app['twig']->setCache($app['debug'] ? null : $cacheDir);
514 514
             $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths));
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         }, self::EARLY_EVENT);
527 527
 
528 528
         // twigのグローバル変数を定義.
529
-        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) {
529
+        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) {
530 530
             // 未ログイン時にマイページや管理画面以下にアクセスするとSubRequestで実行されるため,
531 531
             // $event->isMasterRequest()ではなく、グローバル変数が初期化済かどうかの判定を行う
532 532
             if (isset($this['twig_global_initialized']) && $this['twig_global_initialized'] === true) {
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
         // メール送信時の文字エンコード指定(デフォルトはUTF-8)
612 612
         if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) {
613 613
             if ($this['config']['mail']['charset_iso_2022_jp'] === true) {
614
-                \Swift::init(function () {
614
+                \Swift::init(function() {
615 615
                     \Swift_DependencyContainer::getInstance()
616 616
                         ->register('mime.qpheaderencoder')
617 617
                         ->asAliasOf('mime.base64headerencoder');
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
         $this->register(new \Saxulum\DoctrineOrmManagerRegistry\Provider\DoctrineOrmManagerRegistryProvider());
647 647
 
648 648
         $app = $this;
649
-        $this->extend('db.event_manager', function ($evm) use ($app) {
649
+        $this->extend('db.event_manager', function($evm) use ($app) {
650 650
             $initSubscriber = new InitSubscriber($app);
651 651
             $evm->addEventSubscriber($initSubscriber);
652 652
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 
764 764
         $this->extend(
765 765
             'orm.em.config',
766
-            function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
766
+            function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
767 767
 
768 768
                 /** @var $chain \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain */
769 769
                 $chain = $config->getMetadataDriverImpl();
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
             }
786 786
         );
787 787
 
788
-        $this->extend('orm.em', function (\Doctrine\ORM\EntityManager $em, \Silex\Application $app) {
788
+        $this->extend('orm.em', function(\Doctrine\ORM\EntityManager $em, \Silex\Application $app) {
789 789
             // save
790 790
             $saveEventSubscriber = new \Eccube\Doctrine\EventSubscriber\SaveEventSubscriber($app);
791 791
             $em->getEventManager()->addEventSubscriber($saveEventSubscriber);
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
             // second level cacheの設定.
811 811
             $this->extend(
812 812
                 'orm.em.config',
813
-                function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
813
+                function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
814 814
                     $config->setSecondLevelCacheEnabled();
815 815
                     $cacheConfig = $config->getSecondLevelCacheConfiguration();
816 816
                     $regionConfig = $cacheConfig->getRegionsConfiguration();
@@ -899,31 +899,31 @@  discard block
 block discarded – undo
899 899
             array('^/mypage', 'ROLE_USER', $channel),
900 900
         );
901 901
 
902
-        $this['eccube.password_encoder'] = function ($app) {
902
+        $this['eccube.password_encoder'] = function($app) {
903 903
             return new \Eccube\Security\Core\Encoder\PasswordEncoder($app['config']);
904 904
         };
905
-        $this['security.encoder_factory'] = function ($app) {
905
+        $this['security.encoder_factory'] = function($app) {
906 906
             return new \Symfony\Component\Security\Core\Encoder\EncoderFactory(array(
907 907
                 'Eccube\Entity\Customer' => $app['eccube.password_encoder'],
908 908
                 'Eccube\Entity\Member' => $app['eccube.password_encoder'],
909 909
             ));
910 910
         };
911
-        $this['eccube.event_listner.security'] = function ($app) {
911
+        $this['eccube.event_listner.security'] = function($app) {
912 912
             return new \Eccube\EventListener\SecurityEventListener($app['orm.em']);
913 913
         };
914 914
 
915 915
         // Voterの設定
916
-        $this['authority_voter'] = function ($app) {
916
+        $this['authority_voter'] = function($app) {
917 917
             return new \Eccube\Security\Voter\AuthorityVoter($app);
918 918
         };
919 919
 
920
-        $this->extend('security.voters', function ($voters, \Silex\Application $app) {
920
+        $this->extend('security.voters', function($voters, \Silex\Application $app) {
921 921
             $voters[] = $app['authority_voter'];
922 922
 
923 923
             return $voters;
924 924
         });
925 925
 
926
-        $this['security.access_manager'] = function ($app) {
926
+        $this['security.access_manager'] = function($app) {
927 927
             return new \Symfony\Component\Security\Core\Authorization\AccessDecisionManager($app['security.voters'], 'unanimous');
928 928
         };
929 929
 
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
     {
938 938
         $config = $this['config'];
939 939
         if (isset($config['trusted_proxies_connection_only']) && !empty($config['trusted_proxies_connection_only'])) {
940
-            $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($config) {
940
+            $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($config) {
941 941
                 // サブリクエストのREMOTE_ADDRも動的に設定を行う必要があるため、KernelEvents::REQUESTを使用する
942 942
                 Request::setTrustedProxies(array_merge(array($event->getRequest()->server->get('REMOTE_ADDR')), $config['trusted_proxies']));
943 943
             }, self::EARLY_EVENT);
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
         $this->register(new ServiceProvider\EccubePluginServiceProvider());
955 955
 
956 956
         // TODO Acme\ServiceProvider の初期化はここで OK?
957
-        if (array_key_exists('service',$this['config'])) {
957
+        if (array_key_exists('service', $this['config'])) {
958 958
             foreach ($this['config']['service'] as $service) {
959 959
                 $this->register(new $service);
960 960
             }
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
         $app = $this;
1097 1097
 
1098 1098
         // Response Event(http cache対応、event実行は一番遅く設定)
1099
-        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
1099
+        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
1100 1100
 
1101 1101
             if (!$event->isMasterRequest()) {
1102 1102
                 return;
Please login to merge, or discard this patch.