| @@ -32,6 +32,9 @@ | ||
| 32 | 32 |  { | 
| 33 | 33 | protected $trait_proxies_directory; | 
| 34 | 34 | |
| 35 | + /** | |
| 36 | + * @param string $dir | |
| 37 | + */ | |
| 35 | 38 | public function setTraitProxiesDirectory($dir) | 
| 36 | 39 |      { | 
| 37 | 40 | $this->trait_proxies_directory = $dir; | 
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 | $includedFiles = []; | 
| 55 | 55 | |
| 56 | 56 |          foreach ($this->paths as $path) { | 
| 57 | -            if ( ! is_dir($path)) { | |
| 57 | +            if (!is_dir($path)) { | |
| 58 | 58 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); | 
| 59 | 59 | } | 
| 60 | 60 | |
| @@ -63,14 +63,14 @@ discard block | ||
| 63 | 63 | new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS), | 
| 64 | 64 | \RecursiveIteratorIterator::LEAVES_ONLY | 
| 65 | 65 | ), | 
| 66 | - '/^.+' . preg_quote($this->fileExtension) . '$/i', | |
| 66 | + '/^.+'.preg_quote($this->fileExtension).'$/i', | |
| 67 | 67 | \RecursiveRegexIterator::GET_MATCH | 
| 68 | 68 | ); | 
| 69 | 69 | |
| 70 | 70 |              foreach ($iterator as $file) { | 
| 71 | 71 | $sourceFile = $file[0]; | 
| 72 | 72 | |
| 73 | -                if ( ! preg_match('(^phar:)i', $sourceFile)) { | |
| 73 | +                if (!preg_match('(^phar:)i', $sourceFile)) { | |
| 74 | 74 | $sourceFile = realpath($sourceFile); | 
| 75 | 75 | } | 
| 76 | 76 | |
| @@ -101,7 +101,7 @@ discard block | ||
| 101 | 101 |          foreach ($declared as $className) { | 
| 102 | 102 | $rc = new \ReflectionClass($className); | 
| 103 | 103 | $sourceFile = $rc->getFileName(); | 
| 104 | -            if (in_array($sourceFile, $includedFiles) && ! $this->isTransient($className)) { | |
| 104 | +            if (in_array($sourceFile, $includedFiles) && !$this->isTransient($className)) { | |
| 105 | 105 | $classes[] = $className; | 
| 106 | 106 | } | 
| 107 | 107 | } | 
| @@ -543,13 +543,13 @@ | ||
| 543 | 543 | $pluginConfigs = PluginConfigManager::getPluginConfigAll($this['debug']); | 
| 544 | 544 | $ormMappings = array(); | 
| 545 | 545 | $ormMappings[] = array( | 
| 546 | - 'type' => 'annotation', | |
| 547 | - 'namespace' => 'Eccube\Entity', | |
| 548 | - 'path' => array( | |
| 549 | - __DIR__.'/Entity' | |
| 550 | - ), | |
| 551 | - 'use_simple_annotation_reader' => false, | |
| 552 | - ); | |
| 546 | + 'type' => 'annotation', | |
| 547 | + 'namespace' => 'Eccube\Entity', | |
| 548 | + 'path' => array( | |
| 549 | + __DIR__.'/Entity' | |
| 550 | + ), | |
| 551 | + 'use_simple_annotation_reader' => false, | |
| 552 | + ); | |
| 553 | 553 | |
| 554 | 554 | // TODO namespace は暫定 | 
| 555 | 555 | $ormMappings[] = array( | 
| @@ -168,7 +168,7 @@ discard block | ||
| 168 | 168 | $this->register(new \Silex\Provider\ValidatorServiceProvider()); | 
| 169 | 169 | $this->register(new MobileDetectServiceProvider()); | 
| 170 | 170 | |
| 171 | -        $this->error(function (\Exception $e, Request $request, $code) { | |
| 171 | +        $this->error(function(\Exception $e, Request $request, $code) { | |
| 172 | 172 |              if ($this['debug']) { | 
| 173 | 173 | return; | 
| 174 | 174 | } | 
| @@ -262,14 +262,14 @@ discard block | ||
| 262 | 262 | return $router; | 
| 263 | 263 | }); | 
| 264 | 264 | |
| 265 | -        $this['eccube.router.origin'] = function ($app) { | |
| 265 | +        $this['eccube.router.origin'] = function($app) { | |
| 266 | 266 | $resource = __DIR__.'/Controller'; | 
| 267 | 267 | $cachePrefix = 'Origin'; | 
| 268 | 268 | |
| 269 | 269 | return $app['eccube.router']($resource, $cachePrefix); | 
| 270 | 270 | }; | 
| 271 | 271 | |
| 272 | -        $this['eccube.routers.plugin'] = function ($app) { | |
| 272 | +        $this['eccube.routers.plugin'] = function($app) { | |
| 273 | 273 | // TODO 有効なプラグインを対象とする必要がある. | 
| 274 | 274 | $dirs = Finder::create() | 
| 275 | 275 | ->in($app['config']['root_dir'].'/app/Plugin') | 
| @@ -286,7 +286,7 @@ discard block | ||
| 286 | 286 | return $routers; | 
| 287 | 287 | }; | 
| 288 | 288 | |
| 289 | -        $this['eccube.router.extend'] = function ($app) { | |
| 289 | +        $this['eccube.router.extend'] = function($app) { | |
| 290 | 290 | // TODO ディレクトリ名は暫定 | 
| 291 | 291 | $resource = $app['config']['root_dir'].'/app/Acme/Controller'; | 
| 292 | 292 | $cachePrefix = 'Extend'; | 
| @@ -296,7 +296,7 @@ discard block | ||
| 296 | 296 | return $router; | 
| 297 | 297 | }; | 
| 298 | 298 | |
| 299 | -        $this->extend('request_matcher', function ($matcher, $app) { | |
| 299 | +        $this->extend('request_matcher', function($matcher, $app) { | |
| 300 | 300 | $matchers = []; | 
| 301 | 301 | $matchers[] = $app['eccube.router.extend']; | 
| 302 | 302 |              foreach ($app['eccube.routers.plugin'] as $router) { | 
| @@ -308,7 +308,7 @@ discard block | ||
| 308 | 308 | return new ChainUrlMatcher($matchers, $app['request_context']); | 
| 309 | 309 | }); | 
| 310 | 310 | |
| 311 | -        $this->extend('url_generator', function ($generator, $app) { | |
| 311 | +        $this->extend('url_generator', function($generator, $app) { | |
| 312 | 312 | $generators = []; | 
| 313 | 313 | $generators[] = $app['eccube.router.extend']; | 
| 314 | 314 |              foreach ($app['eccube.routers.plugin'] as $router) { | 
| @@ -339,7 +339,7 @@ discard block | ||
| 339 | 339 | 'translator.cache_dir' => $this['debug'] ? null : $this['config']['root_dir'].'/app/cache/translator', | 
| 340 | 340 | 'locale_fallbacks' => ['ja', 'en'], | 
| 341 | 341 | )); | 
| 342 | -        $this->extend('translator', function ($translator, \Silex\Application $app) { | |
| 342 | +        $this->extend('translator', function($translator, \Silex\Application $app) { | |
| 343 | 343 |              $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader()); | 
| 344 | 344 | |
| 345 | 345 | $file = __DIR__.'/Resource/locale/validator.'.$app['locale'].'.yml'; | 
| @@ -386,14 +386,14 @@ discard block | ||
| 386 | 386 | $this->register(new \Silex\Provider\TwigServiceProvider(), array( | 
| 387 | 387 |              'twig.form.templates' => array('Form/form_layout.twig'), | 
| 388 | 388 | )); | 
| 389 | -        $this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) { | |
| 389 | +        $this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) { | |
| 390 | 390 | $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app)); | 
| 391 | 391 | $twig->addExtension(new \Twig_Extension_StringLoader()); | 
| 392 | 392 | |
| 393 | 393 | return $twig; | 
| 394 | 394 | }); | 
| 395 | 395 | |
| 396 | -        $this->before(function (Request $request, \Silex\Application $app) { | |
| 396 | +        $this->before(function(Request $request, \Silex\Application $app) { | |
| 397 | 397 | $app['admin'] = $app['front'] = false; | 
| 398 | 398 | $pathinfo = rawurldecode($request->getPathInfo()); | 
| 399 | 399 |              if (strpos($pathinfo, '/'.trim($app['config']['admin_route'], '/').'/') === 0) { | 
| @@ -409,14 +409,14 @@ discard block | ||
| 409 | 409 | } | 
| 410 | 410 | $paths[] = $app['config']['template_admin_realdir']; | 
| 411 | 411 | $paths[] = __DIR__.'/../../app/Plugin'; | 
| 412 | - $cacheDir = __DIR__.'/../../app/cache/twig/admin'; | |
| 412 | + $cacheDir = __DIR__.'/../../app/cache/twig/admin'; | |
| 413 | 413 |              } else { | 
| 414 | 414 |                  if (file_exists($app['config']['template_realdir'])) { | 
| 415 | 415 | $paths[] = $app['config']['template_realdir']; | 
| 416 | 416 | } | 
| 417 | 417 | $paths[] = $app['config']['template_default_realdir']; | 
| 418 | 418 | $paths[] = __DIR__.'/../../app/Plugin'; | 
| 419 | - $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; | |
| 419 | + $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; | |
| 420 | 420 | } | 
| 421 | 421 | $app['twig']->setCache($app['debug'] ? null : $cacheDir); | 
| 422 | 422 | $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths)); | 
| @@ -434,7 +434,7 @@ discard block | ||
| 434 | 434 | }, self::EARLY_EVENT); | 
| 435 | 435 | |
| 436 | 436 | // twigのグローバル変数を定義. | 
| 437 | -        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { | |
| 437 | +        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { | |
| 438 | 438 | // 未ログイン時にマイページや管理画面以下にアクセスするとSubRequestで実行されるため, | 
| 439 | 439 | // $event->isMasterRequest()ではなく、グローバル変数が初期化済かどうかの判定を行う | 
| 440 | 440 |              if (isset($this['twig_global_initialized']) && $this['twig_global_initialized'] === true) { | 
| @@ -501,7 +501,7 @@ discard block | ||
| 501 | 501 | // メール送信時の文字エンコード指定(デフォルトはUTF-8) | 
| 502 | 502 |          if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) { | 
| 503 | 503 |              if ($this['config']['mail']['charset_iso_2022_jp'] === true) { | 
| 504 | -                \Swift::init(function () { | |
| 504 | +                \Swift::init(function() { | |
| 505 | 505 | \Swift_DependencyContainer::getInstance() | 
| 506 | 506 |                          ->register('mime.qpheaderencoder') | 
| 507 | 507 |                          ->asAliasOf('mime.base64headerencoder'); | 
| @@ -620,7 +620,7 @@ discard block | ||
| 620 | 620 | |
| 621 | 621 | $this->extend( | 
| 622 | 622 | 'orm.em.config', | 
| 623 | -            function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) { | |
| 623 | +            function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) { | |
| 624 | 624 | |
| 625 | 625 | /** @var $chain \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain */ | 
| 626 | 626 | $chain = $config->getMetadataDriverImpl(); | 
| @@ -642,7 +642,7 @@ discard block | ||
| 642 | 642 | } | 
| 643 | 643 | ); | 
| 644 | 644 | |
| 645 | -        $this->extend('orm.em', function (\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { | |
| 645 | +        $this->extend('orm.em', function(\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { | |
| 646 | 646 | // tax_rule | 
| 647 | 647 |              $taxRuleRepository = $em->getRepository('Eccube\Entity\TaxRule'); | 
| 648 | 648 | $taxRuleRepository->setApplication($app); | 
| @@ -675,7 +675,7 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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; | 
| @@ -31,8 +31,6 @@ discard block | ||
| 31 | 31 | use Eccube\Common\Constant; | 
| 32 | 32 | use Eccube\Doctrine\DBAL\Types\UTCDateTimeType; | 
| 33 | 33 | use Eccube\Doctrine\ORM\Mapping\Driver\AnnotationDriver; | 
| 34 | -use Eccube\Doctrine\ORM\Mapping\Driver\YamlDriver; | |
| 35 | -use Eccube\EventListener\TransactionListener; | |
| 36 | 34 | use Eccube\Plugin\ConfigManager as PluginConfigManager; | 
| 37 | 35 | use Eccube\Routing\EccubeRouter; | 
| 38 | 36 | use Eccube\ServiceProvider\EntityEventServiceProvider; | 
| @@ -44,13 +42,11 @@ discard block | ||
| 44 | 42 | use Sergiors\Silex\Provider\TemplatingServiceProvider; | 
| 45 | 43 | use Sergiors\Silex\Routing\ChainUrlGenerator; | 
| 46 | 44 | use Sergiors\Silex\Routing\ChainUrlMatcher; | 
| 47 | -use Symfony\Component\EventDispatcher\EventDispatcher; | |
| 48 | 45 | use Symfony\Component\Finder\Finder; | 
| 49 | 46 | use Symfony\Component\HttpFoundation\Request; | 
| 50 | 47 | use Symfony\Component\HttpFoundation\Response; | 
| 51 | 48 | use Symfony\Component\HttpKernel\Event\FilterResponseEvent; | 
| 52 | 49 | use Symfony\Component\HttpKernel\Event\GetResponseEvent; | 
| 53 | -use Symfony\Component\HttpKernel\Event\PostResponseEvent; | |
| 54 | 50 | use Symfony\Component\HttpKernel\KernelEvents; | 
| 55 | 51 | use Symfony\Component\Yaml\Yaml; | 
| 56 | 52 | |