Code Duplication    Length = 18-18 lines in 2 locations

src/CliMenuBuilder.php 2 locations

@@ 201-218 (lines=18) @@
198
        return $this;
199
    }
200
201
    public function setBackgroundColour($colour, string $fallback = null) : self
202
    {
203
        if (is_int($colour)) {
204
            if ($this->terminal->getColourSupport() < 256) {
205
                $colour = $fallback;
206
                Assertion::inArray($colour, MenuStyle::getAvailableColours());
207
            }
208
            if ($colour < 0 || $colour > 255) {
209
                throw new Exception("Invalid colour code");
210
            }
211
        } else {
212
            Assertion::inArray($colour, MenuStyle::getAvailableColours());
213
        }
214
215
        $this->style['bg'] = $colour;
216
217
        return $this;
218
    }
219
220
    public function setForegroundColour($colour, string $fallback = null) : self
221
    {
@@ 220-237 (lines=18) @@
217
        return $this;
218
    }
219
220
    public function setForegroundColour($colour, string $fallback = null) : self
221
    {
222
        if (is_int($colour)) {
223
            if ($this->terminal->getColourSupport() < 256) {
224
                $colour = $fallback;
225
                Assertion::inArray($colour, MenuStyle::getAvailableColours());
226
            }
227
            if ($colour < 0 || $colour > 255) {
228
                throw new Exception("Invalid colour code");
229
            }
230
        } else {
231
            Assertion::inArray($colour, MenuStyle::getAvailableColours());
232
        }
233
234
        $this->style['fg'] = $colour;
235
236
        return $this;
237
    }
238
239
    public function setWidth(int $width) : self
240
    {