@@ -23,7 +23,7 @@ |
||
| 23 | 23 | ); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - $app[TwigLintValidator::class] = function (Container $app) { |
|
| 26 | + $app[TwigLintValidator::class] = function(Container $app) { |
|
| 27 | 27 | return new TwigLintValidator($app['twig']); |
| 28 | 28 | }; |
| 29 | 29 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $this->register(new MobileDetectServiceProvider()); |
| 174 | 174 | $this->register(new TwigLintServiceProvider()); |
| 175 | 175 | |
| 176 | - $this->error(function (\Exception $e, Request $request, $code) { |
|
| 176 | + $this->error(function(\Exception $e, Request $request, $code) { |
|
| 177 | 177 | if ($this['debug']) { |
| 178 | 178 | return; |
| 179 | 179 | } |
@@ -279,14 +279,14 @@ discard block |
||
| 279 | 279 | return $router; |
| 280 | 280 | }); |
| 281 | 281 | |
| 282 | - $this['eccube.router.origin'] = function ($app) { |
|
| 282 | + $this['eccube.router.origin'] = function($app) { |
|
| 283 | 283 | $resource = __DIR__.'/Controller'; |
| 284 | 284 | $cachePrefix = 'Origin'; |
| 285 | 285 | |
| 286 | 286 | return $app['eccube.router']($resource, $cachePrefix); |
| 287 | 287 | }; |
| 288 | 288 | |
| 289 | - $this['eccube.routers.plugin'] = function ($app) { |
|
| 289 | + $this['eccube.routers.plugin'] = function($app) { |
|
| 290 | 290 | // TODO 有効なプラグインを対象とする必要がある. |
| 291 | 291 | $dirs = Finder::create() |
| 292 | 292 | ->in($app['config']['root_dir'].'/app/Plugin') |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | return $routers; |
| 304 | 304 | }; |
| 305 | 305 | |
| 306 | - $this['eccube.router.extend'] = function ($app) { |
|
| 306 | + $this['eccube.router.extend'] = function($app) { |
|
| 307 | 307 | // TODO ディレクトリ名は暫定 |
| 308 | 308 | $resource = $app['config']['root_dir'].'/app/Acme/Controller'; |
| 309 | 309 | $cachePrefix = 'Extend'; |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | return $router; |
| 314 | 314 | }; |
| 315 | 315 | |
| 316 | - $this->extend('request_matcher', function ($matcher, $app) { |
|
| 316 | + $this->extend('request_matcher', function($matcher, $app) { |
|
| 317 | 317 | $matchers = []; |
| 318 | 318 | $matchers[] = $app['eccube.router.extend']; |
| 319 | 319 | foreach ($app['eccube.routers.plugin'] as $router) { |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | return new ChainUrlMatcher($matchers, $app['request_context']); |
| 326 | 326 | }); |
| 327 | 327 | |
| 328 | - $this->extend('url_generator', function ($generator, $app) { |
|
| 328 | + $this->extend('url_generator', function($generator, $app) { |
|
| 329 | 329 | $generators = []; |
| 330 | 330 | $generators[] = $app['eccube.router.extend']; |
| 331 | 331 | foreach ($app['eccube.routers.plugin'] as $router) { |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | }); |
| 339 | 339 | |
| 340 | 340 | // Route CollectionにEC-CUBEで定義したルーティングを追加(debug tool barに出力するため) |
| 341 | - $this->extend('routes', function ($routes, $app) { |
|
| 341 | + $this->extend('routes', function($routes, $app) { |
|
| 342 | 342 | $routes->addCollection($app['eccube.router.extend']->getRouteCollection()); |
| 343 | 343 | foreach ($app['eccube.routers.plugin'] as $router) { |
| 344 | 344 | $routes->addCollection($router->getRouteCollection()); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | 'translator.cache_dir' => $this['debug'] ? null : $this['config']['root_dir'].'/app/cache/translator', |
| 372 | 372 | 'locale_fallbacks' => ['ja', 'en'], |
| 373 | 373 | )); |
| 374 | - $this->extend('translator', function ($translator, \Silex\Application $app) { |
|
| 374 | + $this->extend('translator', function($translator, \Silex\Application $app) { |
|
| 375 | 375 | $translator->addLoader('php', new \Symfony\Component\Translation\Loader\PhpFileLoader()); |
| 376 | 376 | |
| 377 | 377 | $file = __DIR__.'/Resource/locale/messages.'.$app['locale'].'.php'; |
@@ -414,14 +414,14 @@ discard block |
||
| 414 | 414 | $this->register(new \Silex\Provider\TwigServiceProvider(), array( |
| 415 | 415 | 'twig.form.templates' => array('Form/form_layout.twig'), |
| 416 | 416 | )); |
| 417 | - $this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) { |
|
| 417 | + $this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) { |
|
| 418 | 418 | $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app)); |
| 419 | 419 | $twig->addExtension(new \Twig_Extension_StringLoader()); |
| 420 | 420 | |
| 421 | 421 | return $twig; |
| 422 | 422 | }); |
| 423 | 423 | |
| 424 | - $this->before(function (Request $request, \Silex\Application $app) { |
|
| 424 | + $this->before(function(Request $request, \Silex\Application $app) { |
|
| 425 | 425 | $app['admin'] = $app['front'] = false; |
| 426 | 426 | $pathinfo = rawurldecode($request->getPathInfo()); |
| 427 | 427 | if (strpos($pathinfo, '/'.trim($app['config']['admin_route'], '/').'/') === 0) { |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | $paths[] = $app['config']['template_admin_realdir']; |
| 439 | 439 | $paths[] = __DIR__.'/../../app/Plugin'; |
| 440 | - $cacheDir = __DIR__.'/../../app/cache/twig/admin'; |
|
| 440 | + $cacheDir = __DIR__.'/../../app/cache/twig/admin'; |
|
| 441 | 441 | } else { |
| 442 | 442 | // モバイル端末時、smartphoneディレクトリを探索パスに追加する. |
| 443 | 443 | if ($app['mobile_detect.device_type'] == \Eccube\Entity\Master\DeviceType::DEVICE_TYPE_SP) { |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | $paths[] = $app['config']['template_default_realdir']; |
| 454 | 454 | $paths[] = __DIR__.'/../../app/Plugin'; |
| 455 | - $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; |
|
| 455 | + $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; |
|
| 456 | 456 | } |
| 457 | 457 | $app['twig']->setCache($app['debug'] ? null : $cacheDir); |
| 458 | 458 | $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths)); |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | }, self::EARLY_EVENT); |
| 471 | 471 | |
| 472 | 472 | // twigのグローバル変数を定義. |
| 473 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { |
|
| 473 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { |
|
| 474 | 474 | // 未ログイン時にマイページや管理画面以下にアクセスするとSubRequestで実行されるため, |
| 475 | 475 | // $event->isMasterRequest()ではなく、グローバル変数が初期化済かどうかの判定を行う |
| 476 | 476 | if (isset($this['twig_global_initialized']) && $this['twig_global_initialized'] === true) { |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | // メール送信時の文字エンコード指定(デフォルトはUTF-8) |
| 556 | 556 | if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) { |
| 557 | 557 | if ($this['config']['mail']['charset_iso_2022_jp'] === true) { |
| 558 | - \Swift::init(function () { |
|
| 558 | + \Swift::init(function() { |
|
| 559 | 559 | \Swift_DependencyContainer::getInstance() |
| 560 | 560 | ->register('mime.qpheaderencoder') |
| 561 | 561 | ->asAliasOf('mime.base64headerencoder'); |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | $this->register(new \Saxulum\DoctrineOrmManagerRegistry\Provider\DoctrineOrmManagerRegistryProvider()); |
| 591 | 591 | |
| 592 | 592 | $app = $this; |
| 593 | - $this->extend('db.event_manager', function ($evm) use ($app) { |
|
| 593 | + $this->extend('db.event_manager', function($evm) use ($app) { |
|
| 594 | 594 | $initSubscriber = new InitSubscriber($app); |
| 595 | 595 | $evm->addEventSubscriber($initSubscriber); |
| 596 | 596 | |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | |
| 686 | 686 | $this->extend( |
| 687 | 687 | 'orm.em.config', |
| 688 | - function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 688 | + function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 689 | 689 | |
| 690 | 690 | /** @var $chain \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain */ |
| 691 | 691 | $chain = $config->getMetadataDriverImpl(); |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | } |
| 708 | 708 | ); |
| 709 | 709 | |
| 710 | - $this->extend('orm.em', function (\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { |
|
| 710 | + $this->extend('orm.em', function(\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { |
|
| 711 | 711 | // save |
| 712 | 712 | $saveEventSubscriber = new \Eccube\Doctrine\EventSubscriber\SaveEventSubscriber($app); |
| 713 | 713 | $em->getEventManager()->addEventSubscriber($saveEventSubscriber); |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | // second level cacheの設定. |
| 731 | 731 | $this->extend( |
| 732 | 732 | 'orm.em.config', |
| 733 | - function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 733 | + function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 734 | 734 | $config->setSecondLevelCacheEnabled(); |
| 735 | 735 | $cacheConfig = $config->getSecondLevelCacheConfiguration(); |
| 736 | 736 | $regionConfig = $cacheConfig->getRegionsConfiguration(); |
@@ -819,31 +819,31 @@ discard block |
||
| 819 | 819 | array('^/mypage', 'ROLE_USER', $channel), |
| 820 | 820 | ); |
| 821 | 821 | |
| 822 | - $this['eccube.password_encoder'] = function ($app) { |
|
| 822 | + $this['eccube.password_encoder'] = function($app) { |
|
| 823 | 823 | return new \Eccube\Security\Core\Encoder\PasswordEncoder($app['config']); |
| 824 | 824 | }; |
| 825 | - $this['security.encoder_factory'] = function ($app) { |
|
| 825 | + $this['security.encoder_factory'] = function($app) { |
|
| 826 | 826 | return new \Symfony\Component\Security\Core\Encoder\EncoderFactory(array( |
| 827 | 827 | 'Eccube\Entity\Customer' => $app['eccube.password_encoder'], |
| 828 | 828 | 'Eccube\Entity\Member' => $app['eccube.password_encoder'], |
| 829 | 829 | )); |
| 830 | 830 | }; |
| 831 | - $this['eccube.event_listner.security'] = function ($app) { |
|
| 831 | + $this['eccube.event_listner.security'] = function($app) { |
|
| 832 | 832 | return new \Eccube\EventListener\SecurityEventListener($app['orm.em']); |
| 833 | 833 | }; |
| 834 | 834 | |
| 835 | 835 | // Voterの設定 |
| 836 | - $this['authority_voter'] = function ($app) { |
|
| 836 | + $this['authority_voter'] = function($app) { |
|
| 837 | 837 | return new \Eccube\Security\Voter\AuthorityVoter($app); |
| 838 | 838 | }; |
| 839 | 839 | |
| 840 | - $this->extend('security.voters', function ($voters, \Silex\Application $app) { |
|
| 840 | + $this->extend('security.voters', function($voters, \Silex\Application $app) { |
|
| 841 | 841 | $voters[] = $app['authority_voter']; |
| 842 | 842 | |
| 843 | 843 | return $voters; |
| 844 | 844 | }); |
| 845 | 845 | |
| 846 | - $this['security.access_manager'] = function ($app) { |
|
| 846 | + $this['security.access_manager'] = function($app) { |
|
| 847 | 847 | return new \Symfony\Component\Security\Core\Authorization\AccessDecisionManager($app['security.voters'], 'unanimous'); |
| 848 | 848 | }; |
| 849 | 849 | |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | { |
| 858 | 858 | $config = $this['config']; |
| 859 | 859 | if (isset($config['trusted_proxies_connection_only']) && !empty($config['trusted_proxies_connection_only'])) { |
| 860 | - $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($config) { |
|
| 860 | + $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($config) { |
|
| 861 | 861 | // サブリクエストのREMOTE_ADDRも動的に設定を行う必要があるため、KernelEvents::REQUESTを使用する |
| 862 | 862 | Request::setTrustedProxies(array_merge(array($event->getRequest()->server->get('REMOTE_ADDR')), $config['trusted_proxies'])); |
| 863 | 863 | }, self::EARLY_EVENT); |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | $this->register(new ServiceProvider\EccubePluginServiceProvider()); |
| 875 | 875 | |
| 876 | 876 | // TODO Acme\ServiceProvider の初期化はここで OK? |
| 877 | - if (array_key_exists('service',$this['config'])) { |
|
| 877 | + if (array_key_exists('service', $this['config'])) { |
|
| 878 | 878 | foreach ($this['config']['service'] as $service) { |
| 879 | 879 | $this->register(new $service); |
| 880 | 880 | } |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | $app = $this; |
| 1031 | 1031 | |
| 1032 | 1032 | // Response Event(http cache対応、event実行は一番遅く設定) |
| 1033 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 1033 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 1034 | 1034 | |
| 1035 | 1035 | if (!$event->isMasterRequest()) { |
| 1036 | 1036 | return; |