Code Duplication    Length = 65-66 lines in 2 locations

Block/Adminhtml/Protocol/Api/View.php 1 location

@@ 34-99 (lines=66) @@
31
/**
32
 * Class for API-log grid block
33
 */
34
class View extends \Magento\Backend\Block\Widget\Container
35
{
36
    /**
37
     * Requested ApiLog-entry
38
     *
39
     * @var \Payone\Core\Model\Entities\ApiLog
40
     */
41
    protected $oApiLog = null;
42
43
    /**
44
     * ApiLog factory
45
     *
46
     * @var \Payone\Core\Model\Entities\ApiLogFactory
47
     */
48
    protected $apiLogFactory;
49
50
    /**
51
     * Constructor
52
     *
53
     * @param \Magento\Backend\Block\Widget\Context     $context
54
     * @param \Payone\Core\Model\Entities\ApiLogFactory $apiLogFactory
55
     * @param array                                     $data
56
     */
57
    public function __construct(
58
        \Magento\Backend\Block\Widget\Context $context,
59
        \Payone\Core\Model\Entities\ApiLogFactory $apiLogFactory,
60
        array $data = []
61
    ) {
62
        parent::__construct($context, $data);
63
        $this->apiLogFactory = $apiLogFactory;
64
    }
65
66
    /**
67
     * Returns the currently requested ApiLog-object
68
     *
69
     * @return ApiLog
70
     */
71
    public function getApiLogEntry()
72
    {
73
        if ($this->oApiLog === null) {
74
            $oApiLog = $this->apiLogFactory->create();
75
            $oApiLog->load($this->getRequest()->getParam('id'));
76
            $this->oApiLog = $oApiLog;
77
        }
78
        return $this->oApiLog;
79
    }
80
81
    /**
82
     * Adding the Back button
83
     *
84
     * @return void
85
     */
86
    protected function _construct()
87
    {
88
        $this->buttonList->add(
89
            'back',
90
            [
91
                'label' => __('Back'),
92
                'onclick' => "setLocation('".$this->getUrl('payone/protocol_api/')."')",
93
                'class' => 'back'
94
            ]
95
        );
96
        parent::_construct();
97
    }
98
}
99

Block/Adminhtml/Protocol/Transactionstatus/View.php 1 location

@@ 34-98 (lines=65) @@
31
/**
32
 * Class for TransactionStatus grid block
33
 */
34
class View extends \Magento\Backend\Block\Widget\Container
35
{
36
    /**
37
     * Requested TransactionStatus-entry
38
     *
39
     * @var TransactionStatus
40
     */
41
    protected $oTransactionStatus = null;
42
43
    /**
44
     * TransactionStatus factory
45
     *
46
     * @var \Payone\Core\Model\Entities\TransactionStatusFactory
47
     */
48
    protected $statusFactory;
49
50
    /**
51
     *
52
     * @param \Magento\Backend\Block\Widget\Context                $context
53
     * @param \Payone\Core\Model\Entities\TransactionStatusFactory $statusFactory
54
     * @param array                                                $data
55
     */
56
    public function __construct(
57
        \Magento\Backend\Block\Widget\Context $context,
58
        \Payone\Core\Model\Entities\TransactionStatusFactory $statusFactory,
59
        array $data = []
60
    ) {
61
        parent::__construct($context, $data);
62
        $this->statusFactory = $statusFactory;
63
    }
64
65
    /**
66
     * Get current transaction status object
67
     *
68
     * @return TransactionStatus
69
     */
70
    public function getTransactionStatusEntry()
71
    {
72
        if ($this->oTransactionStatus === null) {
73
            $oTransactionStatus = $this->statusFactory->create();
74
            $oTransactionStatus->load($this->getRequest()->getParam('id'));
75
            $this->oTransactionStatus = $oTransactionStatus;
76
        }
77
        return $this->oTransactionStatus;
78
    }
79
80
    /**
81
     * Initialization method
82
     *
83
     * @return void
84
     */
85
    protected function _construct()
86
    {
87
        $this->buttonList->add(
88
            'back',
89
            [
90
                'label' => __('Back'),
91
                'onclick' => "setLocation('".$this->getUrl('payone/protocol_transactionstatus/')."')",
92
                'class' => 'back'
93
            ]
94
        );
95
        parent::_construct();
96
    }
97
}
98