1 | <?php |
||
12 | class Index |
||
13 | { |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | public const UNIQUE = 'unique'; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | public const INDEX = 'index'; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | public const FULLTEXT = 'fulltext'; |
||
28 | |||
29 | /** |
||
30 | * @var string[] |
||
31 | */ |
||
32 | protected $columns; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $type = self::INDEX; |
||
38 | |||
39 | /** |
||
40 | * @var string|null |
||
41 | */ |
||
42 | protected $name; |
||
43 | |||
44 | /** |
||
45 | * @var int|array|null |
||
46 | */ |
||
47 | protected $limit; |
||
48 | |||
49 | /** |
||
50 | * @var string[] |
||
51 | */ |
||
52 | protected $order; |
||
53 | |||
54 | /** |
||
55 | * Sets the index columns. |
||
56 | * |
||
57 | * @param string[] $columns Columns |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function setColumns($columns) |
||
66 | |||
67 | /** |
||
68 | * Gets the index columns. |
||
69 | * |
||
70 | * @return string[] |
||
71 | */ |
||
72 | public function getColumns() |
||
76 | 30 | ||
77 | 30 | /** |
|
78 | * Sets the index type. |
||
79 | * |
||
80 | * @param string $type Type |
||
81 | * @return $this |
||
82 | */ |
||
83 | public function setType($type) |
||
89 | |||
90 | /** |
||
91 | * Gets the index type. |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getType() |
||
99 | 12 | ||
100 | /** |
||
101 | * Sets the index name. |
||
102 | * |
||
103 | * @param string $name Name |
||
104 | * @return $this |
||
105 | */ |
||
106 | public function setName($name) |
||
112 | |||
113 | /** |
||
114 | * Gets the index name. |
||
115 | * |
||
116 | * @return string|null |
||
117 | */ |
||
118 | 10 | public function getName() |
|
122 | |||
123 | /** |
||
124 | * Sets the index limit. |
||
125 | * |
||
126 | * @param int|array $limit limit value or array of limit value |
||
127 | * @return $this |
||
128 | */ |
||
129 | 30 | public function setLimit($limit) |
|
135 | |||
136 | /** |
||
137 | * Gets the index limit. |
||
138 | * |
||
139 | * @return int|array |
||
140 | 1 | */ |
|
141 | public function getLimit() |
||
145 | |||
146 | /** |
||
147 | * Sets the index limit. |
||
148 | * |
||
149 | * @param string[] $order column name sort order key value pair |
||
150 | * @return $this |
||
151 | 15 | */ |
|
152 | public function setOrder($order) |
||
158 | |||
159 | /** |
||
160 | * Gets the index columns sort order. |
||
161 | * |
||
162 | * @return string[] |
||
163 | 29 | */ |
|
164 | public function getOrder() |
||
168 | 20 | ||
169 | 1 | /** |
|
170 | * Utility method that maps an array of index options to this objects methods. |
||
171 | * |
||
172 | * @param array $options Options |
||
173 | 19 | * @throws \RuntimeException |
|
174 | 9 | * @return $this |
|
175 | 9 | */ |
|
176 | 9 | public function setOptions($options) |
|
199 | } |
||
200 |