Code Duplication    Length = 19-19 lines in 3 locations

src/PhpSpreadsheet/Style/Border.php 1 location

@@ 184-202 (lines=19) @@
181
     *
182
     * @return Border
183
     */
184
    public function applyFromArray($pStyles = null)
185
    {
186
        if (is_array($pStyles)) {
187
            if ($this->isSupervisor) {
188
                $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
189
            } else {
190
                if (isset($pStyles['style'])) {
191
                    $this->setBorderStyle($pStyles['style']);
192
                }
193
                if (isset($pStyles['color'])) {
194
                    $this->getColor()->applyFromArray($pStyles['color']);
195
                }
196
            }
197
        } else {
198
            throw new \PhpOffice\PhpSpreadsheet\Exception('Invalid style array passed.');
199
        }
200
201
        return $this;
202
    }
203
204
    /**
205
     * Get Border style.

src/PhpSpreadsheet/Style/Color.php 1 location

@@ 155-173 (lines=19) @@
152
     *
153
     * @return Color
154
     */
155
    public function applyFromArray($pStyles = null)
156
    {
157
        if (is_array($pStyles)) {
158
            if ($this->isSupervisor) {
159
                $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
160
            } else {
161
                if (isset($pStyles['rgb'])) {
162
                    $this->setRGB($pStyles['rgb']);
163
                }
164
                if (isset($pStyles['argb'])) {
165
                    $this->setARGB($pStyles['argb']);
166
                }
167
            }
168
        } else {
169
            throw new \PhpOffice\PhpSpreadsheet\Exception('Invalid style array passed.');
170
        }
171
172
        return $this;
173
    }
174
175
    /**
176
     * Get ARGB.

src/PhpSpreadsheet/Style/Protection.php 1 location

@@ 111-129 (lines=19) @@
108
     *
109
     * @return Protection
110
     */
111
    public function applyFromArray($pStyles = null)
112
    {
113
        if (is_array($pStyles)) {
114
            if ($this->isSupervisor) {
115
                $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
116
            } else {
117
                if (isset($pStyles['locked'])) {
118
                    $this->setLocked($pStyles['locked']);
119
                }
120
                if (isset($pStyles['hidden'])) {
121
                    $this->setHidden($pStyles['hidden']);
122
                }
123
            }
124
        } else {
125
            throw new \PhpOffice\PhpSpreadsheet\Exception('Invalid style array passed.');
126
        }
127
128
        return $this;
129
    }
130
131
    /**
132
     * Get locked.