InstallData   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 33
dl 0
loc 49
rs 10
c 3
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A install() 0 7 3
1
<?php
2
3
namespace Pagantis\Pagantis\Setup;
4
5
use Magento\Framework\Setup\InstallDataInterface;
6
use Magento\Framework\Setup\ModuleContextInterface;
7
use Magento\Framework\Setup\ModuleDataSetupInterface;
8
9
class InstallData implements InstallDataInterface
10
{
11
    /** Config tablename */
12
    const CONFIG_TABLE = 'Pagantis_config';
13
14
    /**
15
     * Variable which contains extra configuration. If you modify this array, modify it in UpdateData.php too
16
     * @var array $defaultConfigs
17
     */
18
    public $defaultConfigs = array(
19
       'PAGANTIS_TITLE'=>'Instant financing',
20
       'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'sdk.simulator.types.PRODUCT_PAGE',
21
       'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'=>'sdk.simulator.types.CHECKOUT_PAGE',
22
       'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'sdk.simulator.skins.BLUE',
23
       'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons',
24
       'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3,
25
       'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12,
26
       'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default',
27
       'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'sdk.simulator.positions.INNER',
28
       'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default',
29
       'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default',
30
       'PAGANTIS_FORM_DISPLAY_TYPE'=>0,
31
       'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1,
32
       'PAGANTIS_DISPLAY_MAX_AMOUNT'=>0,
33
       'PAGANTIS_URL_OK'=>'',
34
       'PAGANTIS_URL_KO'=>'',
35
       'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!',
36
       'PAGANTIS_ALLOWED_COUNTRIES' => 'a:3:{i:0;s:2:"es";i:1;s:2:"it";i:2;s:2:"fr";}',
37
       'PAGANTIS_PROMOTION_EXTRA' => '<p class="promoted">Finance this product <span class="pg-no-interest">without interest!</span></p>',
38
       'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR' => '.',
39
       'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR' => ',',
40
       'PAGANTIS_SIMULATOR_DISPLAY_SITUATION' => '',
41
        //4x
42
        'PAGANTIS_DISPLAY_MIN_AMOUNT_4x'=>0,
43
        'PAGANTIS_DISPLAY_MAX_AMOUNT_4x'=>800,
44
        'PAGANTIS_TITLE_4x'=>'Until 4 installments, without fees',
45
    );
46
47
    /**
48
     * @param ModuleDataSetupInterface $setup
49
     * @param ModuleContextInterface   $context
50
     */
51
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
52
    {
53
        $prefixedTableName = $setup->getConnection()->getTableName(self::CONFIG_TABLE);
54
        if ($setup->tableExists($prefixedTableName)) {
55
            foreach ($this->defaultConfigs as $config => $value) {
56
                $setup->getConnection()
57
                      ->insert($prefixedTableName, array('config' => $config, 'value' => $value));
58
            }
59
        }
60
    }
61
}