| @@ 593-607 (lines=15) @@ | ||
| 590 | * @throws \UnexpectedValueException If collation not allowed for type | |
| 591 | * @return $this | |
| 592 | */ | |
| 593 | public function setCollation($collation) | |
| 594 |     { | |
| 595 | $allowedTypes = [ | |
| 596 | AdapterInterface::PHINX_TYPE_CHAR, | |
| 597 | AdapterInterface::PHINX_TYPE_STRING, | |
| 598 | AdapterInterface::PHINX_TYPE_TEXT, | |
| 599 | ]; | |
| 600 |         if (!in_array($this->getType(), $allowedTypes)) { | |
| 601 |             throw new \UnexpectedValueException('Collation may be set only for types: ' . implode(', ', $allowedTypes)); | |
| 602 | } | |
| 603 | ||
| 604 | $this->collation = $collation; | |
| 605 | ||
| 606 | return $this; | |
| 607 | } | |
| 608 | ||
| 609 | /** | |
| 610 | * Gets the column collation. | |
| @@ 627-641 (lines=15) @@ | ||
| 624 | * @throws \UnexpectedValueException If character set not allowed for type | |
| 625 | * @return $this | |
| 626 | */ | |
| 627 | public function setEncoding($encoding) | |
| 628 |     { | |
| 629 | $allowedTypes = [ | |
| 630 | AdapterInterface::PHINX_TYPE_CHAR, | |
| 631 | AdapterInterface::PHINX_TYPE_STRING, | |
| 632 | AdapterInterface::PHINX_TYPE_TEXT, | |
| 633 | ]; | |
| 634 |         if (!in_array($this->getType(), $allowedTypes)) { | |
| 635 |             throw new \UnexpectedValueException('Character set may be set only for types: ' . implode(', ', $allowedTypes)); | |
| 636 | } | |
| 637 | ||
| 638 | $this->encoding = $encoding; | |
| 639 | ||
| 640 | return $this; | |
| 641 | } | |
| 642 | ||
| 643 | /** | |
| 644 | * Gets the column character set. | |