| Total Complexity | 10 |
| Total Lines | 82 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class IndexColumn |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var Migration |
||
| 11 | */ |
||
| 12 | public $migrate; |
||
| 13 | protected $_unique; |
||
| 14 | protected $_name; |
||
| 15 | protected $_columns; |
||
| 16 | protected $_table; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param $migrate |
||
| 20 | * @return $this |
||
| 21 | */ |
||
| 22 | public function setMigrate($migrate) |
||
| 23 | { |
||
| 24 | $this->migrate = $migrate; |
||
| 25 | return $this; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param bool $value |
||
| 30 | * @return $this |
||
| 31 | */ |
||
| 32 | public function unique($value = true) |
||
| 33 | { |
||
| 34 | $this->_unique = $value; |
||
| 35 | return $this; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param $name |
||
| 40 | * @return $this |
||
| 41 | */ |
||
| 42 | public function name($name) |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param array $columns |
||
| 50 | * @return IndexColumn |
||
| 51 | */ |
||
| 52 | public function columns($columns) |
||
| 53 | { |
||
| 54 | $this->_columns = $columns; |
||
| 55 | return $this; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @param $table |
||
| 60 | * @return $this |
||
| 61 | */ |
||
| 62 | public function table($table) |
||
| 63 | { |
||
| 64 | $this->_table = $table; |
||
| 65 | return $this; |
||
| 66 | } |
||
| 67 | |||
| 68 | public function formIndexName() |
||
| 79 | } |
||
| 80 | |||
| 81 | public function apply() |
||
| 82 | { |
||
| 83 | $this->migrate->createIndex($this->formIndexName(), $this->_table, $this->_columns, $this->_unique); |
||
| 84 | } |
||
| 85 | |||
| 86 | public function remove() |
||
| 89 | } |
||
| 90 | } |