GenericButton::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * MagePrince
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the mageprince.com license that is
8
 * available through the world-wide-web at this URL:
9
 * https://mageprince.com/end-user-license-agreement
10
 *
11
 * DISCLAIMER
12
 *
13
 * Do not edit or add to this file if you wish to upgrade this extension to newer
14
 * version in the future.
15
 *
16
 * @category    MagePrince
17
 * @package     Mageprince_Faq
18
 * @copyright   Copyright (c) MagePrince (https://mageprince.com/)
19
 * @license     https://mageprince.com/end-user-license-agreement
20
 */
21
22
namespace Mageprince\Faq\Block\Adminhtml\Faq\Edit;
23
24
use Magento\Backend\Block\Widget\Context;
0 ignored issues
show
Bug introduced by
The type Magento\Backend\Block\Widget\Context 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...
25
26
abstract class GenericButton
27
{
28
    /**
29
     * @var Context
30
     */
31
    protected $context;
32
33
    /**
34
     * @param \Magento\Backend\Block\Widget\Context $context
35
     */
36
    public function __construct(Context $context)
37
    {
38
        $this->context = $context;
39
    }
40
41
    /**
42
     * Return model ID
43
     *
44
     * @return int|null
45
     */
46
    public function getModelId()
47
    {
48
        return $this->context->getRequest()->getParam('faq_id');
49
    }
50
51
    /**
52
     * Generate url by route and parameters
53
     *
54
     * @param   string $route
55
     * @param   array $params
56
     * @return  string
57
     */
58
    public function getUrl($route = '', $params = [])
59
    {
60
        return $this->context->getUrlBuilder()->getUrl($route, $params);
61
    }
62
}
63