Conditions | 7 |
Paths | 10 |
Total Lines | 16 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function execute(\Magento\Framework\Event\Observer $observer) |
||
17 | { |
||
18 | try { |
||
19 | if ($observer->getEvent()->getMethodInstance()->getCode()=="pagantis") { |
||
20 | $checkResult = $observer->getEvent()->getResult(); |
||
21 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); |
||
22 | $config = $objectManager->create('Pagantis\Pagantis\Helper\Config')->getConfig(); |
||
23 | if (!isset($config['pagantis_public_key']) || $config['pagantis_public_key'] == '' || |
||
24 | !isset($config['pagantis_private_key']) || $config['pagantis_private_key'] == '') { |
||
25 | $checkResult->setData('is_available', false); |
||
26 | } else { |
||
27 | $checkResult->setData('is_available', true); |
||
28 | } |
||
29 | } |
||
30 | } catch (\Exception $e) { |
||
31 | die($e->getMessage()); |
||
|
|||
32 | } |
||
35 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.