| Total Complexity | 14 |
| Total Lines | 111 |
| 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) |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @param $table |
||
| 60 | * @return $this |
||
| 61 | */ |
||
| 62 | public function table($table) |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @return mixed |
||
| 70 | */ |
||
| 71 | public function getTable() |
||
| 72 | { |
||
| 73 | return $this->_table; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return mixed |
||
| 78 | */ |
||
| 79 | public function getColumns() |
||
| 80 | { |
||
| 81 | return $this->_columns; |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @return mixed |
||
| 86 | */ |
||
| 87 | public function getUnique() |
||
| 88 | { |
||
| 89 | return $this->_unique; |
||
| 90 | } |
||
| 91 | |||
| 92 | public function formIndexName() |
||
| 103 | } |
||
| 104 | |||
| 105 | public function apply() |
||
| 106 | { |
||
| 107 | $this->migrate->createIndex($this->formIndexName(), $this->_table, $this->_columns, $this->_unique); |
||
| 108 | } |
||
| 109 | |||
| 110 | public function remove() |
||
| 111 | { |
||
| 112 | $this->migrate->dropIndex($this->formIndexName(), $this->_table); |
||
| 113 | } |
||
| 114 | |||
| 115 | public function getName() |
||
| 118 | } |
||
| 119 | } |