1 | <?php |
||
5 | class NameParser |
||
6 | { |
||
7 | /** |
||
8 | * The migration name. |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $name; |
||
13 | /** |
||
14 | * The array data. |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $data = []; |
||
19 | /** |
||
20 | * The available schema actions. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $actions = [ |
||
25 | 'create' => [ |
||
26 | 'create', |
||
27 | 'make', |
||
28 | ], |
||
29 | 'delete' => [ |
||
30 | 'delete', |
||
31 | 'remove', |
||
32 | ], |
||
33 | 'add' => [ |
||
34 | 'add', |
||
35 | 'update', |
||
36 | 'append', |
||
37 | 'insert', |
||
38 | ], |
||
39 | 'drop' => [ |
||
40 | 'destroy', |
||
41 | 'drop', |
||
42 | ], |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * The constructor. |
||
47 | * |
||
48 | * @param string $name |
||
49 | */ |
||
50 | public function __construct($name) |
||
55 | |||
56 | /** |
||
57 | * Fetch the migration name to an array data. |
||
58 | * |
||
59 | * @return array |
||
60 | */ |
||
61 | protected function fetchData() |
||
65 | |||
66 | /** |
||
67 | * Get original migration name. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function getOriginalName() |
||
75 | |||
76 | /** |
||
77 | * Get table name. |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | public function getTable() |
||
85 | |||
86 | /** |
||
87 | * Get the table will be used. |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getTableName() |
||
97 | |||
98 | /** |
||
99 | * Get matches data from regex. |
||
100 | * |
||
101 | * @return string[] |
||
102 | */ |
||
103 | public function getMatches() |
||
109 | |||
110 | /** |
||
111 | * Get name pattern. |
||
112 | * |
||
113 | * @return string |
||
114 | */ |
||
115 | public function getPattern() |
||
135 | |||
136 | /** |
||
137 | * Get schema type or action. |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getAction() |
||
145 | |||
146 | /** |
||
147 | * Get the array data. |
||
148 | * |
||
149 | * @return array |
||
150 | */ |
||
151 | public function getData() |
||
155 | |||
156 | /** |
||
157 | * Determine whether the given type is same with the current schema action or type. |
||
158 | * |
||
159 | * @param $type |
||
160 | * |
||
161 | * @return bool |
||
162 | */ |
||
163 | public function is($type) |
||
167 | |||
168 | /** |
||
169 | * Determine whether the current schema action is a adding action. |
||
170 | * |
||
171 | * @return bool |
||
172 | */ |
||
173 | public function isAdd() |
||
177 | |||
178 | /** |
||
179 | * Determine whether the current schema action is a deleting action. |
||
180 | * |
||
181 | * @return bool |
||
182 | */ |
||
183 | public function isDelete() |
||
187 | |||
188 | /** |
||
189 | * Determine whether the current schema action is a creating action. |
||
190 | * |
||
191 | * @return bool |
||
192 | */ |
||
193 | public function isCreate() |
||
197 | |||
198 | /** |
||
199 | * Determine whether the current schema action is a dropping action. |
||
200 | * |
||
201 | * @return bool |
||
202 | */ |
||
203 | public function isDrop() |
||
207 | } |
||
208 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.