Issues (22)

ViewModel/BuyNow.php (3 issues)

Labels
Severity
1
<?php
2
3
namespace Mageprince\BuyNow\ViewModel;
4
5
use Magento\Framework\App\Config\ScopeConfigInterface;
0 ignored issues
show
The type Magento\Framework\App\Config\ScopeConfigInterface 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...
6
use Magento\Framework\View\Element\Block\ArgumentInterface;
0 ignored issues
show
The type Magento\Framework\View\E...Block\ArgumentInterface 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...
7
use Magento\Store\Model\ScopeInterface;
0 ignored issues
show
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...
8
9
class BuyNow implements ArgumentInterface
10
{
11
    /**
12
     * Buynow config paths
13
     */
14
    public const BUYNOW_BUTTON_TITLE_PATH = 'buynow/general/button_title';
15
    public const KEEP_CART_PRODUCTS_PATH = 'buynow/general/keep_cart_products';
16
17
    /**
18
     * @var ScopeConfigInterface
19
     */
20
    protected $scopeConfig;
21
22
    /**
23
     * BuyNow constructor.
24
     * @param ScopeConfigInterface $scopeConfig
25
     */
26
    public function __construct(
27
        ScopeConfigInterface $scopeConfig
28
    ) {
29
        $this->scopeConfig = $scopeConfig;
30
    }
31
32
    /**
33
     * Retrieve button title
34
     *
35
     * @return string
36
     */
37
    public function getButtonTitle()
38
    {
39
        return $this->scopeConfig->getValue(
40
            self::BUYNOW_BUTTON_TITLE_PATH,
41
            ScopeInterface::SCOPE_STORE
42
        );
43
    }
44
45
    /**
46
     * Check if keep cart products
47
     *
48
     * @return string
49
     */
50
    public function keepCartProducts()
51
    {
52
        return $this->scopeConfig->isSetFlag(
53
            self::KEEP_CART_PRODUCTS_PATH,
54
            ScopeInterface::SCOPE_STORE
55
        );
56
    }
57
}
58