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