| @@ 118-130 (lines=13) @@ | ||
| 115 | * @return TableAnalysis | |
| 116 | * @throws \EE_Error | |
| 117 | */ | |
| 118 | protected function _get_table_analysis() | |
| 119 |     { | |
| 120 |         if ($this->_table_analysis instanceof TableAnalysis) { | |
| 121 | return $this->_table_analysis; | |
| 122 |         } else { | |
| 123 | throw new \EE_Error( | |
| 124 | sprintf( | |
| 125 |                     __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), | |
| 126 | get_class($this) | |
| 127 | ) | |
| 128 | ); | |
| 129 | } | |
| 130 | } | |
| 131 | ||
| 132 | ||
| 133 | /** | |
| @@ 83-97 (lines=15) @@ | ||
| 80 | * @throws EE_Error | |
| 81 | * @return string | |
| 82 | */ | |
| 83 | public function pretty_name() | |
| 84 |     { | |
| 85 |         if ($this->_pretty_name === null) { | |
| 86 | throw new EE_Error( | |
| 87 | sprintf( | |
| 88 | __( | |
| 89 | "Please give a pretty name to the migration script stage %s by assigning the property _pretty_name in the constructor", | |
| 90 | "event_espresso" | |
| 91 | ), | |
| 92 | get_class($this) | |
| 93 | ) | |
| 94 | ); | |
| 95 | } | |
| 96 | return $this->_pretty_name; | |
| 97 | } | |
| 98 | ||
| 99 | /** | |
| 100 | * | |
| @@ 132-146 (lines=15) @@ | ||
| 129 | * @return string one of EE_Data_Migration_Manager::status_* constants | |
| 130 | * @throws EE_Error | |
| 131 | */ | |
| 132 | public function get_status() | |
| 133 |     { | |
| 134 |         if ($this->_status === null) { | |
| 135 | throw new EE_Error( | |
| 136 | sprintf( | |
| 137 | __( | |
| 138 | "Trying to get status of Migration class %s, but it has not been initialized yet. It should be set in the constructor.", | |
| 139 | "event_espresso" | |
| 140 | ), | |
| 141 | get_class($this) | |
| 142 | ) | |
| 143 | ); | |
| 144 | } | |
| 145 | return $this->_status; | |
| 146 | } | |
| 147 | ||
| 148 | /** | |
| 149 | * | |
| @@ 389-401 (lines=13) @@ | ||
| 386 | * @return TableManager | |
| 387 | * @throws EE_Error | |
| 388 | */ | |
| 389 | protected function _get_table_manager() | |
| 390 |     { | |
| 391 |         if ($this->_table_manager instanceof TableManager) { | |
| 392 | return $this->_table_manager; | |
| 393 |         } else { | |
| 394 | throw new EE_Error( | |
| 395 | sprintf( | |
| 396 |                     __('Table manager on migration class %1$s is not set properly.', 'event_espresso'), | |
| 397 | get_class($this) | |
| 398 | ) | |
| 399 | ); | |
| 400 | } | |
| 401 | } | |
| 402 | ||
| 403 | /** | |
| 404 | * Gets the injected table analyzer, or throws an exception | |
| @@ 409-421 (lines=13) @@ | ||
| 406 | * @return TableAnalysis | |
| 407 | * @throws EE_Error | |
| 408 | */ | |
| 409 | protected function _get_table_analysis() | |
| 410 |     { | |
| 411 |         if ($this->_table_analysis instanceof TableAnalysis) { | |
| 412 | return $this->_table_analysis; | |
| 413 |         } else { | |
| 414 | throw new EE_Error( | |
| 415 | sprintf( | |
| 416 |                     __('Table analysis class on migration class %1$s is not set properly.', 'event_espresso'), | |
| 417 | get_class($this) | |
| 418 | ) | |
| 419 | ); | |
| 420 | } | |
| 421 | } | |
| 422 | } | |
| 423 | ||
| @@ 166-176 (lines=11) @@ | ||
| 163 | * @throws \EE_Error | |
| 164 | * @return string | |
| 165 | */ | |
| 166 | public function get_name() | |
| 167 |     { | |
| 168 |         if ($this->_name) { | |
| 169 | return $this->_name; | |
| 170 |         } else { | |
| 171 | throw new EE_Error(sprintf(__( | |
| 172 | "Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", | |
| 173 | "event_espresso" | |
| 174 | ), get_class($this))); | |
| 175 | } | |
| 176 | } | |
| 177 | ||
| 178 | public function get_nicename() | |
| 179 |     { | |
| @@ 66-72 (lines=7) @@ | ||
| 63 | * @throws EE_Error | |
| 64 | * @return EEM_Base | EEM_Soft_Delete_Base | |
| 65 | */ | |
| 66 | public function model() | |
| 67 |     { | |
| 68 |         if (! $this->_model instanceof EEM_Base) { | |
| 69 |             throw new EE_Error(sprintf(__('Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso'), get_class($this))); | |
| 70 | } | |
| 71 | return $this->_model; | |
| 72 | } | |
| 73 | ||
| 74 | /** | |
| 75 | * Returns the action this restriction generator will generate restrictions for. | |
| @@ 81-87 (lines=7) @@ | ||
| 78 | * @throws EE_Error | |
| 79 | * @return string | |
| 80 | */ | |
| 81 | public function action() | |
| 82 |     { | |
| 83 |         if (! $this->_action) { | |
| 84 |             throw new EE_Error(sprintf(__('Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso'), get_class($this))); | |
| 85 | } | |
| 86 | return $this->_action; | |
| 87 | } | |
| 88 | ||
| 89 | /** | |
| 90 | * Returns whether or not _construct_finalize() has been called on this restriction generator object | |
| @@ 1236-1248 (lines=13) @@ | ||
| 1233 | * @return TableAnalysis | |
| 1234 | * @throws EE_Error | |
| 1235 | */ | |
| 1236 | protected function _get_table_analysis() | |
| 1237 |     { | |
| 1238 |         if ($this->_table_analysis instanceof TableAnalysis) { | |
| 1239 | return $this->_table_analysis; | |
| 1240 |         } else { | |
| 1241 | throw new EE_Error( | |
| 1242 | sprintf( | |
| 1243 |                     __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), | |
| 1244 | get_class($this) | |
| 1245 | ) | |
| 1246 | ); | |
| 1247 | } | |
| 1248 | } | |
| 1249 | ||
| 1250 | /** | |
| 1251 | * Gets the injected table manager, or throws an exception | |
| @@ 1256-1268 (lines=13) @@ | ||
| 1253 | * @return TableManager | |
| 1254 | * @throws EE_Error | |
| 1255 | */ | |
| 1256 | protected function _get_table_manager() | |
| 1257 |     { | |
| 1258 |         if ($this->_table_manager instanceof TableManager) { | |
| 1259 | return $this->_table_manager; | |
| 1260 |         } else { | |
| 1261 | throw new EE_Error( | |
| 1262 | sprintf( | |
| 1263 |                     __('Table manager class on class %1$s is not set properly.', 'event_espresso'), | |
| 1264 | get_class($this) | |
| 1265 | ) | |
| 1266 | ); | |
| 1267 | } | |
| 1268 | } | |
| 1269 | } | |
| 1270 | ||
| @@ 39-51 (lines=13) @@ | ||
| 36 | * @return TableAnalysis | |
| 37 | * @throws \EE_Error | |
| 38 | */ | |
| 39 | protected function getTableAnalysis() | |
| 40 |     { | |
| 41 |         if ($this->table_analysis instanceof TableAnalysis) { | |
| 42 | return $this->table_analysis; | |
| 43 |         } else { | |
| 44 | throw new \EE_Error( | |
| 45 | sprintf( | |
| 46 |                     __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), | |
| 47 | get_class($this) | |
| 48 | ) | |
| 49 | ); | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 | ||
| 54 | /** | |
| @@ 330-342 (lines=13) @@ | ||
| 327 | * @return TableAnalysis | |
| 328 | * @throws \EE_Error | |
| 329 | */ | |
| 330 | protected function _get_table_analysis() | |
| 331 |     { | |
| 332 |         if ($this->_table_analysis instanceof TableAnalysis) { | |
| 333 | return $this->_table_analysis; | |
| 334 |         } else { | |
| 335 | throw new \EE_Error( | |
| 336 | sprintf( | |
| 337 |                     __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), | |
| 338 | get_class($this) | |
| 339 | ) | |
| 340 | ); | |
| 341 | } | |
| 342 | } | |
| 343 | } | |
| 344 | ||
| 345 | ||