Passed
Pull Request — master (#49)
by
unknown
09:10
created

Data::restoreCartProducts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * MagePrince
5
 * Copyright (C) 2020 Mageprince <[email protected]>
6
 *
7
 * @package Mageprince_BuyNow
8
 * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/)
9
 * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0)
10
 * @author MagePrince <[email protected]>
11
 */
12
13
namespace Mageprince\BuyNow\Helper;
14
15
class Data extends \Magento\Framework\App\Helper\AbstractHelper
0 ignored issues
show
Bug introduced by
The type Magento\Framework\App\Helper\AbstractHelper was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
{
17
    /**
18
     * Buynow button title path
19
     */
20
    const BUYNOW_BUTTON_TITLE_PATH = 'buynow/general/button_title';
21
22
    /**
23
     * Buynow button title
24
     */
25
    const BUYNOW_BUTTON_TITLE = 'Buy Now';
26
27
    /**
28
     * Addtocart button form id path
29
     */
30
    const ADDTOCART_FORM_ID_PATH = 'buynow/general/addtocart_id';
31
32
    /**
33
     * Addtocart button form id
34
     */
35
    const ADDTOCART_FORM_ID = 'product_addtocart_form';
36
37
    /**
38
     * Keep cart products path
39
     */
40
    const KEEP_CART_PRODUCTS_PATH = 'buynow/general/keep_cart_products';
41
42
    /**
43
     * Restore cart products path
44
     */
45
    const RESTORE_CART_PRODUCTS_PATH = 'buynow/general/restore_cart_products';
46
47
    /**
48
     * Retrieve config value
49
     *
50
     * @return string
51
     */
52
    public function getConfig($config)
53
    {
54
        return $this->scopeConfig->getValue(
55
            $config,
56
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE
0 ignored issues
show
Bug introduced by
The type Magento\Store\Model\ScopeInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
57
        );
58
    }
59
60
    /**
61
     * Get button title
62
     * @return string
63
     */
64
    public function getButtonTitle()
65
    {
66
        $btnTitle = $this->getConfig(self::BUYNOW_BUTTON_TITLE_PATH);
67
        return $btnTitle ? $btnTitle : self::BUYNOW_BUTTON_TITLE;
68
    }
69
70
    /**
71
     * Get addtocart form id
72
     * @return string
73
     */
74
    public function getAddToCartFormId()
75
    {
76
        $addToCartFormId = $this->getConfig(self::ADDTOCART_FORM_ID_PATH);
77
        return $addToCartFormId ? $addToCartFormId : self::ADDTOCART_FORM_ID;
78
    }
79
80
    /**
81
     * Check if keep cart products
82
     * @return string
83
     */
84
    public function keepCartProducts()
85
    {
86
        return $this->getConfig(self::KEEP_CART_PRODUCTS_PATH);
87
    }
88
89
    /**
90
     * Check if restore cart products
91
     * @return string
92
     */
93
    public function restoreCartProducts()
94
    {
95
        return $this->getConfig(self::RESTORE_CART_PRODUCTS_PATH);
96
    }
97
}
98