@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | { |
43 | 43 | $qb = $this->createQueryBuilder('e') |
44 | 44 | ->innerJoin('e.Plugin', 'p') |
45 | - ->Orderby('e.event','ASC') |
|
46 | - ->addOrderby('e.priority','DESC'); |
|
45 | + ->Orderby('e.event', 'ASC') |
|
46 | + ->addOrderby('e.priority', 'DESC'); |
|
47 | 47 | ; |
48 | 48 | |
49 | 49 | return $qb->getQuery()->getResult(); |
@@ -52,65 +52,65 @@ discard block |
||
52 | 52 | public function getPriorityRange($type) |
53 | 53 | { |
54 | 54 | |
55 | - if(PluginEventHandler::EVENT_HANDLER_TYPE_FIRST==$type){ |
|
56 | - $range_start=PluginEventHandler::EVENT_PRIORITY_FIRST_START; |
|
57 | - $range_end=PluginEventHandler::EVENT_PRIORITY_FIRST_END; |
|
58 | - }elseif(PluginEventHandler::EVENT_HANDLER_TYPE_LAST==$type){ |
|
59 | - $range_start=PluginEventHandler::EVENT_PRIORITY_LAST_START; |
|
60 | - $range_end=PluginEventHandler::EVENT_PRIORITY_LAST_END; |
|
61 | - }else{ |
|
62 | - $range_start=PluginEventHandler::EVENT_PRIORITY_NORMAL_START; |
|
63 | - $range_end=PluginEventHandler::EVENT_PRIORITY_NORMAL_END; |
|
55 | + if (PluginEventHandler::EVENT_HANDLER_TYPE_FIRST == $type) { |
|
56 | + $range_start = PluginEventHandler::EVENT_PRIORITY_FIRST_START; |
|
57 | + $range_end = PluginEventHandler::EVENT_PRIORITY_FIRST_END; |
|
58 | + }elseif (PluginEventHandler::EVENT_HANDLER_TYPE_LAST == $type) { |
|
59 | + $range_start = PluginEventHandler::EVENT_PRIORITY_LAST_START; |
|
60 | + $range_end = PluginEventHandler::EVENT_PRIORITY_LAST_END; |
|
61 | + } else { |
|
62 | + $range_start = PluginEventHandler::EVENT_PRIORITY_NORMAL_START; |
|
63 | + $range_end = PluginEventHandler::EVENT_PRIORITY_NORMAL_END; |
|
64 | 64 | } |
65 | - return array($range_start,$range_end); |
|
65 | + return array($range_start, $range_end); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
69 | - public function calcNewPriority($event , $type) |
|
69 | + public function calcNewPriority($event, $type) |
|
70 | 70 | { |
71 | 71 | |
72 | - list($range_start,$range_end) = $this->getPriorityRange($type); |
|
72 | + list($range_start, $range_end) = $this->getPriorityRange($type); |
|
73 | 73 | |
74 | 74 | $qb = $this->createQueryBuilder('e'); |
75 | 75 | $qb->andWhere("e.priority >= $range_end ") |
76 | 76 | ->andWhere("e.priority <= $range_start ") |
77 | 77 | ->andWhere('e.event = :event') |
78 | - ->setParameter('event',$event) |
|
78 | + ->setParameter('event', $event) |
|
79 | 79 | ->setMaxResults(1) |
80 | - ->orderBy('e.priority','ASC'); |
|
80 | + ->orderBy('e.priority', 'ASC'); |
|
81 | 81 | |
82 | - $result=$qb->getQuery()->getResult(); |
|
83 | - if(count($result)){ |
|
84 | - return $result[0]->getPriority() -1; |
|
85 | - }else{ |
|
82 | + $result = $qb->getQuery()->getResult(); |
|
83 | + if (count($result)) { |
|
84 | + return $result[0]->getPriority() - 1; |
|
85 | + } else { |
|
86 | 86 | return $range_start; |
87 | 87 | } |
88 | 88 | |
89 | 89 | } |
90 | 90 | |
91 | - public function upPriority($pluginEventHandler,$up=true) |
|
91 | + public function upPriority($pluginEventHandler, $up = true) |
|
92 | 92 | { |
93 | 93 | |
94 | - list($range_start,$range_end) = $this->getPriorityRange($pluginEventHandler->getHandlerType()); |
|
94 | + list($range_start, $range_end) = $this->getPriorityRange($pluginEventHandler->getHandlerType()); |
|
95 | 95 | |
96 | 96 | $qb = $this->createQueryBuilder('e'); |
97 | 97 | |
98 | 98 | $qb->andWhere("e.priority >= $range_end ") |
99 | 99 | ->andWhere("e.priority <= $range_start ") |
100 | - ->andWhere('e.priority '.($up ? '>' : '<' ).' :pri') |
|
100 | + ->andWhere('e.priority '.($up ? '>' : '<').' :pri') |
|
101 | 101 | ->andWhere('e.event = :event') |
102 | - ->setParameter('event',$pluginEventHandler->getEvent()) |
|
103 | - ->setParameter('pri', $pluginEventHandler->getPriority() ) |
|
102 | + ->setParameter('event', $pluginEventHandler->getEvent()) |
|
103 | + ->setParameter('pri', $pluginEventHandler->getPriority()) |
|
104 | 104 | ->setMaxResults(1) |
105 | - ->orderBy('e.priority', ($up ? 'ASC':'DESC' ) ); |
|
105 | + ->orderBy('e.priority', ($up ? 'ASC' : 'DESC')); |
|
106 | 106 | |
107 | - $result=$qb->getQuery()->getResult(); |
|
107 | + $result = $qb->getQuery()->getResult(); |
|
108 | 108 | |
109 | - if(count($result)){ |
|
110 | - $em =$this->getEntityManager(); |
|
109 | + if (count($result)) { |
|
110 | + $em = $this->getEntityManager(); |
|
111 | 111 | $em->getConnection()->beginTransaction(); |
112 | 112 | // 2個のentityのprioriryを入れ替える |
113 | - $tmp=$pluginEventHandler->getPriority(); |
|
113 | + $tmp = $pluginEventHandler->getPriority(); |
|
114 | 114 | $pluginEventHandler->setPriority($result[0]->getPriority()); |
115 | 115 | $result[0]->setPriority($tmp); |
116 | 116 | $em->persist($result[0]); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $em->flush(); |
119 | 119 | $em->getConnection()->commit(); |
120 | 120 | # 移動する |
121 | - }else{ |
|
121 | + } else { |
|
122 | 122 | # 移動しない |
123 | 123 | throw new PluginException("Can't swap"); |
124 | 124 | } |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function register(Container $app) |
65 | 65 | { |
66 | - $app[BaseInfo::class] = function () use ($app) { |
|
66 | + $app[BaseInfo::class] = function() use ($app) { |
|
67 | 67 | return $app[BaseInfoRepository::class]->get(); |
68 | 68 | }; |
69 | 69 | |
70 | - $app['eccube.calculate.context'] = function () use ($app) { |
|
70 | + $app['eccube.calculate.context'] = function() use ($app) { |
|
71 | 71 | return new \Eccube\Service\Calculator\CalculateContext(); |
72 | 72 | }; |
73 | 73 | |
74 | - $app['eccube.calculate.strategies'] = function () use ($app) { |
|
74 | + $app['eccube.calculate.strategies'] = function() use ($app) { |
|
75 | 75 | $Collection = new \Eccube\Service\Calculator\CalculateStrategyCollection(); |
76 | 76 | $Collection->setApplication($app); |
77 | 77 | //$Collection->setOrder($Order); |
@@ -84,47 +84,47 @@ discard block |
||
84 | 84 | $Collection->add($app['eccube.calculate.strategy.calculate_total']); |
85 | 85 | return $Collection; |
86 | 86 | }; |
87 | - $app['eccube.calculate.strategy.shipping'] = function () use ($app) { |
|
87 | + $app['eccube.calculate.strategy.shipping'] = function() use ($app) { |
|
88 | 88 | $Strategy = new \Eccube\Service\Calculator\Strategy\ShippingStrategy(); |
89 | 89 | $Strategy->setApplication($app); |
90 | 90 | return $Strategy; |
91 | 91 | }; |
92 | - $app['eccube.calculate.strategy.charge'] = function () use ($app) { |
|
92 | + $app['eccube.calculate.strategy.charge'] = function() use ($app) { |
|
93 | 93 | $Strategy = new \Eccube\Service\Calculator\Strategy\ChargeStrategy(); |
94 | 94 | $Strategy->setApplication($app); |
95 | 95 | return $Strategy; |
96 | 96 | }; |
97 | 97 | |
98 | - $app['eccube.calculate.strategy.tax'] = function () use ($app) { |
|
98 | + $app['eccube.calculate.strategy.tax'] = function() use ($app) { |
|
99 | 99 | $Strategy = new \Eccube\Service\Calculator\Strategy\TaxStrategy(); |
100 | 100 | $Strategy->setApplication($app); |
101 | 101 | return $Strategy; |
102 | 102 | }; |
103 | 103 | |
104 | - $app['eccube.calculate.strategy.calculate_delivery_fee'] = function () use ($app) { |
|
104 | + $app['eccube.calculate.strategy.calculate_delivery_fee'] = function() use ($app) { |
|
105 | 105 | $Strategy = new \Eccube\Service\Calculator\Strategy\CalculateDeliveryFeeStrategy(); |
106 | 106 | $Strategy->setApplication($app); |
107 | 107 | return $Strategy; |
108 | 108 | }; |
109 | - $app['eccube.calculate.strategy.calculate_charge'] = function () use ($app) { |
|
109 | + $app['eccube.calculate.strategy.calculate_charge'] = function() use ($app) { |
|
110 | 110 | $Strategy = new \Eccube\Service\Calculator\Strategy\CalculateChargeStrategy(); |
111 | 111 | $Strategy->setApplication($app); |
112 | 112 | return $Strategy; |
113 | 113 | }; |
114 | - $app['eccube.calculate.strategy.calculate_total'] = function () use ($app) { |
|
114 | + $app['eccube.calculate.strategy.calculate_total'] = function() use ($app) { |
|
115 | 115 | $Strategy = new \Eccube\Service\Calculator\Strategy\CalculateTotalStrategy(); |
116 | 116 | $Strategy->setApplication($app); |
117 | 117 | return $Strategy; |
118 | 118 | }; |
119 | 119 | |
120 | - $app['payment.method'] = $app->protect(function ($clazz, $form) use ($app) { |
|
120 | + $app['payment.method'] = $app->protect(function($clazz, $form) use ($app) { |
|
121 | 121 | $PaymentMethod = new $clazz; |
122 | 122 | $PaymentMethod->setApplication($app); |
123 | 123 | $PaymentMethod->setFormType($form); |
124 | 124 | return $PaymentMethod; |
125 | 125 | }); |
126 | 126 | |
127 | - $app['payment.method.request'] = $app->protect(function ($clazz, $form, $request) use ($app) { |
|
127 | + $app['payment.method.request'] = $app->protect(function($clazz, $form, $request) use ($app) { |
|
128 | 128 | $PaymentMethod = new $clazz; |
129 | 129 | $PaymentMethod->setApplication($app); |
130 | 130 | $PaymentMethod->setFormType($form); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return $PaymentMethod; |
133 | 133 | }); |
134 | 134 | |
135 | - $app['eccube.service.calculate'] = $app->protect(function ($Order, $Customer) use ($app) { |
|
135 | + $app['eccube.service.calculate'] = $app->protect(function($Order, $Customer) use ($app) { |
|
136 | 136 | $Service = new \Eccube\Service\CalculateService($Order, $Customer); |
137 | 137 | $Context = $app['eccube.calculate.context']; |
138 | 138 | $app['eccube.calculate.strategies']->setOrder($Order); |
@@ -143,24 +143,24 @@ discard block |
||
143 | 143 | return $Service; |
144 | 144 | }); |
145 | 145 | |
146 | - $app['eccube.service.payment'] = $app->protect(function ($clazz) use ($app) { |
|
146 | + $app['eccube.service.payment'] = $app->protect(function($clazz) use ($app) { |
|
147 | 147 | $Service = new $clazz($app['request_stack']); |
148 | 148 | |
149 | 149 | return $Service; |
150 | 150 | }); |
151 | 151 | |
152 | - $app['paginator'] = $app->protect(function () { |
|
152 | + $app['paginator'] = $app->protect(function() { |
|
153 | 153 | $paginator = new \Knp\Component\Pager\Paginator(); |
154 | 154 | $paginator->subscribe(new \Eccube\EventListener\PaginatorListener()); |
155 | 155 | |
156 | 156 | return $paginator; |
157 | 157 | }); |
158 | 158 | |
159 | - $app['request_scope'] = function () { |
|
159 | + $app['request_scope'] = function() { |
|
160 | 160 | return new ParameterBag(); |
161 | 161 | }; |
162 | 162 | // TODO 使用するか検討 |
163 | - $app['eccube.twig.node.hello'] = $app->protect(function ($node, $compiler) { |
|
163 | + $app['eccube.twig.node.hello'] = $app->protect(function($node, $compiler) { |
|
164 | 164 | $compiler |
165 | 165 | ->addDebugInfo($node) |
166 | 166 | ->write("echo 'Helloooooo ' . ") |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | }); |
172 | 172 | // TODO 使用するか検討 |
173 | - $app['eccube.twig.node.jiro'] = $app->protect(function ($node, $compiler) { |
|
173 | + $app['eccube.twig.node.jiro'] = $app->protect(function($node, $compiler) { |
|
174 | 174 | $compiler |
175 | 175 | ->addDebugInfo($node) |
176 | 176 | ->write("echo 'jirooooooo ' . ") |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | }); |
182 | 182 | |
183 | 183 | // TODO 使用するか検討 |
184 | - $app['eccube.twig.generic_node_names'] = function () use ($app) { |
|
184 | + $app['eccube.twig.generic_node_names'] = function() use ($app) { |
|
185 | 185 | return [ |
186 | 186 | 'hello', |
187 | 187 | 'jiro', |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | }; |
191 | 191 | |
192 | 192 | // TODO 使用するか検討 |
193 | - $app['twig_parsers'] = function () use ($app) { |
|
193 | + $app['twig_parsers'] = function() use ($app) { |
|
194 | 194 | $GenericTokenParsers = []; |
195 | 195 | foreach ($app['eccube.twig.generic_node_names'] as $tagName) { |
196 | 196 | $GenericTokenParsers[] = new \Eccube\Twig\Extension\GenericTokenParser($app, $tagName); |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | return $GenericTokenParsers; |
199 | 199 | }; |
200 | 200 | |
201 | - $app['eccube.twig.block.templates'] = function () { |
|
201 | + $app['eccube.twig.block.templates'] = function() { |
|
202 | 202 | $templates = new ArrayCollection(); |
203 | 203 | $templates[] = 'render_block.twig'; |
204 | 204 | |
205 | 205 | return $templates; |
206 | 206 | }; |
207 | 207 | |
208 | - $app['eccube.queries'] = function () { |
|
208 | + $app['eccube.queries'] = function() { |
|
209 | 209 | return new \Eccube\Doctrine\Query\Queries(); |
210 | 210 | }; |
211 | 211 | |
212 | - $app['eccube.purchase.context'] = $app->protect(function (ItemHolderInterface $origin = null) { |
|
212 | + $app['eccube.purchase.context'] = $app->protect(function(ItemHolderInterface $origin = null) { |
|
213 | 213 | return new PurchaseContext($origin); |
214 | 214 | }); |
215 | 215 | |
216 | - $app['eccube.purchase.flow.cart.item_processors'] = function ($app) { |
|
216 | + $app['eccube.purchase.flow.cart.item_processors'] = function($app) { |
|
217 | 217 | $processors = new ArrayCollection(); |
218 | 218 | $processors->add(new DisplayStatusValidator()); |
219 | 219 | $processors->add(new SaleLimitValidator()); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | return $processors; |
223 | 223 | }; |
224 | 224 | |
225 | - $app['eccube.purchase.flow.cart.holder_processors'] = function ($app) { |
|
225 | + $app['eccube.purchase.flow.cart.holder_processors'] = function($app) { |
|
226 | 226 | $processors = new ArrayCollection(); |
227 | 227 | $processors->add(new PaymentProcessor($app[DeliveryRepository::class])); |
228 | 228 | $processors->add(new PaymentTotalLimitValidator($app['config']['max_total_fee'])); |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | }; |
234 | 234 | |
235 | 235 | // example |
236 | - $app->extend('eccube.purchase.flow.cart.item_processors', function ($processors, $app) { |
|
236 | + $app->extend('eccube.purchase.flow.cart.item_processors', function($processors, $app) { |
|
237 | 237 | |
238 | 238 | $processors->add(new StockValidator()); |
239 | 239 | |
240 | 240 | return $processors; |
241 | 241 | }); |
242 | 242 | |
243 | - $app['eccube.purchase.flow.cart'] = function ($app) { |
|
243 | + $app['eccube.purchase.flow.cart'] = function($app) { |
|
244 | 244 | $flow = new PurchaseFlow(); |
245 | 245 | $flow->setItemProcessors($app['eccube.purchase.flow.cart.item_processors']); |
246 | 246 | $flow->setItemHolderProcessors($app['eccube.purchase.flow.cart.holder_processors']); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | return $flow; |
249 | 249 | }; |
250 | 250 | |
251 | - $app['eccube.purchase.flow.shopping'] = function () use ($app) { |
|
251 | + $app['eccube.purchase.flow.shopping'] = function() use ($app) { |
|
252 | 252 | $flow = new PurchaseFlow(); |
253 | 253 | $flow->addItemProcessor(new StockValidator()); |
254 | 254 | $flow->addItemProcessor(new DisplayStatusValidator()); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | return $flow; |
259 | 259 | }; |
260 | 260 | |
261 | - $app['eccube.purchase.flow.order'] = function () use ($app) { |
|
261 | + $app['eccube.purchase.flow.order'] = function() use ($app) { |
|
262 | 262 | $flow = new PurchaseFlow(); |
263 | 263 | $flow->addItemProcessor(new StockValidator()); |
264 | 264 | $flow->addItemHolderProcessor(new PaymentTotalLimitValidator($app['config']['max_total_fee'])); |
@@ -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 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | $pluginSubDirs = (function($dirName) use ($enabledPluginDirs) { |
242 | 242 | return array_map(function($pluginDir) use ($dirName) { |
243 | - return $pluginDir . '/' . $dirName; |
|
243 | + return $pluginDir.'/'.$dirName; |
|
244 | 244 | }, $enabledPluginDirs); |
245 | 245 | }); |
246 | 246 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | return $router; |
302 | 302 | }); |
303 | 303 | |
304 | - $this['eccube.router.origin'] = function ($app) { |
|
304 | + $this['eccube.router.origin'] = function($app) { |
|
305 | 305 | $resource = __DIR__.'/Controller'; |
306 | 306 | $cachePrefix = 'Origin'; |
307 | 307 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $this['eccube.routers.plugin'] = []; |
312 | 312 | |
313 | - $this['eccube.router.extend'] = function ($app) { |
|
313 | + $this['eccube.router.extend'] = function($app) { |
|
314 | 314 | // TODO ディレクトリ名は暫定 |
315 | 315 | $resource = $app['config']['root_dir'].'/app/Acme/Controller'; |
316 | 316 | $cachePrefix = 'Extend'; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | return $router; |
321 | 321 | }; |
322 | 322 | |
323 | - $this->extend('request_matcher', function ($matcher, $app) { |
|
323 | + $this->extend('request_matcher', function($matcher, $app) { |
|
324 | 324 | $matchers = []; |
325 | 325 | $matchers[] = $app['eccube.router.extend']; |
326 | 326 | foreach ($app['eccube.routers.plugin'] as $router) { |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | return new ChainUrlMatcher($matchers, $app['request_context']); |
333 | 333 | }); |
334 | 334 | |
335 | - $this->extend('url_generator', function ($generator, $app) { |
|
335 | + $this->extend('url_generator', function($generator, $app) { |
|
336 | 336 | $generators = []; |
337 | 337 | $generators[] = $app['eccube.router.extend']; |
338 | 338 | foreach ($app['eccube.routers.plugin'] as $router) { |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | }); |
346 | 346 | |
347 | 347 | // Route CollectionにEC-CUBEで定義したルーティングを追加(debug tool barに出力するため) |
348 | - $this->extend('routes', function ($routes, $app) { |
|
348 | + $this->extend('routes', function($routes, $app) { |
|
349 | 349 | $routes->addCollection($app['eccube.router.extend']->getRouteCollection()); |
350 | 350 | foreach ($app['eccube.routers.plugin'] as $router) { |
351 | 351 | $routes->addCollection($router->getRouteCollection()); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'translator.cache_dir' => $this['debug'] ? null : $this['config']['root_dir'].'/app/cache/translator', |
379 | 379 | 'locale_fallbacks' => ['ja', 'en'], |
380 | 380 | )); |
381 | - $this->extend('translator', function ($translator, \Silex\Application $app) { |
|
381 | + $this->extend('translator', function($translator, \Silex\Application $app) { |
|
382 | 382 | $translator->addLoader('php', new \Symfony\Component\Translation\Loader\PhpFileLoader()); |
383 | 383 | |
384 | 384 | $file = __DIR__.'/Resource/locale/messages.'.$app['locale'].'.php'; |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | $this->register(new \Silex\Provider\TwigServiceProvider(), array( |
422 | 422 | 'twig.form.templates' => array('Form/form_layout.twig'), |
423 | 423 | )); |
424 | - $this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) { |
|
424 | + $this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) { |
|
425 | 425 | $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app)); |
426 | 426 | $twig->addExtension(new \Twig_Extension_StringLoader()); |
427 | 427 | |
428 | 428 | return $twig; |
429 | 429 | }); |
430 | 430 | |
431 | - $this->before(function (Request $request, \Silex\Application $app) { |
|
431 | + $this->before(function(Request $request, \Silex\Application $app) { |
|
432 | 432 | $app['admin'] = $app['front'] = false; |
433 | 433 | $pathinfo = rawurldecode($request->getPathInfo()); |
434 | 434 | if (strpos($pathinfo, '/'.trim($app['config']['admin_route'], '/').'/') === 0) { |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | } |
445 | 445 | $paths[] = $app['config']['template_admin_realdir']; |
446 | 446 | $paths[] = __DIR__.'/../../app/Plugin'; |
447 | - $cacheDir = __DIR__.'/../../app/cache/twig/admin'; |
|
447 | + $cacheDir = __DIR__.'/../../app/cache/twig/admin'; |
|
448 | 448 | } else { |
449 | 449 | // モバイル端末時、smartphoneディレクトリを探索パスに追加する. |
450 | 450 | if ($app['mobile_detect.device_type'] == \Eccube\Entity\Master\DeviceType::DEVICE_TYPE_SP) { |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | } |
460 | 460 | $paths[] = $app['config']['template_default_realdir']; |
461 | 461 | $paths[] = __DIR__.'/../../app/Plugin'; |
462 | - $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; |
|
462 | + $cacheDir = __DIR__.'/../../app/cache/twig/'.$app['config']['template_code']; |
|
463 | 463 | } |
464 | 464 | $app['twig']->setCache($app['debug'] ? null : $cacheDir); |
465 | 465 | $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($paths)); |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | }, self::EARLY_EVENT); |
478 | 478 | |
479 | 479 | // twigのグローバル変数を定義. |
480 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { |
|
480 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) { |
|
481 | 481 | // 未ログイン時にマイページや管理画面以下にアクセスするとSubRequestで実行されるため, |
482 | 482 | // $event->isMasterRequest()ではなく、グローバル変数が初期化済かどうかの判定を行う |
483 | 483 | if (isset($this['twig_global_initialized']) && $this['twig_global_initialized'] === true) { |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | // メール送信時の文字エンコード指定(デフォルトはUTF-8) |
563 | 563 | if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) { |
564 | 564 | if ($this['config']['mail']['charset_iso_2022_jp'] === true) { |
565 | - \Swift::init(function () { |
|
565 | + \Swift::init(function() { |
|
566 | 566 | \Swift_DependencyContainer::getInstance() |
567 | 567 | ->register('mime.qpheaderencoder') |
568 | 568 | ->asAliasOf('mime.base64headerencoder'); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $this->register(new \Saxulum\DoctrineOrmManagerRegistry\Provider\DoctrineOrmManagerRegistryProvider()); |
598 | 598 | |
599 | 599 | $app = $this; |
600 | - $this->extend('db.event_manager', function ($evm) use ($app) { |
|
600 | + $this->extend('db.event_manager', function($evm) use ($app) { |
|
601 | 601 | $initSubscriber = new InitSubscriber($app); |
602 | 602 | $evm->addEventSubscriber($initSubscriber); |
603 | 603 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | |
693 | 693 | $this->extend( |
694 | 694 | 'orm.em.config', |
695 | - function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
695 | + function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
696 | 696 | |
697 | 697 | /** @var $chain \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain */ |
698 | 698 | $chain = $config->getMetadataDriverImpl(); |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | } |
715 | 715 | ); |
716 | 716 | |
717 | - $this->extend('orm.em', function (\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { |
|
717 | + $this->extend('orm.em', function(\Doctrine\ORM\EntityManager $em, \Silex\Application $app) { |
|
718 | 718 | // save |
719 | 719 | $saveEventSubscriber = new \Eccube\Doctrine\EventSubscriber\SaveEventSubscriber($app); |
720 | 720 | $em->getEventManager()->addEventSubscriber($saveEventSubscriber); |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | // second level cacheの設定. |
736 | 736 | $this->extend( |
737 | 737 | 'orm.em.config', |
738 | - function (\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
738 | + function(\Doctrine\ORM\Configuration $config, \Silex\Application $app) { |
|
739 | 739 | $config->setSecondLevelCacheEnabled(); |
740 | 740 | $cacheConfig = $config->getSecondLevelCacheConfiguration(); |
741 | 741 | $regionConfig = $cacheConfig->getRegionsConfiguration(); |
@@ -824,31 +824,31 @@ discard block |
||
824 | 824 | array('^/mypage', 'ROLE_USER', $channel), |
825 | 825 | ); |
826 | 826 | |
827 | - $this['eccube.password_encoder'] = function ($app) { |
|
827 | + $this['eccube.password_encoder'] = function($app) { |
|
828 | 828 | return new \Eccube\Security\Core\Encoder\PasswordEncoder($app['config']); |
829 | 829 | }; |
830 | - $this['security.encoder_factory'] = function ($app) { |
|
830 | + $this['security.encoder_factory'] = function($app) { |
|
831 | 831 | return new \Symfony\Component\Security\Core\Encoder\EncoderFactory(array( |
832 | 832 | 'Eccube\Entity\Customer' => $app['eccube.password_encoder'], |
833 | 833 | 'Eccube\Entity\Member' => $app['eccube.password_encoder'], |
834 | 834 | )); |
835 | 835 | }; |
836 | - $this['eccube.event_listner.security'] = function ($app) { |
|
836 | + $this['eccube.event_listner.security'] = function($app) { |
|
837 | 837 | return new \Eccube\EventListener\SecurityEventListener($app['orm.em']); |
838 | 838 | }; |
839 | 839 | |
840 | 840 | // Voterの設定 |
841 | - $this['authority_voter'] = function ($app) { |
|
841 | + $this['authority_voter'] = function($app) { |
|
842 | 842 | return new \Eccube\Security\Voter\AuthorityVoter($app); |
843 | 843 | }; |
844 | 844 | |
845 | - $this->extend('security.voters', function ($voters, \Silex\Application $app) { |
|
845 | + $this->extend('security.voters', function($voters, \Silex\Application $app) { |
|
846 | 846 | $voters[] = $app['authority_voter']; |
847 | 847 | |
848 | 848 | return $voters; |
849 | 849 | }); |
850 | 850 | |
851 | - $this['security.access_manager'] = function ($app) { |
|
851 | + $this['security.access_manager'] = function($app) { |
|
852 | 852 | return new \Symfony\Component\Security\Core\Authorization\AccessDecisionManager($app['security.voters'], 'unanimous'); |
853 | 853 | }; |
854 | 854 | |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | { |
863 | 863 | $config = $this['config']; |
864 | 864 | if (isset($config['trusted_proxies_connection_only']) && !empty($config['trusted_proxies_connection_only'])) { |
865 | - $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($config) { |
|
865 | + $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($config) { |
|
866 | 866 | // サブリクエストのREMOTE_ADDRも動的に設定を行う必要があるため、KernelEvents::REQUESTを使用する |
867 | 867 | Request::setTrustedProxies(array_merge(array($event->getRequest()->server->get('REMOTE_ADDR')), $config['trusted_proxies'])); |
868 | 868 | }, self::EARLY_EVENT); |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | $this->register(new ServiceProvider\EccubePluginServiceProvider()); |
880 | 880 | |
881 | 881 | // TODO Acme\ServiceProvider の初期化はここで OK? |
882 | - if (array_key_exists('service',$this['config'])) { |
|
882 | + if (array_key_exists('service', $this['config'])) { |
|
883 | 883 | foreach ($this['config']['service'] as $service) { |
884 | 884 | $this->register(new $service); |
885 | 885 | } |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | $app = $this; |
1017 | 1017 | |
1018 | 1018 | // Response Event(http cache対応、event実行は一番遅く設定) |
1019 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
1019 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
1020 | 1020 | |
1021 | 1021 | if (!$event->isMasterRequest()) { |
1022 | 1022 | return; |
@@ -122,7 +122,7 @@ |
||
122 | 122 | $News = new \Eccube\Entity\News(); |
123 | 123 | } |
124 | 124 | |
125 | - $News->setLinkMethod((bool)$News->getLinkMethod()); |
|
125 | + $News->setLinkMethod((bool) $News->getLinkMethod()); |
|
126 | 126 | |
127 | 127 | $builder = $this->formFactory |
128 | 128 | ->createBuilder(NewsType::class, $News); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $num = $this->productClassRepository->createQueryBuilder('pc') |
183 | 183 | ->select('count(pc.id)') |
184 | 184 | ->where('pc.ClassCategory1 = :id OR pc.ClassCategory2 = :id') |
185 | - ->setParameter('id',$id) |
|
185 | + ->setParameter('id', $id) |
|
186 | 186 | ->getQuery() |
187 | 187 | ->getSingleScalarResult(); |
188 | 188 | if ($num > 0) { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | log_error('規格分類削除エラー', array($id, $e)); |
209 | 209 | |
210 | 210 | $message = $app->trans('admin.delete.failed.foreign_key', ['%name%' => '規格分類']); |
211 | - $app->addError($message, 'admin'); } |
|
211 | + $app->addError($message, 'admin'); } |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | return $app->redirect($app->url('admin_product_class_category', array('class_name_id' => $ClassName->getId()))); |
@@ -148,7 +148,7 @@ |
||
148 | 148 | try { |
149 | 149 | $this->classNameRepository->delete($ClassName); |
150 | 150 | |
151 | - $event = new EventArgs(['ClassName' => $ClassName,], $request); |
|
151 | + $event = new EventArgs(['ClassName' => $ClassName, ], $request); |
|
152 | 152 | $this->eventDispatcher->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_DELETE_COMPLETE, $event); |
153 | 153 | |
154 | 154 | $app->addSuccess('admin.class_name.delete.complete', 'admin'); |
@@ -242,7 +242,7 @@ |
||
242 | 242 | $this->eventDispatcher->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_PAYMENT_DELETE_COMPLETE, $event); |
243 | 243 | |
244 | 244 | $app->addSuccess('admin.delete.complete', 'admin'); |
245 | - } catch(ForeignKeyConstraintViolationException $e) { |
|
245 | + } catch (ForeignKeyConstraintViolationException $e) { |
|
246 | 246 | $this->entityManager->rollback(); |
247 | 247 | |
248 | 248 | $message = $app->trans('admin.delete.failed.foreign_key', ['%name%' => '支払方法']); |
@@ -257,7 +257,7 @@ |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | foreach ($readPaths as $readPath) { |
260 | - $filePath = $readPath . '/' . $fileName . '.twig'; |
|
260 | + $filePath = $readPath.'/'.$fileName.'.twig'; |
|
261 | 261 | $fs = new Filesystem(); |
262 | 262 | if ($fs->exists($filePath)) { |
263 | 263 | return array( |
@@ -63,7 +63,7 @@ |
||
63 | 63 | public function hasProductByName($productName) |
64 | 64 | { |
65 | 65 | $OrderItems = $this->filter( |
66 | - function (ItemInterface $OrderItem) use ($productName) { |
|
66 | + function(ItemInterface $OrderItem) use ($productName) { |
|
67 | 67 | /* @var OrderItem $OrderItem */ |
68 | 68 | return $OrderItem->getProductName() == $productName; |
69 | 69 | }); |