Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 538-552 (lines=15) @@
535
     * @throws \UnexpectedValueException If collation not allowed for type
536
     * @return $this
537
     */
538
    public function setCollation($collation)
539
    {
540
        $allowedTypes = [
541
            AdapterInterface::PHINX_TYPE_CHAR,
542
            AdapterInterface::PHINX_TYPE_STRING,
543
            AdapterInterface::PHINX_TYPE_TEXT,
544
        ];
545
        if (!in_array($this->getType(), $allowedTypes)) {
546
            throw new \UnexpectedValueException('Collation may be set only for types: ' . implode(', ', $allowedTypes));
547
        }
548
549
        $this->collation = $collation;
550
551
        return $this;
552
    }
553
554
    /**
555
     * Gets the column collation.
@@ 572-586 (lines=15) @@
569
     * @throws \UnexpectedValueException If character set not allowed for type
570
     * @return $this
571
     */
572
    public function setEncoding($encoding)
573
    {
574
        $allowedTypes = [
575
            AdapterInterface::PHINX_TYPE_CHAR,
576
            AdapterInterface::PHINX_TYPE_STRING,
577
            AdapterInterface::PHINX_TYPE_TEXT,
578
        ];
579
        if (!in_array($this->getType(), $allowedTypes)) {
580
            throw new \UnexpectedValueException('Character set may be set only for types: ' . implode(', ', $allowedTypes));
581
        }
582
583
        $this->encoding = $encoding;
584
585
        return $this;
586
    }
587
588
    /**
589
     * Gets the column character set.