File tree Expand file tree Collapse file tree 3 files changed +60
-2
lines changed
Expand file tree Collapse file tree 3 files changed +60
-2
lines changed Original file line number Diff line number Diff line change 66 ],
77 "psr-4" : {
88 "Themeum\\ TutorLMSMigrationTool\\ " : " inc/"
9- }
9+ },
10+ "files" : [
11+ " inc/Functions.php"
12+ ]
1013 },
1114 "authors" : [
1215 {
Original file line number Diff line number Diff line change 88 * @since 2.3.0
99 */
1010
11- namespace Themeum \TutorLMSMigrationTool ;
11+ namespace Themeum \TutorLMSMigrationTool \ Factories ;
1212
1313use InvalidArgumentException ;
14+ use Themeum \TutorLMSMigrationTool \ContentTypes ;
1415use Themeum \TutorLMSMigrationTool \Interfaces \PostMeta ;
1516use Themeum \TutorLMSMigrationTool \LDMigration \PostMeta \CourseMeta ;
17+ use Themeum \TutorLMSMigrationTool \MigrationTypes ;
1618
1719/**
1820 * Create the post meta objects based on migration type and meta type
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Helper functions
4+ *
5+ * Facades of complex logics
6+ *
7+ * @package TutorLMSMigrationTool
8+ * @author Themeum <support@themeum.com>
9+ * @link https://themeum.com
10+ * @since 2.3.0
11+ */
12+
13+ use Themeum \TutorLMSMigrationTool \Factories \PostMetaFactory ;
14+
15+ if ( ! function_exists ( 'tlmt_has_tutor_pro ' ) ) {
16+ /**
17+ * Check whether tutor pro is installed or not
18+ *
19+ * @since 2.3.0
20+ *
21+ * @return bool
22+ */
23+ function tlmt_has_tutor_pro () {
24+ return function_exists ( 'tutor_pro ' );
25+ }
26+ }
27+
28+ if ( ! function_exists ( 'get_meta_obj ' ) ) {
29+ /**
30+ * Check whether tutor pro is installed or not
31+ *
32+ * @since 2.3.0
33+ *
34+ * @param string $meta_type Meta type like: course, lesson, etc.
35+ * @param string $migration_type Migration type like: ld_to_tutor.
36+ *
37+ * @see MigrationTypes & ContentTypes class
38+ *
39+ * @throws \Throwable If the migration type is not supported.
40+ *
41+ * @return PostMeta object
42+ */
43+ function get_meta_obj ( $ meta_type , $ migration_type ) {
44+ try {
45+ $ obj = PostMetaFactory::create ( $ meta_type , $ migration_type );
46+ return $ obj ;
47+ } catch ( \Throwable $ th ) {
48+ throw $ th ;
49+ }
50+ }
51+ }
52+
53+
You can’t perform that action at this time.
0 commit comments