Container   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 76
rs 10
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A _preparelayout() 0 7 2
A _construct() 0 7 1
A __construct() 0 7 1
A getFromData() 0 3 1
A getSaveUrl() 0 3 1
A getHeaderText() 0 3 1
1
<?php
2
3
namespace Tkotosz\CommandScheduler\Block\Adminhtml\Schedule\Create\From;
4
5
use Magento\Backend\Block\Widget\Form\Container as BaseFormContainer;
0 ignored issues
show
Bug introduced by
The type Magento\Backend\Block\Widget\Form\Container 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
7
class Container extends BaseFormContainer
8
{
9
    /**
10
     * Core registry
11
     *
12
     * @var \Magento\Framework\Registry
13
     */
14
    protected $coreRegistry = null;
15
16
    /**
17
     * @param \Magento\Backend\Block\Widget\Context $context
18
     * @param \Magento\Framework\Registry $registry
19
     * @param array $data
20
     */
21
    public function __construct(
22
        \Magento\Backend\Block\Widget\Context $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...
23
        \Magento\Framework\Registry $registry,
24
        array $data = []
25
    ) {
26
        $this->coreRegistry = $registry;
27
        parent::__construct($context, $data);
28
    }
29
30
    /**
31
     * Internal constructor
32
     *
33
     * @return void
34
     */
35
    protected function _construct()
36
    {
37
        $this->_objectId = 'schedule_id';
0 ignored issues
show
Bug Best Practice introduced by
The property _objectId does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
38
        $this->_blockGroup = 'Tkotosz_CommandScheduler';
0 ignored issues
show
Bug Best Practice introduced by
The property _blockGroup does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
39
        $this->_controller = 'adminhtml_schedule';
0 ignored issues
show
Bug Best Practice introduced by
The property _controller does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
40
        $this->_mode = 'create';
0 ignored issues
show
Bug Best Practice introduced by
The property _mode does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
41
        parent::_construct();
42
    }
43
44
    
45
    public function getFromData()
46
    {
47
        return $this->coreRegistry->registry('tkotosz_command_scheduler_data_container');
0 ignored issues
show
Deprecated Code introduced by
The function Magento\Framework\Registry::registry() has been deprecated: 102.0.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

47
        return /** @scrutinizer ignore-deprecated */ $this->coreRegistry->registry('tkotosz_command_scheduler_data_container');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
48
    }
49
50
    /**
51
     * Prepare layout.
52
     * Adding save_and_continue button
53
     *
54
     * @return $this
55
     */
56
    protected function _preparelayout()
57
    {
58
        if (!$this->getFromData()->getData('command')) {
59
            $this->removeButton('save');
60
        }
61
62
        return parent::_prepareLayout();
63
    }
64
65
    /**
66
     * Return translated header text depending on creating/editing action
67
     *
68
     * @return \Magento\Framework\Phrase
69
     */
70
    public function getHeaderText()
71
    {
72
        return __('New Schedule');
73
    }
74
75
    /**
76
     * Return save url for edit form
77
     *
78
     * @return string
79
     */
80
    public function getSaveUrl()
81
    {
82
        return $this->getUrl('tkotosz_commandscheduler/schedule/save', ['_current' => false, 'back' => null]);
83
    }
84
}
85