Code Duplication    Length = 10-10 lines in 14 locations

src/Form/Tools.php 3 locations

@@ 83-92 (lines=10) @@
80
     *
81
     * @return $this
82
     */
83
    public function disableList(bool $disable = true)
84
    {
85
        if ($disable) {
86
            array_delete($this->tools, 'list');
87
        } elseif (!in_array('list', $this->tools)) {
88
            array_push($this->tools, 'list');
89
        }
90
91
        return $this;
92
    }
93
94
    /**
95
     * Disable `delete` tool.
@@ 99-108 (lines=10) @@
96
     *
97
     * @return $this
98
     */
99
    public function disableDelete(bool $disable = true)
100
    {
101
        if ($disable) {
102
            array_delete($this->tools, 'delete');
103
        } elseif (!in_array('delete', $this->tools)) {
104
            array_push($this->tools, 'delete');
105
        }
106
107
        return $this;
108
    }
109
110
    /**
111
     * Disable `edit` tool.
@@ 115-124 (lines=10) @@
112
     *
113
     * @return $this
114
     */
115
    public function disableView(bool $disable = true)
116
    {
117
        if ($disable) {
118
            array_delete($this->tools, 'view');
119
        } elseif (!in_array('view', $this->tools)) {
120
            array_push($this->tools, 'view');
121
        }
122
123
        return $this;
124
    }
125
126
    /**
127
     * Get request path for resource list.

src/Show/Tools.php 3 locations

@@ 105-114 (lines=10) @@
102
     *
103
     * @return $this
104
     */
105
    public function disableList(bool $disable = true)
106
    {
107
        if ($disable) {
108
            array_delete($this->tools, 'list');
109
        } elseif (!in_array('list', $this->tools)) {
110
            array_push($this->tools, 'list');
111
        }
112
113
        return $this;
114
    }
115
116
    /**
117
     * Disable `delete` tool.
@@ 121-130 (lines=10) @@
118
     *
119
     * @return $this
120
     */
121
    public function disableDelete(bool $disable = true)
122
    {
123
        if ($disable) {
124
            array_delete($this->tools, 'delete');
125
        } elseif (!in_array('delete', $this->tools)) {
126
            array_push($this->tools, 'delete');
127
        }
128
129
        return $this;
130
    }
131
132
    /**
133
     * Disable `edit` tool.
@@ 137-146 (lines=10) @@
134
     *
135
     * @return $this
136
     */
137
    public function disableEdit(bool $disable = true)
138
    {
139
        if ($disable) {
140
            array_delete($this->tools, 'edit');
141
        } elseif (!in_array('edit', $this->tools)) {
142
            array_push($this->tools, 'edit');
143
        }
144
145
        return $this;
146
    }
147
148
    /**
149
     * Get request path for resource list.

src/Form/Footer.php 5 locations

@@ 58-67 (lines=10) @@
55
     *
56
     * @return $this
57
     */
58
    public function disableReset(bool $disable = true)
59
    {
60
        if ($disable) {
61
            array_delete($this->buttons, 'reset');
62
        } elseif (!in_array('reset', $this->buttons)) {
63
            array_push($this->buttons, 'reset');
64
        }
65
66
        return $this;
67
    }
68
69
    /**
70
     * Disable submit button.
@@ 74-83 (lines=10) @@
71
     *
72
     * @return $this
73
     */
74
    public function disableSubmit(bool $disable = true)
75
    {
76
        if ($disable) {
77
            array_delete($this->buttons, 'submit');
78
        } elseif (!in_array('submit', $this->buttons)) {
79
            array_push($this->buttons, 'submit');
80
        }
81
82
        return $this;
83
    }
84
85
    /**
86
     * Disable View Checkbox.
@@ 90-99 (lines=10) @@
87
     *
88
     * @return $this
89
     */
90
    public function disableViewCheck(bool $disable = true)
91
    {
92
        if ($disable) {
93
            array_delete($this->checkboxes, 'view');
94
        } elseif (!in_array('view', $this->checkboxes)) {
95
            array_push($this->checkboxes, 'view');
96
        }
97
98
        return $this;
99
    }
100
101
    /**
102
     * Disable Editing Checkbox.
@@ 106-115 (lines=10) @@
103
     *
104
     * @return $this
105
     */
106
    public function disableEditingCheck(bool $disable = true)
107
    {
108
        if ($disable) {
109
            array_delete($this->checkboxes, 'continue_editing');
110
        } elseif (!in_array('continue_editing', $this->checkboxes)) {
111
            array_push($this->checkboxes, 'continue_editing');
112
        }
113
114
        return $this;
115
    }
116
117
    /**
118
     * Disable Creating Checkbox.
@@ 122-131 (lines=10) @@
119
     *
120
     * @return $this
121
     */
122
    public function disableCreatingCheck(bool $disable = true)
123
    {
124
        if ($disable) {
125
            array_delete($this->checkboxes, 'continue_creating');
126
        } elseif (!in_array('continue_creating', $this->checkboxes)) {
127
            array_push($this->checkboxes, 'continue_creating');
128
        }
129
130
        return $this;
131
    }
132
133
    /**
134
     * Set `view` as default check.

src/Grid/Displayers/Actions.php 3 locations

@@ 88-97 (lines=10) @@
85
     *
86
     * @return $this
87
     */
88
    public function disableView(bool $disable = true)
89
    {
90
        if ($disable) {
91
            array_delete($this->actions, 'view');
92
        } elseif (!in_array('view', $this->actions)) {
93
            array_push($this->actions, 'view');
94
        }
95
96
        return $this;
97
    }
98
99
    /**
100
     * Disable delete.
@@ 104-113 (lines=10) @@
101
     *
102
     * @return $this.
103
     */
104
    public function disableDelete(bool $disable = true)
105
    {
106
        if ($disable) {
107
            array_delete($this->actions, 'delete');
108
        } elseif (!in_array('delete', $this->actions)) {
109
            array_push($this->actions, 'delete');
110
        }
111
112
        return $this;
113
    }
114
115
    /**
116
     * Disable edit.
@@ 120-129 (lines=10) @@
117
     *
118
     * @return $this.
119
     */
120
    public function disableEdit(bool $disable = true)
121
    {
122
        if ($disable) {
123
            array_delete($this->actions, 'edit');
124
        } elseif (!in_array('edit', $this->actions)) {
125
            array_push($this->actions, 'edit');
126
        }
127
128
        return $this;
129
    }
130
131
    /**
132
     * Disable all actions.