Code Duplication    Length = 15-15 lines in 2 locations

src/Phinx/Db/Table/Column.php 2 locations

@@ 548-562 (lines=15) @@
545
     * @throws \UnexpectedValueException If collation not allowed for type
546
     * @return $this
547
     */
548
    public function setCollation($collation)
549
    {
550
        $allowedTypes = [
551
            AdapterInterface::PHINX_TYPE_CHAR,
552
            AdapterInterface::PHINX_TYPE_STRING,
553
            AdapterInterface::PHINX_TYPE_TEXT,
554
        ];
555
        if (!in_array($this->getType(), $allowedTypes)) {
556
            throw new \UnexpectedValueException('Collation may be set only for types: ' . implode(', ', $allowedTypes));
557
        }
558
559
        $this->collation = $collation;
560
561
        return $this;
562
    }
563
564
    /**
565
     * Gets the column collation.
@@ 582-596 (lines=15) @@
579
     * @throws \UnexpectedValueException If character set not allowed for type
580
     * @return $this
581
     */
582
    public function setEncoding($encoding)
583
    {
584
        $allowedTypes = [
585
            AdapterInterface::PHINX_TYPE_CHAR,
586
            AdapterInterface::PHINX_TYPE_STRING,
587
            AdapterInterface::PHINX_TYPE_TEXT,
588
        ];
589
        if (!in_array($this->getType(), $allowedTypes)) {
590
            throw new \UnexpectedValueException('Character set may be set only for types: ' . implode(', ', $allowedTypes));
591
        }
592
593
        $this->encoding = $encoding;
594
595
        return $this;
596
    }
597
598
    /**
599
     * Gets the column character set.