Code Duplication    Length = 11-11 lines in 4 locations

src/AdminActions.php 4 locations

@@ 30-40 (lines=11) @@
27
     * @param CBitrixComponentTemplate $template
28
     * @param $element
29
     */
30
    public static function editIBlockElement($template, $element)
31
    {
32
        if (!$element["IBLOCK_ID"] || !$element['ID']) {
33
            throw new InvalidArgumentException('Element must include ID and IBLOCK_ID');
34
        }
35
36
        $buttons = static::getIBlockElementPanelButtons($element);
37
        $link = $buttons["edit"]["edit_element"]["ACTION_URL"];
38
39
        $template->AddEditAction('iblock_element_' . $element['ID'], $link, CIBlock::GetArrayByID($element["IBLOCK_ID"], "ELEMENT_EDIT"));
40
    }
41
    
42
    /**
43
     * @param CBitrixComponentTemplate $template
@@ 47-57 (lines=11) @@
44
     * @param $element
45
     * @param string $confirm
46
     */
47
    public static function deleteIBlockElement($template, $element, $confirm = 'Вы уверены что хотите удалить элемент?')
48
    {
49
        if (!$element["IBLOCK_ID"] || !$element['ID']) {
50
            throw new InvalidArgumentException('Element must include ID and IBLOCK_ID');
51
        }
52
    
53
        $buttons = static::getIBlockElementPanelButtons($element);
54
        $link = $buttons["edit"]["delete_element"]["ACTION_URL"];
55
56
        $template->AddDeleteAction('iblock_element_' . $element['ID'], $link, CIBlock::GetArrayByID($element["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => $confirm));
57
    }
58
59
    /**
60
     * @param CBitrixComponentTemplate $template
@@ 63-73 (lines=11) @@
60
     * @param CBitrixComponentTemplate $template
61
     * @param $section
62
     */
63
    public static function editIBlockSection($template, $section)
64
    {
65
        if (!$section["IBLOCK_ID"] || !$section['ID']) {
66
            throw new InvalidArgumentException('Section must include ID and IBLOCK_ID');
67
        }
68
    
69
        $buttons = static::getIBlockSectionPanelButtons($section);
70
        $link = $buttons["edit"]["edit_section"]["ACTION_URL"];
71
72
        $template->AddEditAction('iblock_section_' . $section['ID'], $link, CIBlock::GetArrayByID($section["IBLOCK_ID"], "SECTION_EDIT"));
73
    }
74
75
    /**
76
     * @param CBitrixComponentTemplate $template
@@ 80-90 (lines=11) @@
77
     * @param $section
78
     * @param string $confirm
79
     */
80
    public static function deleteIBlockSection($template, $section, $confirm = 'Вы уверены что хотите удалить раздел?')
81
    {
82
        if (!$section["IBLOCK_ID"] || !$section['ID']) {
83
            throw new InvalidArgumentException('Section must include ID and IBLOCK_ID');
84
        }
85
    
86
        $buttons = static::getIBlockSectionPanelButtons($section);
87
        $link = $buttons["edit"]["delete_section"]["ACTION_URL"];
88
89
        $template->AddDeleteAction('iblock_section_' . $section['ID'], $link, CIBlock::GetArrayByID($section["IBLOCK_ID"], "SECTION_DELETE"), array("CONFIRM" => $confirm));
90
    }
91
    
92
    /**
93
     * @param CBitrixComponentTemplate $template