Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like PluginController often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use PluginController, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 41 | class PluginController extends AbstractController |
||
| 42 | { |
||
| 43 | /** |
||
| 44 | * @var PluginService |
||
| 45 | */ |
||
| 46 | protected $pluginService; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @var BaseInfo |
||
| 50 | */ |
||
| 51 | protected $BaseInfo; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var PluginRepository |
||
| 55 | */ |
||
| 56 | protected $pluginRepository; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var PluginApiService |
||
| 60 | */ |
||
| 61 | protected $pluginApiService; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * PluginController constructor. |
||
| 65 | * |
||
| 66 | * @param PluginRepository $pluginRepository |
||
| 67 | * @param PluginService $pluginService |
||
| 68 | * @param BaseInfoRepository $baseInfoRepository |
||
| 69 | * @param PluginApiService $pluginApiService |
||
| 70 | * |
||
| 71 | * @throws \Doctrine\ORM\NoResultException |
||
| 72 | * @throws \Doctrine\ORM\NonUniqueResultException |
||
| 73 | */ |
||
| 74 | public function __construct(PluginRepository $pluginRepository, PluginService $pluginService, BaseInfoRepository $baseInfoRepository, PluginApiService $pluginApiService) |
||
| 75 | { |
||
| 76 | $this->pluginRepository = $pluginRepository; |
||
| 77 | $this->pluginService = $pluginService; |
||
| 78 | $this->BaseInfo = $baseInfoRepository->get(); |
||
| 79 | $this->pluginApiService = $pluginApiService; |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * インストール済プラグイン画面 |
||
| 84 | * |
||
| 85 | * @Route("/%eccube_admin_route%/store/plugin", name="admin_store_plugin") |
||
| 86 | * @Template("@admin/Store/plugin.twig") |
||
| 87 | */ |
||
| 88 | public function index(Request $request) |
||
| 89 | { |
||
| 90 | $pluginForms = []; |
||
| 91 | $configPages = []; |
||
| 92 | $Plugins = $this->pluginRepository->findBy([], ['code' => 'ASC']); |
||
| 93 | |||
| 94 | // ファイル設置プラグインの取得. |
||
| 95 | $unregisterdPlugins = $this->getUnregisteredPlugins($Plugins); |
||
| 96 | $unregisterdPluginsConfigPages = []; |
||
| 97 | foreach ($unregisterdPlugins as $unregisterdPlugin) { |
||
| 98 | try { |
||
| 99 | $code = $unregisterdPlugin['code']; |
||
| 100 | // プラグイン用設定画面があれば表示(プラグイン用のサービスプロバイダーに定義されているか) |
||
| 101 | $unregisterdPluginsConfigPages[$code] = $this->generateUrl('plugin_'.$code.'_config'); |
||
| 102 | } catch (RouteNotFoundException $e) { |
||
| 103 | // プラグインで設定画面のルートが定義されていない場合は無視 |
||
| 104 | } |
||
| 105 | } |
||
| 106 | |||
| 107 | $officialPlugins = []; |
||
| 108 | $unofficialPlugins = []; |
||
| 109 | |||
| 110 | foreach ($Plugins as $Plugin) { |
||
| 111 | $form = $this->formFactory |
||
| 112 | ->createNamedBuilder( |
||
| 113 | 'form'.$Plugin->getId(), |
||
| 114 | PluginManagementType::class, |
||
| 115 | null, |
||
| 116 | [ |
||
| 117 | 'plugin_id' => $Plugin->getId(), |
||
| 118 | ] |
||
| 119 | ) |
||
| 120 | ->getForm(); |
||
| 121 | $pluginForms[$Plugin->getId()] = $form->createView(); |
||
| 122 | |||
| 123 | try { |
||
| 124 | // プラグイン用設定画面があれば表示(プラグイン用のサービスプロバイダーに定義されているか) |
||
| 125 | $configPages[$Plugin->getCode()] = $this->generateUrl(Container::underscore($Plugin->getCode()).'_admin_config'); |
||
| 126 | } catch (\Exception $e) { |
||
| 127 | // プラグインで設定画面のルートが定義されていない場合は無視 |
||
| 128 | } |
||
| 129 | if ($Plugin->getSource() == 0) { |
||
| 130 | // 商品IDが設定されていない場合、非公式プラグイン |
||
| 131 | $unofficialPlugins[] = $Plugin; |
||
| 132 | } else { |
||
| 133 | $officialPlugins[$Plugin->getSource()] = $Plugin; |
||
| 134 | } |
||
| 135 | } |
||
| 136 | |||
| 137 | // Todo: Need new authentication mechanism |
||
| 138 | // オーナーズストアからダウンロード可能プラグイン情報を取得 |
||
| 139 | $authKey = $this->BaseInfo->getAuthenticationKey(); |
||
| 140 | // オーナーズストア通信 |
||
| 141 | // TODO: get url from api service instead of direct from controller |
||
| 142 | $url = $this->eccubeConfig['eccube_package_repo_url'].'/plugins/purchased'; |
||
| 143 | list($json, $info) = $this->getRequestApi($request, $authKey, $url); |
||
| 144 | $officialPluginsDetail = []; |
||
| 145 | if ($json) { |
||
| 146 | // 接続成功時 |
||
| 147 | $data = json_decode($json, true); |
||
| 148 | foreach ($data as $item) { |
||
| 149 | if (isset($officialPlugins[$item['id']])) { |
||
| 150 | $Plugin = $officialPlugins[$item['id']]; |
||
| 151 | $officialPluginsDetail[$item['id']] = $item; |
||
| 152 | $officialPluginsDetail[$item['id']]['update_status'] = 0; |
||
| 153 | View Code Duplication | if ($this->pluginService->isUpdate($Plugin->getVersion(), $item['version'])) { |
|
| 154 | $officialPluginsDetail[$item['id']]['update_status'] = 1; |
||
| 155 | } |
||
| 156 | } else { |
||
| 157 | $Plugin = new Plugin(); |
||
| 158 | $Plugin->setName($item['name']); |
||
| 159 | $Plugin->setCode($item['code']); |
||
| 160 | $Plugin->setVersion($item['version']); |
||
| 161 | $Plugin->setSource($item['id']); |
||
| 162 | $Plugin->setEnabled(false); |
||
| 163 | $officialPlugins[$item['id']] = $Plugin; |
||
| 164 | $officialPluginsDetail[$item['id']] = $item; |
||
| 165 | $officialPluginsDetail[$item['id']]['update_status'] = 0; |
||
| 166 | View Code Duplication | if ($this->pluginService->isUpdate($Plugin->getVersion(), $item['version'])) { |
|
| 167 | $officialPluginsDetail[$item['id']]['update_status'] = 1; |
||
| 168 | } |
||
| 169 | } |
||
| 170 | } |
||
| 171 | } |
||
| 172 | |||
| 173 | return [ |
||
| 174 | 'plugin_forms' => $pluginForms, |
||
| 175 | 'officialPlugins' => $officialPlugins, |
||
| 176 | 'unofficialPlugins' => $unofficialPlugins, |
||
| 177 | 'configPages' => $configPages, |
||
| 178 | 'unregisterdPlugins' => $unregisterdPlugins, |
||
| 179 | 'unregisterdPluginsConfigPages' => $unregisterdPluginsConfigPages, |
||
| 180 | 'officialPluginsDetail' => $officialPluginsDetail, |
||
| 181 | ]; |
||
| 182 | } |
||
| 183 | |||
| 184 | /** |
||
| 185 | * インストール済プラグインからのアップデート |
||
| 186 | * |
||
| 187 | * @Route("/%eccube_admin_route%/store/plugin/{id}/update", requirements={"id" = "\d+"}, name="admin_store_plugin_update", methods={"POST"}) |
||
| 188 | * |
||
| 189 | * @param Request $request |
||
| 190 | * @param Plugin $Plugin |
||
| 191 | * |
||
| 192 | * @return RedirectResponse |
||
| 193 | */ |
||
| 194 | public function update(Request $request, Plugin $Plugin) |
||
| 195 | { |
||
| 196 | $form = $this->formFactory |
||
| 197 | ->createNamedBuilder( |
||
| 198 | 'form'.$Plugin->getId(), |
||
| 199 | PluginManagementType::class, |
||
| 200 | null, |
||
| 201 | [ |
||
| 202 | 'plugin_id' => null, // placeHolder |
||
| 203 | ] |
||
| 204 | ) |
||
| 205 | ->getForm(); |
||
| 206 | |||
| 207 | $message = ''; |
||
| 208 | $form->handleRequest($request); |
||
| 209 | if ($form->isSubmitted() && $form->isValid()) { |
||
| 210 | $tmpDir = null; |
||
| 211 | try { |
||
| 212 | $formFile = $form['plugin_archive']->getData(); |
||
| 213 | $tmpDir = $this->pluginService->createTempDir(); |
||
| 214 | $tmpFile = sha1(StringUtil::random(32)).'.'.$formFile->getClientOriginalExtension(); |
||
| 215 | $formFile->move($tmpDir, $tmpFile); |
||
| 216 | $this->pluginService->update($Plugin, $tmpDir.'/'.$tmpFile); |
||
| 217 | $fs = new Filesystem(); |
||
| 218 | $fs->remove($tmpDir); |
||
| 219 | $this->addSuccess('admin.plugin.update.complete', 'admin'); |
||
| 220 | |||
| 221 | return $this->redirectToRoute('admin_store_plugin'); |
||
| 222 | } catch (PluginException $e) { |
||
| 223 | if (!empty($tmpDir) && file_exists($tmpDir)) { |
||
| 224 | $fs = new Filesystem(); |
||
| 225 | $fs->remove($tmpDir); |
||
| 226 | } |
||
| 227 | $message = $e->getMessage(); |
||
| 228 | } catch (\Exception $er) { |
||
| 229 | // Catch composer install error | Other error |
||
| 230 | if (!empty($tmpDir) && file_exists($tmpDir)) { |
||
| 231 | $fs = new Filesystem(); |
||
| 232 | $fs->remove($tmpDir); |
||
| 233 | } |
||
| 234 | log_error('plugin install failed.', ['original-message' => $er->getMessage()]); |
||
| 235 | $message = 'admin.plugin.install.fail'; |
||
| 236 | } |
||
| 237 | } else { |
||
| 238 | $errors = $form->getErrors(true); |
||
| 239 | foreach ($errors as $error) { |
||
| 240 | $message = $error->getMessage(); |
||
| 241 | } |
||
| 242 | } |
||
| 243 | |||
| 244 | $this->addError($message, 'admin'); |
||
| 245 | |||
| 246 | return $this->redirectToRoute('admin_store_plugin'); |
||
| 247 | } |
||
| 248 | |||
| 249 | /** |
||
| 250 | * 対象のプラグインを有効にします。 |
||
| 251 | * |
||
| 252 | * @Route("/%eccube_admin_route%/store/plugin/{id}/enable", requirements={"id" = "\d+"}, name="admin_store_plugin_enable", methods={"PUT"}) |
||
| 253 | * |
||
| 254 | * @param Plugin $Plugin |
||
| 255 | * |
||
| 256 | * @return RedirectResponse |
||
| 257 | */ |
||
| 258 | View Code Duplication | public function enable(Plugin $Plugin, CacheUtil $cacheUtil) |
|
| 259 | { |
||
| 260 | $this->isTokenValid(); |
||
| 261 | |||
| 262 | if ($Plugin->isEnabled()) { |
||
| 263 | $this->addError('admin.plugin.already.enable', 'admin'); |
||
| 264 | } else { |
||
| 265 | $requires = $this->pluginService->findRequirePluginNeedEnable($Plugin->getCode()); |
||
| 266 | if (!empty($requires)) { |
||
| 267 | $DependPlugin = $this->pluginRepository->findOneBy(['code' => $requires[0]]); |
||
| 268 | $dependName = $requires[0]; |
||
| 269 | if ($DependPlugin) { |
||
| 270 | $dependName = $DependPlugin->getName(); |
||
| 271 | } |
||
| 272 | $message = trans('admin.plugin.enable.depend', ['%name%' => $Plugin->getName(), '%depend_name%' => $dependName]); |
||
| 273 | $this->addError($message, 'admin'); |
||
| 274 | |||
| 275 | return $this->redirectToRoute('admin_store_plugin'); |
||
| 276 | } |
||
| 277 | $this->pluginService->enable($Plugin); |
||
| 278 | $this->addSuccess('admin.plugin.enable.complete', 'admin'); |
||
| 279 | } |
||
| 280 | |||
| 281 | // キャッシュを削除してリダイレクト |
||
| 282 | // リダイレクトにredirectToRoute関数を使用していないのは、削除したキャッシュが再生成されてしまうため。 |
||
| 283 | $url = $this->generateUrl('admin_store_plugin'); |
||
| 284 | $cacheUtil->clearCache(); |
||
| 285 | |||
| 286 | return $this->redirect($url); |
||
| 287 | } |
||
| 288 | |||
| 289 | /** |
||
| 290 | * 対象のプラグインを無効にします。 |
||
| 291 | * |
||
| 292 | * @Route("/%eccube_admin_route%/store/plugin/{id}/disable", requirements={"id" = "\d+"}, name="admin_store_plugin_disable", methods={"PUT"}) |
||
| 293 | * |
||
| 294 | * @param Plugin $Plugin |
||
| 295 | * |
||
| 296 | * @return RedirectResponse |
||
| 297 | */ |
||
| 298 | View Code Duplication | public function disable(Plugin $Plugin, CacheUtil $cacheUtil) |
|
| 299 | { |
||
| 300 | $this->isTokenValid(); |
||
| 301 | |||
| 302 | if ($Plugin->isEnabled()) { |
||
| 303 | $dependents = $this->pluginService->findDependentPluginNeedDisable($Plugin->getCode()); |
||
| 304 | if (!empty($dependents)) { |
||
| 305 | $dependName = $dependents[0]; |
||
| 306 | $DependPlugin = $this->pluginRepository->findOneBy(['code' => $dependents[0]]); |
||
| 307 | if ($DependPlugin) { |
||
| 308 | $dependName = $DependPlugin->getName(); |
||
| 309 | } |
||
| 310 | $message = trans('admin.plugin.disable.depend', ['%name%' => $Plugin->getName(), '%depend_name%' => $dependName]); |
||
| 311 | $this->addError($message, 'admin'); |
||
| 312 | |||
| 313 | return $this->redirectToRoute('admin_store_plugin'); |
||
| 314 | } |
||
| 315 | |||
| 316 | $this->pluginService->disable($Plugin); |
||
| 317 | $this->addSuccess('admin.plugin.disable.complete', 'admin'); |
||
| 318 | } else { |
||
| 319 | $this->addError('admin.plugin.already.disable', 'admin'); |
||
| 320 | |||
| 321 | return $this->redirectToRoute('admin_store_plugin'); |
||
| 322 | } |
||
| 323 | |||
| 324 | // キャッシュを削除してリダイレクト |
||
| 325 | // リダイレクトにredirectToRoute関数を使用していないのは、削除したキャッシュが再生成されてしまうため。 |
||
| 326 | $url = $this->generateUrl('admin_store_plugin'); |
||
| 327 | $cacheUtil->clearCache(); |
||
| 328 | |||
| 329 | return $this->redirect($url); |
||
| 330 | } |
||
| 331 | |||
| 332 | /** |
||
| 333 | * 対象のプラグインを削除します。 |
||
| 334 | * |
||
| 335 | * @Route("/%eccube_admin_route%/store/plugin/{id}/uninstall", requirements={"id" = "\d+"}, name="admin_store_plugin_uninstall", methods={"DELETE"}) |
||
| 336 | * |
||
| 337 | * @param Plugin $Plugin |
||
| 338 | * |
||
| 339 | * @return RedirectResponse |
||
| 340 | */ |
||
| 341 | View Code Duplication | public function uninstall(Plugin $Plugin) |
|
| 342 | { |
||
| 343 | $this->isTokenValid(); |
||
| 344 | |||
| 345 | if ($Plugin->isEnabled()) { |
||
| 346 | $this->addError('admin.plugin.uninstall.error.not_disable', 'admin'); |
||
| 347 | |||
| 348 | return $this->redirectToRoute('admin_store_plugin'); |
||
| 349 | } |
||
| 350 | |||
| 351 | // Check other plugin depend on it |
||
| 352 | $pluginCode = $Plugin->getCode(); |
||
| 353 | $otherDepend = $this->pluginService->findDependentPlugin($pluginCode); |
||
| 354 | if (!empty($otherDepend)) { |
||
| 355 | $DependPlugin = $this->pluginRepository->findOneBy(['code' => $otherDepend[0]]); |
||
| 356 | $dependName = $otherDepend[0]; |
||
| 357 | if ($DependPlugin) { |
||
| 358 | $dependName = $DependPlugin->getName(); |
||
| 359 | } |
||
| 360 | $message = trans('admin.plugin.uninstall.depend', ['%name%' => $Plugin->getName(), '%depend_name%' => $dependName]); |
||
| 361 | $this->addError($message, 'admin'); |
||
| 362 | |||
| 363 | return $this->redirectToRoute('admin_store_plugin'); |
||
| 364 | } |
||
| 365 | |||
| 366 | $this->pluginService->uninstall($Plugin); |
||
| 367 | $this->addSuccess('admin.plugin.uninstall.complete', 'admin'); |
||
| 368 | |||
| 369 | return $this->redirectToRoute('admin_store_plugin'); |
||
| 370 | } |
||
| 371 | |||
| 372 | /** |
||
| 373 | * プラグインファイルアップロード画面 |
||
| 374 | * |
||
| 375 | * @Route("/%eccube_admin_route%/store/plugin/install", name="admin_store_plugin_install") |
||
| 376 | * @Template("@admin/Store/plugin_install.twig") |
||
| 377 | * |
||
| 378 | * @param Request $request |
||
| 379 | * |
||
| 380 | * @return array|RedirectResponse |
||
| 381 | */ |
||
| 382 | public function install(Request $request) |
||
| 383 | { |
||
| 384 | $form = $this->formFactory |
||
| 385 | ->createBuilder(PluginLocalInstallType::class) |
||
| 386 | ->getForm(); |
||
| 387 | $errors = []; |
||
| 388 | $form->handleRequest($request); |
||
| 389 | if ($form->isSubmitted() && $form->isValid()) { |
||
| 390 | $tmpDir = null; |
||
| 391 | try { |
||
| 392 | $service = $this->pluginService; |
||
| 393 | /** @var UploadedFile $formFile */ |
||
| 394 | $formFile = $form['plugin_archive']->getData(); |
||
| 395 | $tmpDir = $service->createTempDir(); |
||
| 396 | // 拡張子を付けないとpharが動かないので付ける |
||
| 397 | $tmpFile = sha1(StringUtil::random(32)).'.'.$formFile->getClientOriginalExtension(); |
||
| 398 | $formFile->move($tmpDir, $tmpFile); |
||
| 399 | $tmpPath = $tmpDir.'/'.$tmpFile; |
||
| 400 | $service->install($tmpPath); |
||
| 401 | // Remove tmp file |
||
| 402 | $fs = new Filesystem(); |
||
| 403 | $fs->remove($tmpDir); |
||
| 404 | $this->addSuccess('admin.plugin.install.complete', 'admin'); |
||
| 405 | |||
| 406 | return $this->redirectToRoute('admin_store_plugin'); |
||
| 407 | } catch (PluginException $e) { |
||
| 408 | if (!empty($tmpDir) && file_exists($tmpDir)) { |
||
| 409 | $fs = new Filesystem(); |
||
| 410 | $fs->remove($tmpDir); |
||
| 411 | } |
||
| 412 | log_error('plugin install failed.', ['original-message' => $e->getMessage()]); |
||
| 413 | $errors[] = $e; |
||
| 414 | } catch (\Exception $er) { |
||
| 415 | // Catch composer install error | Other error |
||
| 416 | if (!empty($tmpDir) && file_exists($tmpDir)) { |
||
| 417 | $fs = new Filesystem(); |
||
| 418 | $fs->remove($tmpDir); |
||
| 419 | } |
||
| 420 | log_error('plugin install failed.', ['original-message' => $er->getMessage()]); |
||
| 421 | $this->addError('admin.plugin.install.fail', 'admin'); |
||
| 422 | } |
||
| 423 | } else { |
||
| 424 | foreach ($form->getErrors(true) as $error) { |
||
| 425 | $errors[] = $error; |
||
| 426 | } |
||
| 427 | } |
||
| 428 | |||
| 429 | return [ |
||
| 430 | 'form' => $form->createView(), |
||
| 431 | 'errors' => $errors, |
||
| 432 | ]; |
||
| 433 | } |
||
| 434 | |||
| 435 | /** |
||
| 436 | * 認証キー設定画面 |
||
| 437 | * |
||
| 438 | * @Route("/%eccube_admin_route%/store/plugin/authentication_setting", name="admin_store_authentication_setting") |
||
| 439 | * @Template("@admin/Store/authentication_setting.twig") |
||
| 440 | */ |
||
| 441 | public function authenticationSetting(Request $request) |
||
| 442 | { |
||
| 443 | $builder = $this->formFactory |
||
| 444 | ->createBuilder(AuthenticationType::class, $this->BaseInfo); |
||
| 445 | |||
| 446 | $form = $builder->getForm(); |
||
| 447 | $form->handleRequest($request); |
||
| 448 | |||
| 449 | if ($form->isSubmitted() && $form->isValid()) { |
||
| 450 | // 認証キーの登録 and PHP path |
||
| 451 | $this->BaseInfo = $form->getData(); |
||
| 452 | $this->entityManager->persist($this->BaseInfo); |
||
| 453 | $this->entityManager->flush(); |
||
| 454 | |||
| 455 | $this->addSuccess('admin.flash.register_completed', 'admin'); |
||
| 456 | } |
||
| 457 | |||
| 458 | $builderCaptcha = $this->formFactory->createBuilder(CaptchaType::class); |
||
| 459 | |||
| 460 | // get captcha image, save it to temp folder |
||
| 461 | list($captcha, $info) = $this->pluginApiService->getCaptcha(); |
||
| 462 | $tmpFolder = $this->eccubeConfig->get('eccube_temp_image_dir'); |
||
| 463 | file_put_contents($tmpFolder.'/captcha.png', $captcha); |
||
| 464 | |||
| 465 | return [ |
||
| 466 | 'form' => $form->createView(), |
||
| 467 | 'captchaForm' => $builderCaptcha->getForm()->createView(), |
||
| 468 | ]; |
||
| 469 | } |
||
| 470 | |||
| 471 | /** |
||
| 472 | * Captcha |
||
| 473 | * Todo: check fail (implement after the api defined) |
||
| 474 | * |
||
| 475 | * @param Request $request |
||
| 476 | * |
||
| 477 | * @return RedirectResponse |
||
| 478 | * |
||
| 479 | * @Route("/%eccube_admin_route%/store/plugin/auth/captcha", name="admin_store_auth_captcha") |
||
| 480 | */ |
||
| 481 | public function authenticationCaptcha(Request $request) |
||
| 482 | { |
||
| 483 | $builder = $this->formFactory->createBuilder(CaptchaType::class); |
||
| 484 | $form = $builder->getForm(); |
||
| 485 | $form->handleRequest($request); |
||
| 486 | if ($form->isSubmitted() && $form->isValid()) { |
||
| 487 | $param['captcha'] = $form['captcha']->getData(); |
||
| 488 | list($ret, $info) = $this->pluginApiService->postApiKey($param); |
||
| 489 | if ($ret && $data = json_decode($ret, true)) { |
||
| 490 | if (isset($data['api_key']) && !empty($data['api_key'])) { |
||
| 491 | $this->BaseInfo->setAuthenticationKey($data['api_key']); |
||
| 492 | $this->entityManager->persist($this->BaseInfo); |
||
| 493 | $this->entityManager->flush($this->BaseInfo); |
||
| 494 | $this->addSuccess('admin.flash.register_completed', 'admin'); |
||
| 495 | |||
| 496 | return $this->redirectToRoute('admin_store_authentication_setting'); |
||
| 497 | } |
||
| 498 | } |
||
| 499 | } |
||
| 500 | $this->addError('admin.flash.register_failed', 'admin'); |
||
| 501 | |||
| 502 | return $this->redirectToRoute('admin_store_authentication_setting'); |
||
| 503 | } |
||
| 504 | |||
| 505 | /** |
||
| 506 | * APIリクエスト処理 |
||
| 507 | * |
||
| 508 | * @param Request $request |
||
| 509 | * @param string|null $authKey |
||
| 510 | * @param string $url |
||
| 511 | * |
||
| 512 | * @deprecated since release, please refer PluginApiService |
||
| 513 | * |
||
| 514 | * @return array |
||
| 515 | */ |
||
| 516 | private function getRequestApi(Request $request, $authKey, $url) |
||
| 546 | |||
| 547 | /** |
||
| 548 | * レスポンスのチェック |
||
| 549 | * |
||
| 550 | * @param $info |
||
| 551 | * |
||
| 552 | * @return string |
||
| 553 | * |
||
| 554 | * @deprecated since release, please refer PluginApiService |
||
| 555 | */ |
||
| 556 | View Code Duplication | private function getResponseErrorMessage($info) |
|
| 569 | |||
| 570 | /** |
||
| 571 | * フォルダ設置のみのプラグインを取得する. |
||
| 572 | * |
||
| 573 | * @param array $plugins |
||
| 574 | * |
||
| 575 | * @return array |
||
| 576 | */ |
||
| 577 | protected function getUnregisteredPlugins(array $plugins) |
||
| 613 | } |
||
| 614 |
This checks looks for assignemnts to variables using the
list(...)function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$aand$care used. There was no need to assign$b.Instead, the list call could have been.