Complex classes like CalDavBackend often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use CalDavBackend, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
58 | class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport { |
||
59 | |||
60 | /** |
||
61 | * We need to specify a max date, because we need to stop *somewhere* |
||
62 | * |
||
63 | * On 32 bit system the maximum for a signed integer is 2147483647, so |
||
64 | * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results |
||
65 | * in 2038-01-19 to avoid problems when the date is converted |
||
66 | * to a unix timestamp. |
||
67 | */ |
||
68 | public const MAX_DATE = '2038-01-01'; |
||
69 | |||
70 | public const ACCESS_PUBLIC = 4; |
||
71 | public const CLASSIFICATION_PUBLIC = 0; |
||
72 | public const CLASSIFICATION_PRIVATE = 1; |
||
73 | public const CLASSIFICATION_CONFIDENTIAL = 2; |
||
74 | |||
75 | /** |
||
76 | * List of CalDAV properties, and how they map to database field names |
||
77 | * Add your own properties by simply adding on to this array. |
||
78 | * |
||
79 | * Note that only string-based properties are supported here. |
||
80 | * |
||
81 | * @var array |
||
82 | */ |
||
83 | public $propertyMap = [ |
||
84 | '{DAV:}displayname' => 'displayname', |
||
85 | '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description', |
||
86 | '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone', |
||
87 | '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
||
88 | '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
||
89 | ]; |
||
90 | |||
91 | /** |
||
92 | * List of subscription properties, and how they map to database field names. |
||
93 | * |
||
94 | * @var array |
||
95 | */ |
||
96 | public $subscriptionPropertyMap = [ |
||
97 | '{DAV:}displayname' => 'displayname', |
||
98 | '{http://apple.com/ns/ical/}refreshrate' => 'refreshrate', |
||
99 | '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
||
100 | '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor', |
||
101 | '{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos', |
||
102 | '{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms', |
||
103 | '{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments', |
||
104 | ]; |
||
105 | |||
106 | /** @var IDBConnection */ |
||
107 | private $db; |
||
108 | |||
109 | /** @var Backend */ |
||
110 | private $sharingBackend; |
||
111 | |||
112 | /** @var Principal */ |
||
113 | private $principalBackend; |
||
114 | |||
115 | /** @var ISecureRandom */ |
||
116 | private $random; |
||
117 | |||
118 | /** @var bool */ |
||
119 | private $legacyMode; |
||
120 | |||
121 | /** |
||
122 | * CalDavBackend constructor. |
||
123 | * |
||
124 | * @param IDBConnection $db |
||
125 | * @param Principal $principalBackend |
||
126 | * @param GroupPrincipalBackend $groupPrincipalBackend |
||
127 | * @param ISecureRandom $random |
||
128 | * @param bool $legacyMode |
||
129 | */ |
||
130 | public function __construct(IDBConnection $db, |
||
141 | |||
142 | /** |
||
143 | * Returns a list of calendars for a principal. |
||
144 | * |
||
145 | * Every project is an array with the following keys: |
||
146 | * * id, a unique id that will be used by other functions to modify the |
||
147 | * calendar. This can be the same as the uri or a database key. |
||
148 | * * uri, which the basename of the uri with which the calendar is |
||
149 | * accessed. |
||
150 | * * principaluri. The owner of the calendar. Almost always the same as |
||
151 | * principalUri passed to this method. |
||
152 | * |
||
153 | * Furthermore it can contain webdav properties in clark notation. A very |
||
154 | * common one is '{DAV:}displayname'. |
||
155 | * |
||
156 | * Many clients also require: |
||
157 | * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
||
158 | * For this property, you can just return an instance of |
||
159 | * Sabre\CalDAV\Property\SupportedCalendarComponentSet. |
||
160 | * |
||
161 | * If you return {http://sabredav.org/ns}read-only and set the value to 1, |
||
162 | * ACL will automatically be put in read-only mode. |
||
163 | * |
||
164 | * @param string $principalUri |
||
165 | * @return array |
||
166 | * @throws DAV\Exception |
||
167 | */ |
||
168 | public function getCalendarsForUser($principalUri) { |
||
268 | |||
269 | public function getUsersOwnCalendars($principalUri) { |
||
316 | |||
317 | /** |
||
318 | * @return array |
||
319 | */ |
||
320 | public function getPublicCalendars() { |
||
371 | |||
372 | /** |
||
373 | * @param string $uri |
||
374 | * @return array |
||
375 | * @throws NotFound |
||
376 | */ |
||
377 | public function getPublicCalendar($uri) { |
||
429 | |||
430 | /** |
||
431 | * @param string $principal |
||
432 | * @param string $uri |
||
433 | * @return array|null |
||
434 | */ |
||
435 | public function getCalendarByUri($principal, $uri) { |
||
479 | |||
480 | public function getCalendarById($calendarId) { |
||
523 | |||
524 | /** |
||
525 | * Creates a new calendar for a principal. |
||
526 | * |
||
527 | * If the creation was a success, an id must be returned that can be used to reference |
||
528 | * this calendar in other methods, such as updateCalendar. |
||
529 | * |
||
530 | * @param string $principalUri |
||
531 | * @param string $calendarUri |
||
532 | * @param array $properties (keys must be CalDAV properties not db names) |
||
533 | * @return int |
||
534 | * @throws DAV\Exception |
||
535 | */ |
||
536 | public function createCalendar($principalUri, $calendarUri, array $properties) { |
||
574 | |||
575 | /** |
||
576 | * Updates properties for a calendar. |
||
577 | * |
||
578 | * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
||
579 | * To do the actual updates, you must tell this object which properties |
||
580 | * you're going to process with the handle() method. |
||
581 | * |
||
582 | * Calling the handle method is like telling the PropPatch object "I |
||
583 | * promise I can handle updating this property". |
||
584 | * |
||
585 | * Read the PropPatch documentation for more info and examples. |
||
586 | * |
||
587 | * @param mixed $calendarId |
||
588 | * @param PropPatch $propPatch |
||
589 | * @return void |
||
590 | */ |
||
591 | public function updateCalendar($calendarId, PropPatch $propPatch) { |
||
622 | |||
623 | /** |
||
624 | * Delete a calendar and all it's objects |
||
625 | * |
||
626 | * @param mixed $calendarId |
||
627 | * @return void |
||
628 | */ |
||
629 | public function deleteCalendar($calendarId) { |
||
641 | |||
642 | /** |
||
643 | * Delete all of an user's shares |
||
644 | * |
||
645 | * @param string $principalUri |
||
646 | * @return void |
||
647 | */ |
||
648 | public function deleteAllSharesForUser($principalUri) { |
||
651 | |||
652 | /** |
||
653 | * Returns all calendar objects within a calendar. |
||
654 | * |
||
655 | * Every item contains an array with the following keys: |
||
656 | * * calendardata - The iCalendar-compatible calendar data |
||
657 | * * uri - a unique key which will be used to construct the uri. This can |
||
658 | * be any arbitrary string, but making sure it ends with '.ics' is a |
||
659 | * good idea. This is only the basename, or filename, not the full |
||
660 | * path. |
||
661 | * * lastmodified - a timestamp of the last modification time |
||
662 | * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: |
||
663 | * '"abcdef"') |
||
664 | * * size - The size of the calendar objects, in bytes. |
||
665 | * * component - optional, a string containing the type of object, such |
||
666 | * as 'vevent' or 'vtodo'. If specified, this will be used to populate |
||
667 | * the Content-Type header. |
||
668 | * |
||
669 | * Note that the etag is optional, but it's highly encouraged to return for |
||
670 | * speed reasons. |
||
671 | * |
||
672 | * The calendardata is also optional. If it's not returned |
||
673 | * 'getCalendarObject' will be called later, which *is* expected to return |
||
674 | * calendardata. |
||
675 | * |
||
676 | * If neither etag or size are specified, the calendardata will be |
||
677 | * used/fetched to determine these numbers. If both are specified the |
||
678 | * amount of times this is needed is reduced by a great degree. |
||
679 | * |
||
680 | * @param mixed $calendarId |
||
681 | * @return array |
||
682 | */ |
||
683 | public function getCalendarObjects($calendarId) { |
||
706 | |||
707 | /** |
||
708 | * Returns information from a single calendar object, based on it's object |
||
709 | * uri. |
||
710 | * |
||
711 | * The object uri is only the basename, or filename and not a full path. |
||
712 | * |
||
713 | * The returned array must have the same keys as getCalendarObjects. The |
||
714 | * 'calendardata' object is required here though, while it's not required |
||
715 | * for getCalendarObjects. |
||
716 | * |
||
717 | * This method must return null if the object did not exist. |
||
718 | * |
||
719 | * @param mixed $calendarId |
||
720 | * @param string $objectUri |
||
721 | * @return array|null |
||
722 | */ |
||
723 | public function getCalendarObject($calendarId, $objectUri) { |
||
748 | |||
749 | /** |
||
750 | * Returns a list of calendar objects. |
||
751 | * |
||
752 | * This method should work identical to getCalendarObject, but instead |
||
753 | * return all the calendar objects in the list as an array. |
||
754 | * |
||
755 | * If the backend supports this, it may allow for some speed-ups. |
||
756 | * |
||
757 | * @param mixed $calendarId |
||
758 | * @param string[] $uris |
||
759 | * @return array |
||
760 | */ |
||
761 | public function getMultipleCalendarObjects($calendarId, array $uris) { |
||
797 | |||
798 | /** |
||
799 | * Creates a new calendar object. |
||
800 | * |
||
801 | * The object uri is only the basename, or filename and not a full path. |
||
802 | * |
||
803 | * It is possible return an etag from this function, which will be used in |
||
804 | * the response to this PUT request. Note that the ETag must be surrounded |
||
805 | * by double-quotes. |
||
806 | * |
||
807 | * However, you should only really return this ETag if you don't mangle the |
||
808 | * calendar-data. If the result of a subsequent GET to this object is not |
||
809 | * the exact same as this request body, you should omit the ETag. |
||
810 | * |
||
811 | * @param mixed $calendarId |
||
812 | * @param string $objectUri |
||
813 | * @param string $calendarData |
||
814 | * @return string |
||
815 | * @throws DAV\Exception\BadRequest |
||
816 | * @throws \Sabre\VObject\Recur\MaxInstancesExceededException |
||
817 | * @throws \Sabre\VObject\Recur\NoInstancesException |
||
818 | */ |
||
819 | public function createCalendarObject($calendarId, $objectUri, $calendarData) { |
||
843 | |||
844 | /** |
||
845 | * Updates an existing calendarobject, based on it's uri. |
||
846 | * |
||
847 | * The object uri is only the basename, or filename and not a full path. |
||
848 | * |
||
849 | * It is possible return an etag from this function, which will be used in |
||
850 | * the response to this PUT request. Note that the ETag must be surrounded |
||
851 | * by double-quotes. |
||
852 | * |
||
853 | * However, you should only really return this ETag if you don't mangle the |
||
854 | * calendar-data. If the result of a subsequent GET to this object is not |
||
855 | * the exact same as this request body, you should omit the ETag. |
||
856 | * |
||
857 | * @param mixed $calendarId |
||
858 | * @param string $objectUri |
||
859 | * @param string $calendarData |
||
860 | * @return string |
||
861 | * @throws DAV\Exception\BadRequest |
||
862 | * @throws \Sabre\VObject\Recur\MaxInstancesExceededException |
||
863 | * @throws \Sabre\VObject\Recur\NoInstancesException |
||
864 | */ |
||
865 | public function updateCalendarObject($calendarId, $objectUri, $calendarData) { |
||
887 | |||
888 | /** |
||
889 | * @param int $calendarObjectId |
||
890 | * @param int $classification |
||
891 | */ |
||
892 | public function setClassification($calendarObjectId, $classification) { |
||
904 | |||
905 | /** |
||
906 | * Deletes an existing calendar object. |
||
907 | * |
||
908 | * The object uri is only the basename, or filename and not a full path. |
||
909 | * |
||
910 | * @param mixed $calendarId |
||
911 | * @param string $objectUri |
||
912 | * @return void |
||
913 | */ |
||
914 | public function deleteCalendarObject($calendarId, $objectUri) { |
||
920 | |||
921 | /** |
||
922 | * Performs a calendar-query on the contents of this calendar. |
||
923 | * |
||
924 | * The calendar-query is defined in RFC4791 : CalDAV. Using the |
||
925 | * calendar-query it is possible for a client to request a specific set of |
||
926 | * object, based on contents of iCalendar properties, date-ranges and |
||
927 | * iCalendar component types (VTODO, VEVENT). |
||
928 | * |
||
929 | * This method should just return a list of (relative) urls that match this |
||
930 | * query. |
||
931 | * |
||
932 | * The list of filters are specified as an array. The exact array is |
||
933 | * documented by Sabre\CalDAV\CalendarQueryParser. |
||
934 | * |
||
935 | * Note that it is extremely likely that getCalendarObject for every path |
||
936 | * returned from this method will be called almost immediately after. You |
||
937 | * may want to anticipate this to speed up these requests. |
||
938 | * |
||
939 | * This method provides a default implementation, which parses *all* the |
||
940 | * iCalendar objects in the specified calendar. |
||
941 | * |
||
942 | * This default may well be good enough for personal use, and calendars |
||
943 | * that aren't very large. But if you anticipate high usage, big calendars |
||
944 | * or high loads, you are strongly advised to optimize certain paths. |
||
945 | * |
||
946 | * The best way to do so is override this method and to optimize |
||
947 | * specifically for 'common filters'. |
||
948 | * |
||
949 | * Requests that are extremely common are: |
||
950 | * * requests for just VEVENTS |
||
951 | * * requests for just VTODO |
||
952 | * * requests with a time-range-filter on either VEVENT or VTODO. |
||
953 | * |
||
954 | * ..and combinations of these requests. It may not be worth it to try to |
||
955 | * handle every possible situation and just rely on the (relatively |
||
956 | * easy to use) CalendarQueryValidator to handle the rest. |
||
957 | * |
||
958 | * Note that especially time-range-filters may be difficult to parse. A |
||
959 | * time-range filter specified on a VEVENT must for instance also handle |
||
960 | * recurrence rules correctly. |
||
961 | * A good example of how to interprete all these filters can also simply |
||
962 | * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct |
||
963 | * as possible, so it gives you a good idea on what type of stuff you need |
||
964 | * to think of. |
||
965 | * |
||
966 | * @param mixed $calendarId |
||
967 | * @param array $filters |
||
968 | * @return array |
||
969 | */ |
||
970 | public function calendarQuery($calendarId, array $filters) { |
||
1033 | |||
1034 | /** |
||
1035 | * Searches through all of a users calendars and calendar objects to find |
||
1036 | * an object with a specific UID. |
||
1037 | * |
||
1038 | * This method should return the path to this object, relative to the |
||
1039 | * calendar home, so this path usually only contains two parts: |
||
1040 | * |
||
1041 | * calendarpath/objectpath.ics |
||
1042 | * |
||
1043 | * If the uid is not found, return null. |
||
1044 | * |
||
1045 | * This method should only consider * objects that the principal owns, so |
||
1046 | * any calendars owned by other principals that also appear in this |
||
1047 | * collection should be ignored. |
||
1048 | * |
||
1049 | * @param string $principalUri |
||
1050 | * @param string $uid |
||
1051 | * @return string|null |
||
1052 | */ |
||
1053 | public function getCalendarObjectByUID($principalUri, $uid) { |
||
1069 | |||
1070 | /** |
||
1071 | * The getChanges method returns all the changes that have happened, since |
||
1072 | * the specified syncToken in the specified calendar. |
||
1073 | * |
||
1074 | * This function should return an array, such as the following: |
||
1075 | * |
||
1076 | * [ |
||
1077 | * 'syncToken' => 'The current synctoken', |
||
1078 | * 'added' => [ |
||
1079 | * 'new.txt', |
||
1080 | * ], |
||
1081 | * 'modified' => [ |
||
1082 | * 'modified.txt', |
||
1083 | * ], |
||
1084 | * 'deleted' => [ |
||
1085 | * 'foo.php.bak', |
||
1086 | * 'old.txt' |
||
1087 | * ] |
||
1088 | * ); |
||
1089 | * |
||
1090 | * The returned syncToken property should reflect the *current* syncToken |
||
1091 | * of the calendar, as reported in the {http://sabredav.org/ns}sync-token |
||
1092 | * property This is * needed here too, to ensure the operation is atomic. |
||
1093 | * |
||
1094 | * If the $syncToken argument is specified as null, this is an initial |
||
1095 | * sync, and all members should be reported. |
||
1096 | * |
||
1097 | * The modified property is an array of nodenames that have changed since |
||
1098 | * the last token. |
||
1099 | * |
||
1100 | * The deleted property is an array with nodenames, that have been deleted |
||
1101 | * from collection. |
||
1102 | * |
||
1103 | * The $syncLevel argument is basically the 'depth' of the report. If it's |
||
1104 | * 1, you only have to report changes that happened only directly in |
||
1105 | * immediate descendants. If it's 2, it should also include changes from |
||
1106 | * the nodes below the child collections. (grandchildren) |
||
1107 | * |
||
1108 | * The $limit argument allows a client to specify how many results should |
||
1109 | * be returned at most. If the limit is not specified, it should be treated |
||
1110 | * as infinite. |
||
1111 | * |
||
1112 | * If the limit (infinite or not) is higher than you're willing to return, |
||
1113 | * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. |
||
1114 | * |
||
1115 | * If the syncToken is expired (due to data cleanup) or unknown, you must |
||
1116 | * return null. |
||
1117 | * |
||
1118 | * The limit is 'suggestive'. You are free to ignore it. |
||
1119 | * |
||
1120 | * @param string $calendarId |
||
1121 | * @param string $syncToken |
||
1122 | * @param int $syncLevel |
||
1123 | * @param int $limit |
||
1124 | * @return array |
||
1125 | */ |
||
1126 | public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { |
||
1181 | |||
1182 | /** |
||
1183 | * Returns a list of subscriptions for a principal. |
||
1184 | * |
||
1185 | * Every subscription is an array with the following keys: |
||
1186 | * * id, a unique id that will be used by other functions to modify the |
||
1187 | * subscription. This can be the same as the uri or a database key. |
||
1188 | * * uri. This is just the 'base uri' or 'filename' of the subscription. |
||
1189 | * * principaluri. The owner of the subscription. Almost always the same as |
||
1190 | * principalUri passed to this method. |
||
1191 | * |
||
1192 | * Furthermore, all the subscription info must be returned too: |
||
1193 | * |
||
1194 | * 1. {DAV:}displayname |
||
1195 | * 2. {http://apple.com/ns/ical/}refreshrate |
||
1196 | * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos |
||
1197 | * should not be stripped). |
||
1198 | * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms |
||
1199 | * should not be stripped). |
||
1200 | * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if |
||
1201 | * attachments should not be stripped). |
||
1202 | * 6. {http://calendarserver.org/ns/}source (Must be a |
||
1203 | * Sabre\DAV\Property\Href). |
||
1204 | * 7. {http://apple.com/ns/ical/}calendar-color |
||
1205 | * 8. {http://apple.com/ns/ical/}calendar-order |
||
1206 | * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set |
||
1207 | * (should just be an instance of |
||
1208 | * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of |
||
1209 | * default components). |
||
1210 | * |
||
1211 | * @param string $principalUri |
||
1212 | * @return array |
||
1213 | */ |
||
1214 | public function getSubscriptionsForUser($principalUri) { |
||
1252 | |||
1253 | /** |
||
1254 | * Creates a new subscription for a principal. |
||
1255 | * |
||
1256 | * If the creation was a success, an id must be returned that can be used to reference |
||
1257 | * this subscription in other methods, such as updateSubscription. |
||
1258 | * |
||
1259 | * @param string $principalUri |
||
1260 | * @param string $uri |
||
1261 | * @param array $properties |
||
1262 | * @return mixed |
||
1263 | * @throws Forbidden |
||
1264 | */ |
||
1265 | public function createSubscription($principalUri, $uri, array $properties) { |
||
1302 | |||
1303 | /** |
||
1304 | * Updates a subscription |
||
1305 | * |
||
1306 | * The list of mutations is stored in a Sabre\DAV\PropPatch object. |
||
1307 | * To do the actual updates, you must tell this object which properties |
||
1308 | * you're going to process with the handle() method. |
||
1309 | * |
||
1310 | * Calling the handle method is like telling the PropPatch object "I |
||
1311 | * promise I can handle updating this property". |
||
1312 | * |
||
1313 | * Read the PropPatch documentation for more info and examples. |
||
1314 | * |
||
1315 | * @param mixed $subscriptionId |
||
1316 | * @param PropPatch $propPatch |
||
1317 | * @return void |
||
1318 | */ |
||
1319 | public function updateSubscription($subscriptionId, PropPatch $propPatch) { |
||
1347 | |||
1348 | /** |
||
1349 | * Deletes a subscription. |
||
1350 | * |
||
1351 | * @param mixed $subscriptionId |
||
1352 | * @return void |
||
1353 | */ |
||
1354 | public function deleteSubscription($subscriptionId) { |
||
1360 | |||
1361 | /** |
||
1362 | * Returns a single scheduling object for the inbox collection. |
||
1363 | * |
||
1364 | * The returned array should contain the following elements: |
||
1365 | * * uri - A unique basename for the object. This will be used to |
||
1366 | * construct a full uri. |
||
1367 | * * calendardata - The iCalendar object |
||
1368 | * * lastmodified - The last modification date. Can be an int for a unix |
||
1369 | * timestamp, or a PHP DateTime object. |
||
1370 | * * etag - A unique token that must change if the object changed. |
||
1371 | * * size - The size of the object, in bytes. |
||
1372 | * |
||
1373 | * @param string $principalUri |
||
1374 | * @param string $objectUri |
||
1375 | * @return array |
||
1376 | */ |
||
1377 | public function getSchedulingObject($principalUri, $objectUri) { |
||
1399 | |||
1400 | /** |
||
1401 | * Returns all scheduling objects for the inbox collection. |
||
1402 | * |
||
1403 | * These objects should be returned as an array. Every item in the array |
||
1404 | * should follow the same structure as returned from getSchedulingObject. |
||
1405 | * |
||
1406 | * The main difference is that 'calendardata' is optional. |
||
1407 | * |
||
1408 | * @param string $principalUri |
||
1409 | * @return array |
||
1410 | */ |
||
1411 | public function getSchedulingObjects($principalUri) { |
||
1431 | |||
1432 | /** |
||
1433 | * Deletes a scheduling object from the inbox collection. |
||
1434 | * |
||
1435 | * @param string $principalUri |
||
1436 | * @param string $objectUri |
||
1437 | * @return void |
||
1438 | */ |
||
1439 | public function deleteSchedulingObject($principalUri, $objectUri) { |
||
1446 | |||
1447 | /** |
||
1448 | * Creates a new scheduling object. This should land in a users' inbox. |
||
1449 | * |
||
1450 | * @param string $principalUri |
||
1451 | * @param string $objectUri |
||
1452 | * @param string $objectData |
||
1453 | * @return void |
||
1454 | */ |
||
1455 | public function createSchedulingObject($principalUri, $objectUri, $objectData) { |
||
1468 | |||
1469 | /** |
||
1470 | * Adds a change record to the calendarchanges table. |
||
1471 | * |
||
1472 | * @param mixed $calendarId |
||
1473 | * @param string $objectUri |
||
1474 | * @param int $operation 1 = add, 2 = modify, 3 = delete. |
||
1475 | * @return void |
||
1476 | */ |
||
1477 | protected function addChange($calendarId, $objectUri, $operation) { |
||
1490 | |||
1491 | /** |
||
1492 | * Parses some information from calendar objects, used for optimized |
||
1493 | * calendar-queries. |
||
1494 | * |
||
1495 | * Returns an array with the following keys: |
||
1496 | * * etag - An md5 checksum of the object without the quotes. |
||
1497 | * * size - Size of the object in bytes |
||
1498 | * * componentType - VEVENT, VTODO or VJOURNAL |
||
1499 | * * firstOccurence |
||
1500 | * * lastOccurence |
||
1501 | * * uid - value of the UID property |
||
1502 | * |
||
1503 | * @param string $calendarData |
||
1504 | * @return array |
||
1505 | * @throws DAV\Exception\BadRequest |
||
1506 | * @throws \Sabre\VObject\Recur\MaxInstancesExceededException |
||
1507 | * @throws \Sabre\VObject\Recur\NoInstancesException |
||
1508 | */ |
||
1509 | public function getDenormalizedData($calendarData) { |
||
1581 | |||
1582 | private function readBlob($cardData) { |
||
1589 | |||
1590 | /** |
||
1591 | * @param IShareable $shareable |
||
1592 | * @param array $add |
||
1593 | * @param array $remove |
||
1594 | */ |
||
1595 | public function updateShares($shareable, $add, $remove) { |
||
1598 | |||
1599 | /** |
||
1600 | * @param int $resourceId |
||
1601 | * @return array |
||
1602 | */ |
||
1603 | public function getShares($resourceId) { |
||
1606 | |||
1607 | /** |
||
1608 | * @param boolean $value |
||
1609 | * @param \OCA\DAV\CalDAV\Calendar $calendar |
||
1610 | * @return string|null |
||
1611 | */ |
||
1612 | public function setPublishStatus($value, $calendar) { |
||
1633 | |||
1634 | /** |
||
1635 | * @param \OCA\DAV\CalDAV\Calendar $calendar |
||
1636 | * @return mixed |
||
1637 | */ |
||
1638 | public function getPublishStatus($calendar) { |
||
1650 | |||
1651 | /** |
||
1652 | * @param int $resourceId |
||
1653 | * @param array $acl |
||
1654 | * @return array |
||
1655 | */ |
||
1656 | public function applyShareAcl($resourceId, $acl) { |
||
1659 | |||
1660 | private function convertPrincipal($principalUri, $toV2 = null) { |
||
1671 | } |
||
1672 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: