Conditions | 6 |
Paths | 8 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | protected function getIndexBase($indexUid): string |
||
38 | { |
||
39 | $indexRepository = HelperUtility::create(IndexRepository::class); |
||
40 | $index = $indexRepository->findByUid((int) $indexUid); |
||
41 | if (!($index instanceof Index)) { |
||
42 | return 'idx-' . $indexUid; |
||
43 | } |
||
44 | |||
45 | $originalObject = $index->getOriginalObject(); |
||
46 | if (!($originalObject instanceof SpeakingUrlInterface)) { |
||
47 | return 'idx-' . $indexUid; |
||
48 | } |
||
49 | |||
50 | $base = $originalObject->getRealUrlAliasBase(); |
||
51 | if (!(bool) ConfigurationUtility::get('disableDateInSpeakingUrl')) { |
||
52 | $datePart = $index->isAllDay() ? 'Y-m-d' : 'Y-m-d-h-i'; |
||
53 | $base .= '-' . $index->getStartDateComplete() |
||
54 | ->format($datePart); |
||
55 | } |
||
56 | |||
57 | if ((bool) ConfigurationUtility::get('addIndexInSpeakingUrl')) { |
||
58 | $base .= '-' . $indexUid; |
||
59 | } |
||
60 | |||
61 | return (string) $base; |
||
62 | } |
||
63 | } |
||
64 |