Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UserConfig.php
Go to the documentation of this file.
1 <?php
8 namespace Magento\Backend\App;
9 
14 
19 class UserConfig implements AppInterface
20 {
26  private $response;
27 
33  private $request;
34 
40  private $configFactory;
41 
49  public function __construct(
50  Factory $configFactory,
51  Response $response,
52  array $request
53  ) {
54  $this->response = $response;
55  $this->request = $request;
56  $this->configFactory = $configFactory;
57  }
58 
64  public function launch()
65  {
66  $this->response->terminateOnSend(false);
67  $this->updateUserConfigData();
68  return $this->response;
69  }
70 
76  private function updateUserConfigData()
77  {
78  foreach ($this->request as $key => $val) {
79  $configModel = $this->configFactory->create();
80  $configModel->setDataByPath($key, $val);
81  $configModel->save();
82  }
83  }
84 
88  public function catchException(Bootstrap $bootstrap, \Exception $exception)
89  {
90  return false;
91  }
92 }
$response
Definition: 404.php:11
if(defined('TESTS_MAGENTO_INSTALLATION') &&TESTS_MAGENTO_INSTALLATION==='enabled') $bootstrap
Definition: bootstrap.php:73
__construct(Factory $configFactory, Response $response, array $request)
Definition: UserConfig.php:49
catchException(Bootstrap $bootstrap, \Exception $exception)
Definition: UserConfig.php:88
$configFactory
Definition: config_data.php:43