Completed
Push — experimental/3.1 ( dcc31e...b9bcde )
by Kiyotaka
129:40 queued 123:35
created
src/Eccube/Application.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $this->register(new \Silex\Provider\ValidatorServiceProvider());
165 165
         $this->register(new MobileDetectServiceProvider());
166 166
 
167
-        $this->error(function (\Exception $e, Request $request, $code) {
167
+        $this->error(function(\Exception $e, Request $request, $code) {
168 168
             if ($this['debug']) {
169 169
                 return;
170 170
             }
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
             return $router;
259 259
         });
260 260
 
261
-        $this['eccube.router.origin'] = function ($app) {
261
+        $this['eccube.router.origin'] = function($app) {
262 262
             $resource = __DIR__.'/Controller';
263 263
             $cachePrefix = 'Origin';
264 264
 
265 265
             return $app['eccube.router']($resource, $cachePrefix);
266 266
         };
267 267
 
268
-        $this['eccube.routers.plugin'] = function ($app) {
268
+        $this['eccube.routers.plugin'] = function($app) {
269 269
             // TODO 有効なプラグインを対象とする必要がある.
270 270
             $dirs = Finder::create()
271 271
                 ->in($app['config']['root_dir'].'/app/Plugin')
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             return $routers;
283 283
         };
284 284
 
285
-        $this['eccube.router.extend'] = function ($app) {
285
+        $this['eccube.router.extend'] = function($app) {
286 286
             // TODO ディレクトリ名は暫定
287 287
             $resource = $app['config']['root_dir'].'/app/Acme/Controller';
288 288
             $cachePrefix = 'Extend';
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             return $router;
293 293
         };
294 294
 
295
-        $this->extend('request_matcher', function ($matcher, $app) {
295
+        $this->extend('request_matcher', function($matcher, $app) {
296 296
             $matchers = [];
297 297
             $matchers[] = $app['eccube.router.extend'];
298 298
             foreach ($app['eccube.routers.plugin'] as $router) {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             return new ChainUrlMatcher($matchers, $app['request_context']);
305 305
         });
306 306
 
307
-        $this->extend('url_generator', function ($generator, $app) {
307
+        $this->extend('url_generator', function($generator, $app) {
308 308
             $generators = [];
309 309
             $generators[] = $app['eccube.router.extend'];
310 310
             foreach ($app['eccube.routers.plugin'] as $router) {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             'translator.cache_dir' => $this['debug'] ? null : $this['config']['root_dir'].'/app/cache/translator',
336 336
             'locale_fallbacks' => ['ja', 'en'],
337 337
         ));
338
-        $this->extend('translator', function ($translator, \Silex\Application $app) {
338
+        $this->extend('translator', function($translator, \Silex\Application $app) {
339 339
             $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader());
340 340
 
341 341
             $file = __DIR__.'/Resource/locale/validator.'.$app['locale'].'.yml';
@@ -382,14 +382,14 @@  discard block
 block discarded – undo
382 382
         $this->register(new \Silex\Provider\TwigServiceProvider(), array(
383 383
             'twig.form.templates' => array('Form/form_layout.twig'),
384 384
         ));
385
-        $this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) {
385
+        $this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) {
386 386
             $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app));
387 387
             $twig->addExtension(new \Twig_Extension_StringLoader());
388 388
 
389 389
             return $twig;
390 390
         });
391 391
 
392
-        $this->before(function (Request $request, \Silex\Application $app) {
392
+        $this->before(function(Request $request, \Silex\Application $app) {
393 393
             $app['admin'] = $app['front'] = false;
394 394
             $pathinfo = rawurldecode($request->getPathInfo());
395 395
             if (strpos($pathinfo, '/'.trim($app['config']['admin_route'], '/').'/') === 0) {
@@ -405,14 +405,14 @@  discard block
 block discarded – undo
405 405
                 }
406 406
                 $paths[] = $app['config']['template_admin_realdir'];
407 407
                 $paths[] = __DIR__.'/../../app/Plugin';
408
-                $cacheDir =  __DIR__.'/../../app/cache/twig/admin';
408
+                $cacheDir = __DIR__.'/../../app/cache/twig/admin';
409 409
             } else {
410 410
                 if (file_exists($app['config']['template_realdir'])) {
411 411
                     $paths[] = $app['config']['template_realdir'];
412 412
                 }
413 413
                 $paths[] = $app['config']['template_default_realdir'];
414 414
                 $paths[] = __DIR__.'/../../app/Plugin';
415
-                $cacheDir =  __DIR__.'/../../app/cache/twig/'.$app['config']['template_code'];
415
+                $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code'];
416 416
             }
417 417
             $app['twig']->setCache($app['debug'] ? null : $cacheDir);
418 418
             $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths));
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
         }, self::EARLY_EVENT);
431 431
 
432 432
         // twigのグローバル変数を定義.
433
-        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) {
433
+        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) {
434 434
             // 未ログイン時にマイページや管理画面以下にアクセスするとSubRequestで実行されるため,
435 435
             // $event->isMasterRequest()ではなく、グローバル変数が初期化済かどうかの判定を行う
436 436
             if (isset($this['twig_global_initialized']) && $this['twig_global_initialized'] === true) {
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
         // メール送信時の文字エンコード指定(デフォルトはUTF-8)
498 498
         if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) {
499 499
             if ($this['config']['mail']['charset_iso_2022_jp'] === true) {
500
-                \Swift::init(function () {
500
+                \Swift::init(function() {
501 501
                     \Swift_DependencyContainer::getInstance()
502 502
                         ->register('mime.qpheaderencoder')
503 503
                         ->asAliasOf('mime.base64headerencoder');
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
             ),
626 626
         ));
627 627
 
628
-        $this->extend('orm.em', function (\Doctrine\ORM\EntityManager $em, \Silex\Application $app) {
628
+        $this->extend('orm.em', function(\Doctrine\ORM\EntityManager $em, \Silex\Application $app) {
629 629
             // tax_rule
630 630
             $taxRuleRepository = $em->getRepository('Eccube\Entity\TaxRule');
631 631
             $taxRuleRepository->setApplication($app);
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
             // second level cacheの設定.
659 659
             $this->extend(
660 660
                 'orm.em.config',
661
-                function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
661
+                function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) {
662 662
                     $config->setSecondLevelCacheEnabled();
663 663
                     $cacheConfig = $config->getSecondLevelCacheConfiguration();
664 664
                     $regionConfig = $cacheConfig->getRegionsConfiguration();
@@ -747,31 +747,31 @@  discard block
 block discarded – undo
747 747
             array('^/mypage', 'ROLE_USER', $channel),
748 748
         );
749 749
 
750
-        $this['eccube.password_encoder'] = function ($app) {
750
+        $this['eccube.password_encoder'] = function($app) {
751 751
             return new \Eccube\Security\Core\Encoder\PasswordEncoder($app['config']);
752 752
         };
753
-        $this['security.encoder_factory'] = function ($app) {
753
+        $this['security.encoder_factory'] = function($app) {
754 754
             return new \Symfony\Component\Security\Core\Encoder\EncoderFactory(array(
755 755
                 'Eccube\Entity\Customer' => $app['eccube.password_encoder'],
756 756
                 'Eccube\Entity\Member' => $app['eccube.password_encoder'],
757 757
             ));
758 758
         };
759
-        $this['eccube.event_listner.security'] = function ($app) {
759
+        $this['eccube.event_listner.security'] = function($app) {
760 760
             return new \Eccube\EventListener\SecurityEventListener($app['orm.em']);
761 761
         };
762 762
 
763 763
         // Voterの設定
764
-        $this['authority_voter'] = function ($app) {
764
+        $this['authority_voter'] = function($app) {
765 765
             return new \Eccube\Security\Voter\AuthorityVoter($app);
766 766
         };
767 767
 
768
-        $this->extend('security.voters', function ($voters, \Silex\Application $app) {
768
+        $this->extend('security.voters', function($voters, \Silex\Application $app) {
769 769
             $voters[] = $app['authority_voter'];
770 770
 
771 771
             return $voters;
772 772
         });
773 773
 
774
-        $this['security.access_manager'] = function ($app) {
774
+        $this['security.access_manager'] = function($app) {
775 775
             return new \Symfony\Component\Security\Core\Authorization\AccessDecisionManager($app['security.voters'], 'unanimous');
776 776
         };
777 777
 
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
     {
786 786
         $config = $this['config'];
787 787
         if (isset($config['trusted_proxies_connection_only']) && !empty($config['trusted_proxies_connection_only'])) {
788
-            $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($config) {
788
+            $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($config) {
789 789
                 // サブリクエストのREMOTE_ADDRも動的に設定を行う必要があるため、KernelEvents::REQUESTを使用する
790 790
                 Request::setTrustedProxies(array_merge(array($event->getRequest()->server->get('REMOTE_ADDR')), $config['trusted_proxies']));
791 791
             }, self::EARLY_EVENT);
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
         $app = $this;
946 946
 
947 947
         // Response Event(http cache対応、event実行は一番遅く設定)
948
-        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
948
+        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
949 949
 
950 950
             if (!$event->isMasterRequest()) {
951 951
                 return;
Please login to merge, or discard this patch.