@@ -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 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $this->register(new MobileDetectServiceProvider()); |
| 173 | 173 | $this->register(new TwigLintServiceProvider()); |
| 174 | 174 | |
| 175 | - $this->error(function (\Exception $e, Request $request, $code) { |
|
| 175 | + $this->error(function(\Exception $e, Request $request, $code) { |
|
| 176 | 176 | if ($this['debug']) { |
| 177 | 177 | return; |
| 178 | 178 | } |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | return $router; |
| 279 | 279 | }); |
| 280 | 280 | |
| 281 | - $this['eccube.router.origin'] = function ($app) { |
|
| 281 | + $this['eccube.router.origin'] = function($app) { |
|
| 282 | 282 | $resource = __DIR__.'/Controller'; |
| 283 | 283 | $cachePrefix = 'Origin'; |
| 284 | 284 | |
| 285 | 285 | return $app['eccube.router']($resource, $cachePrefix); |
| 286 | 286 | }; |
| 287 | 287 | |
| 288 | - $this['eccube.routers.plugin'] = function ($app) { |
|
| 288 | + $this['eccube.routers.plugin'] = function($app) { |
|
| 289 | 289 | // TODO 有効なプラグインを対象とする必要がある. |
| 290 | 290 | $dirs = Finder::create() |
| 291 | 291 | ->in($app['config']['root_dir'].'/app/Plugin') |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | return $routers; |
| 303 | 303 | }; |
| 304 | 304 | |
| 305 | - $this['eccube.router.extend'] = function ($app) { |
|
| 305 | + $this['eccube.router.extend'] = function($app) { |
|
| 306 | 306 | // TODO ディレクトリ名は暫定 |
| 307 | 307 | $resource = $app['config']['root_dir'].'/app/Acme/Controller'; |
| 308 | 308 | $cachePrefix = 'Extend'; |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | return $router; |
| 313 | 313 | }; |
| 314 | 314 | |
| 315 | - $this->extend('request_matcher', function ($matcher, $app) { |
|
| 315 | + $this->extend('request_matcher', function($matcher, $app) { |
|
| 316 | 316 | $matchers = []; |
| 317 | 317 | $matchers[] = $app['eccube.router.extend']; |
| 318 | 318 | foreach ($app['eccube.routers.plugin'] as $router) { |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | return new ChainUrlMatcher($matchers, $app['request_context']); |
| 325 | 325 | }); |
| 326 | 326 | |
| 327 | - $this->extend('url_generator', function ($generator, $app) { |
|
| 327 | + $this->extend('url_generator', function($generator, $app) { |
|
| 328 | 328 | $generators = []; |
| 329 | 329 | $generators[] = $app['eccube.router.extend']; |
| 330 | 330 | foreach ($app['eccube.routers.plugin'] as $router) { |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | }); |
| 338 | 338 | |
| 339 | 339 | // Route CollectionにEC-CUBEで定義したルーティングを追加(debug tool barに出力するため) |
| 340 | - $this->extend('routes', function ($routes, $app) { |
|
| 340 | + $this->extend('routes', function($routes, $app) { |
|
| 341 | 341 | $routes->addCollection($app['eccube.router.extend']->getRouteCollection()); |
| 342 | 342 | foreach ($app['eccube.routers.plugin'] as $router) { |
| 343 | 343 | $routes->addCollection($router->getRouteCollection()); |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | 'translator.cache_dir' => $this['debug'] ? null : $this['config']['root_dir'].'/app/cache/translator', |
| 371 | 371 | 'locale_fallbacks' => ['ja', 'en'], |
| 372 | 372 | )); |
| 373 | - $this->extend('translator', function ($translator, \Silex\Application $app) { |
|
| 373 | + $this->extend('translator', function($translator, \Silex\Application $app) { |
|
| 374 | 374 | $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader()); |
| 375 | 375 | |
| 376 | 376 | $file = __DIR__.'/Resource/locale/validator.'.$app['locale'].'.yml'; |
@@ -417,14 +417,14 @@ discard block |
||
| 417 | 417 | $this->register(new \Silex\Provider\TwigServiceProvider(), array( |
| 418 | 418 | 'twig.form.templates' => array('Form/form_layout.twig'), |
| 419 | 419 | )); |
| 420 | - $this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) { |
|
| 420 | + $this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) { |
|
| 421 | 421 | $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app)); |
| 422 | 422 | $twig->addExtension(new \Twig_Extension_StringLoader()); |
| 423 | 423 | |
| 424 | 424 | return $twig; |
| 425 | 425 | }); |
| 426 | 426 | |
| 427 | - $this->before(function (Request $request, \Silex\Application $app) { |
|
| 427 | + $this->before(function(Request $request, \Silex\Application $app) { |
|
| 428 | 428 | $app['admin'] = $app['front'] = false; |
| 429 | 429 | $pathinfo = rawurldecode($request->getPathInfo()); |
| 430 | 430 | if (strpos($pathinfo, '/'.trim($app['config']['admin_route'], '/').'/') === 0) { |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | $paths[] = $app['config']['template_admin_realdir']; |
| 442 | 442 | $paths[] = __DIR__.'/../../app/Plugin'; |
| 443 | - $cacheDir = __DIR__.'/../../app/cache/twig/admin'; |
|
| 443 | + $cacheDir = __DIR__.'/../../app/cache/twig/admin'; |
|
| 444 | 444 | } else { |
| 445 | 445 | // モバイル端末時、smartphoneディレクトリを探索パスに追加する. |
| 446 | 446 | if ($app['mobile_detect.device_type'] == \Eccube\Entity\Master\DeviceType::DEVICE_TYPE_SP) { |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | } |
| 456 | 456 | $paths[] = $app['config']['template_default_realdir']; |
| 457 | 457 | $paths[] = __DIR__.'/../../app/Plugin'; |
| 458 | - $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; |
|
| 458 | + $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; |
|
| 459 | 459 | } |
| 460 | 460 | $app['twig']->setCache($app['debug'] ? null : $cacheDir); |
| 461 | 461 | $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths)); |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | }, self::EARLY_EVENT); |
| 474 | 474 | |
| 475 | 475 | // twigのグローバル変数を定義. |
| 476 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { |
|
| 476 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { |
|
| 477 | 477 | // 未ログイン時にマイページや管理画面以下にアクセスするとSubRequestで実行されるため, |
| 478 | 478 | // $event->isMasterRequest()ではなく、グローバル変数が初期化済かどうかの判定を行う |
| 479 | 479 | if (isset($this['twig_global_initialized']) && $this['twig_global_initialized'] === true) { |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | // メール送信時の文字エンコード指定(デフォルトはUTF-8) |
| 560 | 560 | if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) { |
| 561 | 561 | if ($this['config']['mail']['charset_iso_2022_jp'] === true) { |
| 562 | - \Swift::init(function () { |
|
| 562 | + \Swift::init(function() { |
|
| 563 | 563 | \Swift_DependencyContainer::getInstance() |
| 564 | 564 | ->register('mime.qpheaderencoder') |
| 565 | 565 | ->asAliasOf('mime.base64headerencoder'); |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $this->register(new \Saxulum\DoctrineOrmManagerRegistry\Provider\DoctrineOrmManagerRegistryProvider()); |
| 595 | 595 | |
| 596 | 596 | $app = $this; |
| 597 | - $this->extend('db.event_manager', function ($evm) use ($app) { |
|
| 597 | + $this->extend('db.event_manager', function($evm) use ($app) { |
|
| 598 | 598 | $initSubscriber = new InitSubscriber($app); |
| 599 | 599 | $evm->addEventSubscriber($initSubscriber); |
| 600 | 600 | |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | $this->extend( |
| 691 | 691 | 'orm.em.config', |
| 692 | - function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 692 | + function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 693 | 693 | |
| 694 | 694 | /** @var $chain \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain */ |
| 695 | 695 | $chain = $config->getMetadataDriverImpl(); |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | } |
| 712 | 712 | ); |
| 713 | 713 | |
| 714 | - $this->extend('orm.em', function (\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { |
|
| 714 | + $this->extend('orm.em', function(\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { |
|
| 715 | 715 | // save |
| 716 | 716 | $saveEventSubscriber = new \Eccube\Doctrine\EventSubscriber\SaveEventSubscriber($app); |
| 717 | 717 | $em->getEventManager()->addEventSubscriber($saveEventSubscriber); |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | // second level cacheの設定. |
| 735 | 735 | $this->extend( |
| 736 | 736 | 'orm.em.config', |
| 737 | - function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 737 | + function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
| 738 | 738 | $config->setSecondLevelCacheEnabled(); |
| 739 | 739 | $cacheConfig = $config->getSecondLevelCacheConfiguration(); |
| 740 | 740 | $regionConfig = $cacheConfig->getRegionsConfiguration(); |
@@ -823,31 +823,31 @@ discard block |
||
| 823 | 823 | array('^/mypage', 'ROLE_USER', $channel), |
| 824 | 824 | ); |
| 825 | 825 | |
| 826 | - $this['eccube.password_encoder'] = function ($app) { |
|
| 826 | + $this['eccube.password_encoder'] = function($app) { |
|
| 827 | 827 | return new \Eccube\Security\Core\Encoder\PasswordEncoder($app['config']); |
| 828 | 828 | }; |
| 829 | - $this['security.encoder_factory'] = function ($app) { |
|
| 829 | + $this['security.encoder_factory'] = function($app) { |
|
| 830 | 830 | return new \Symfony\Component\Security\Core\Encoder\EncoderFactory(array( |
| 831 | 831 | 'Eccube\Entity\Customer' => $app['eccube.password_encoder'], |
| 832 | 832 | 'Eccube\Entity\Member' => $app['eccube.password_encoder'], |
| 833 | 833 | )); |
| 834 | 834 | }; |
| 835 | - $this['eccube.event_listner.security'] = function ($app) { |
|
| 835 | + $this['eccube.event_listner.security'] = function($app) { |
|
| 836 | 836 | return new \Eccube\EventListener\SecurityEventListener($app['orm.em']); |
| 837 | 837 | }; |
| 838 | 838 | |
| 839 | 839 | // Voterの設定 |
| 840 | - $this['authority_voter'] = function ($app) { |
|
| 840 | + $this['authority_voter'] = function($app) { |
|
| 841 | 841 | return new \Eccube\Security\Voter\AuthorityVoter($app); |
| 842 | 842 | }; |
| 843 | 843 | |
| 844 | - $this->extend('security.voters', function ($voters, \Silex\Application $app) { |
|
| 844 | + $this->extend('security.voters', function($voters, \Silex\Application $app) { |
|
| 845 | 845 | $voters[] = $app['authority_voter']; |
| 846 | 846 | |
| 847 | 847 | return $voters; |
| 848 | 848 | }); |
| 849 | 849 | |
| 850 | - $this['security.access_manager'] = function ($app) { |
|
| 850 | + $this['security.access_manager'] = function($app) { |
|
| 851 | 851 | return new \Symfony\Component\Security\Core\Authorization\AccessDecisionManager($app['security.voters'], 'unanimous'); |
| 852 | 852 | }; |
| 853 | 853 | |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | { |
| 862 | 862 | $config = $this['config']; |
| 863 | 863 | if (isset($config['trusted_proxies_connection_only']) && !empty($config['trusted_proxies_connection_only'])) { |
| 864 | - $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($config) { |
|
| 864 | + $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($config) { |
|
| 865 | 865 | // サブリクエストのREMOTE_ADDRも動的に設定を行う必要があるため、KernelEvents::REQUESTを使用する |
| 866 | 866 | Request::setTrustedProxies(array_merge(array($event->getRequest()->server->get('REMOTE_ADDR')), $config['trusted_proxies'])); |
| 867 | 867 | }, self::EARLY_EVENT); |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | $this->register(new ServiceProvider\EccubePluginServiceProvider()); |
| 879 | 879 | |
| 880 | 880 | // TODO Acme\ServiceProvider の初期化はここで OK? |
| 881 | - if (array_key_exists('service',$this['config'])) { |
|
| 881 | + if (array_key_exists('service', $this['config'])) { |
|
| 882 | 882 | foreach ($this['config']['service'] as $service) { |
| 883 | 883 | $this->register(new $service); |
| 884 | 884 | } |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | $app = $this; |
| 1035 | 1035 | |
| 1036 | 1036 | // Response Event(http cache対応、event実行は一番遅く設定) |
| 1037 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 1037 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 1038 | 1038 | |
| 1039 | 1039 | if (!$event->isMasterRequest()) { |
| 1040 | 1040 | return; |