Completed
Pull Request — experimental/3.1 (#2308)
by chihiro
43:22 queued 19:38
created
src/Eccube/Application.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $this->register(new \Saxulum\Validator\Provider\SaxulumValidatorProvider());
160 160
         $this->register(new MobileDetectServiceProvider());
161 161
 
162
-        $this->error(function (\Exception $e, Request $request, $code) {
162
+        $this->error(function(\Exception $e, Request $request, $code) {
163 163
             if ($this['debug']) {
164 164
                 return;
165 165
             }
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
             return $router;
254 254
         });
255 255
 
256
-        $this['eccube.router.origin'] = function ($app) {
256
+        $this['eccube.router.origin'] = function($app) {
257 257
             $resource = __DIR__.'/Controller';
258 258
             $cachePrefix = 'Origin';
259 259
 
260 260
             return $app['eccube.router']($resource, $cachePrefix);
261 261
         };
262 262
 
263
-        $this['eccube.routers.plugin'] = function ($app) {
263
+        $this['eccube.routers.plugin'] = function($app) {
264 264
             // TODO 有効なプラグインを対象とする必要がある.
265 265
             $dirs = Finder::create()
266 266
                 ->in($app['config']['root_dir'].'/app/Plugin')
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             return $routers;
278 278
         };
279 279
 
280
-        $this['eccube.router.extend'] = function ($app) {
280
+        $this['eccube.router.extend'] = function($app) {
281 281
             // TODO ディレクトリ名は暫定
282 282
             $resource = $app['config']['root_dir'].'/app/Acme/Controller';
283 283
             $cachePrefix = 'Extend';
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             return $router;
288 288
         };
289 289
 
290
-        $this->extend('request_matcher', function ($matcher, $app) {
290
+        $this->extend('request_matcher', function($matcher, $app) {
291 291
             $matchers = [];
292 292
             $matchers[] = $app['eccube.router.extend'];
293 293
             foreach ($app['eccube.routers.plugin'] as $router) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             return new ChainUrlMatcher($matchers, $app['request_context']);
300 300
         });
301 301
 
302
-        $this->extend('url_generator', function ($generator, $app) {
302
+        $this->extend('url_generator', function($generator, $app) {
303 303
             $generators = [];
304 304
             $generators[] = $app['eccube.router.extend'];
305 305
             foreach ($app['eccube.routers.plugin'] as $router) {
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             'translator.cache_dir' => $this['debug'] ? null : $this['config']['root_dir'].'/app/cache/translator',
331 331
             'locale_fallbacks' => ['ja', 'en'],
332 332
         ));
333
-        $this->extend('translator', function ($translator, \Silex\Application $app) {
333
+        $this->extend('translator', function($translator, \Silex\Application $app) {
334 334
             $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
335 335
 
336 336
             $file = __DIR__.'/Resource/locale/validator.'.$app['locale'].'.yml';
@@ -377,14 +377,14 @@  discard block
 block discarded – undo
377 377
         $this->register(new \Silex\Provider\TwigServiceProvider(), array(
378 378
             'twig.form.templates' => array('Form/form_layout.twig'),
379 379
         ));
380
-        $this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) {
380
+        $this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) {
381 381
             $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app));
382 382
             $twig->addExtension(new \Twig_Extension_StringLoader());
383 383
 
384 384
             return $twig;
385 385
         });
386 386
 
387
-        $this->before(function (Request $request, \Silex\Application $app) {
387
+        $this->before(function(Request $request, \Silex\Application $app) {
388 388
             $app['admin'] = $app['front'] = false;
389 389
             $pathinfo = rawurldecode($request->getPathInfo());
390 390
             if (strpos($pathinfo, '/'.trim($app['config']['admin_route'], '/').'/') === 0) {
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
                 }
401 401
                 $paths[] = $app['config']['template_admin_realdir'];
402 402
                 $paths[] = __DIR__.'/../../app/Plugin';
403
-                $cacheDir =  __DIR__.'/../../app/cache/twig/admin';
403
+                $cacheDir = __DIR__.'/../../app/cache/twig/admin';
404 404
             } else {
405 405
                 if (file_exists($app['config']['template_realdir'])) {
406 406
                     $paths[] = $app['config']['template_realdir'];
407 407
                 }
408 408
                 $paths[] = $app['config']['template_default_realdir'];
409 409
                 $paths[] = __DIR__.'/../../app/Plugin';
410
-                $cacheDir =  __DIR__.'/../../app/cache/twig/'.$app['config']['template_code'];
410
+                $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code'];
411 411
             }
412 412
             $app['twig']->setCache($app['debug'] ? null : $cacheDir);
413 413
             $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths));
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
         }, self::EARLY_EVENT);
426 426
 
427 427
         // twigのグローバル変数を定義.
428
-        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) {
428
+        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) {
429 429
             // 未ログイン時にマイページや管理画面以下にアクセスするとSubRequestで実行されるため,
430 430
             // $event->isMasterRequest()ではなく、グローバル変数が初期化済かどうかの判定を行う
431 431
             if (isset($this['twig_global_initialized']) && $this['twig_global_initialized'] === true) {
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
         // メール送信時の文字エンコード指定(デフォルトはUTF-8)
493 493
         if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) {
494 494
             if ($this['config']['mail']['charset_iso_2022_jp'] === true) {
495
-                \Swift::init(function () {
495
+                \Swift::init(function() {
496 496
                     \Swift_DependencyContainer::getInstance()
497 497
                         ->register('mime.qpheaderencoder')
498 498
                         ->asAliasOf('mime.base64headerencoder');
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         $this->register(new \Saxulum\DoctrineOrmManagerRegistry\Provider\DoctrineOrmManagerRegistryProvider());
528 528
 
529 529
         $app = $this;
530
-        $this->extend('db.event_manager', function ($evm) use ($app) {
530
+        $this->extend('db.event_manager', function($evm) use ($app) {
531 531
             $initSubscriber = new InitSubscriber($app);
532 532
             $evm->addEventSubscriber($initSubscriber);
533 533
 
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 
625 625
         $this->extend(
626 626
             'orm.em.config',
627
-            function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
627
+            function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
628 628
 
629 629
                 /** @var $chain \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain */
630 630
                 $chain = $config->getMetadataDriverImpl();
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
             }
647 647
         );
648 648
 
649
-        $this->extend('orm.em', function (\Doctrine\ORM\EntityManager $em, \Silex\Application $app) {
649
+        $this->extend('orm.em', function(\Doctrine\ORM\EntityManager $em, \Silex\Application $app) {
650 650
             // tax_rule
651 651
             $taxRuleRepository = $em->getRepository('Eccube\Entity\TaxRule');
652 652
             $taxRuleRepository->setApplication($app);
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
             // second level cacheの設定.
676 676
             $this->extend(
677 677
                 'orm.em.config',
678
-                function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
678
+                function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
679 679
                     $config->setSecondLevelCacheEnabled();
680 680
                     $cacheConfig = $config->getSecondLevelCacheConfiguration();
681 681
                     $regionConfig = $cacheConfig->getRegionsConfiguration();
@@ -764,31 +764,31 @@  discard block
 block discarded – undo
764 764
             array('^/mypage', 'ROLE_USER', $channel),
765 765
         );
766 766
 
767
-        $this['eccube.password_encoder'] = function ($app) {
767
+        $this['eccube.password_encoder'] = function($app) {
768 768
             return new \Eccube\Security\Core\Encoder\PasswordEncoder($app['config']);
769 769
         };
770
-        $this['security.encoder_factory'] = function ($app) {
770
+        $this['security.encoder_factory'] = function($app) {
771 771
             return new \Symfony\Component\Security\Core\Encoder\EncoderFactory(array(
772 772
                 'Eccube\Entity\Customer' => $app['eccube.password_encoder'],
773 773
                 'Eccube\Entity\Member' => $app['eccube.password_encoder'],
774 774
             ));
775 775
         };
776
-        $this['eccube.event_listner.security'] = function ($app) {
776
+        $this['eccube.event_listner.security'] = function($app) {
777 777
             return new \Eccube\EventListener\SecurityEventListener($app['orm.em']);
778 778
         };
779 779
 
780 780
         // Voterの設定
781
-        $this['authority_voter'] = function ($app) {
781
+        $this['authority_voter'] = function($app) {
782 782
             return new \Eccube\Security\Voter\AuthorityVoter($app);
783 783
         };
784 784
 
785
-        $this->extend('security.voters', function ($voters, \Silex\Application $app) {
785
+        $this->extend('security.voters', function($voters, \Silex\Application $app) {
786 786
             $voters[] = $app['authority_voter'];
787 787
 
788 788
             return $voters;
789 789
         });
790 790
 
791
-        $this['security.access_manager'] = function ($app) {
791
+        $this['security.access_manager'] = function($app) {
792 792
             return new \Symfony\Component\Security\Core\Authorization\AccessDecisionManager($app['security.voters'], 'unanimous');
793 793
         };
794 794
 
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
     {
803 803
         $config = $this['config'];
804 804
         if (isset($config['trusted_proxies_connection_only']) && !empty($config['trusted_proxies_connection_only'])) {
805
-            $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($config) {
805
+            $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($config) {
806 806
                 // サブリクエストのREMOTE_ADDRも動的に設定を行う必要があるため、KernelEvents::REQUESTを使用する
807 807
                 Request::setTrustedProxies(array_merge(array($event->getRequest()->server->get('REMOTE_ADDR')), $config['trusted_proxies']));
808 808
             }, self::EARLY_EVENT);
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
         $app = $this;
969 969
 
970 970
         // Response Event(http cache対応、event実行は一番遅く設定)
971
-        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
971
+        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
972 972
 
973 973
             if (!$event->isMasterRequest()) {
974 974
                 return;
Please login to merge, or discard this patch.