X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FEvent.php;h=74bf3bd9c0cd45b1ac18d3fed1160359a7606f6f;hb=073695b33c5f9c5d89d91958b09259c59e12dd98;hp=cb7c39c37d094f0de46d6db4846cfbd11ae7f1d6;hpb=87673fd0c52b40d1100fd46c648c786bab3750cf;p=friendica.git
diff --git a/src/Model/Event.php b/src/Model/Event.php
index cb7c39c37d..74bf3bd9c0 100644
--- a/src/Model/Event.php
+++ b/src/Model/Event.php
@@ -1,6 +1,6 @@
$event['uri'], 'guid' => $event['guid']]);
$event['type'] = ($arr['type'] ?? '') ?: 'event';
$event['summary'] = $arr['summary'] ?? '';
@@ -317,7 +316,7 @@ class Event
return $event['id'];
}
- public static function getItemArrayForId(int $event_id, array $item = []):array
+ public static function getItemArrayForId(int $event_id, array $item = []): array
{
if (empty($event_id)) {
return $item;
@@ -374,7 +373,7 @@ class Event
return $item;
}
- public static function getItemArrayForImportedId(int $event_id, array $item = []):array
+ public static function getItemArrayForImportedId(int $event_id, array $item = []): array
{
if (empty($event_id)) {
return $item;
@@ -404,7 +403,7 @@ class Event
* @return array Array with translations strings.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function getStrings()
+ public static function getStrings(): array
{
// First day of the week (0 = Sunday).
$firstDay = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
@@ -477,7 +476,7 @@ class Event
*
* @todo We should replace this with a separate update function if there is some time left.
*/
- private static function removeDuplicates(array $dates)
+ private static function removeDuplicates(array $dates): array
{
$dates2 = [];
@@ -500,7 +499,7 @@ class Event
* @return array Query result
* @throws \Exception
*/
- public static function getListById($owner_uid, $event_id, $sql_extra = '')
+ public static function getListById(int $owner_uid, int $event_id, string $sql_extra = ''): array
{
$return = [];
@@ -536,7 +535,7 @@ class Event
* @return array Query results.
* @throws \Exception
*/
- public static function getListByDate($owner_uid, $event_params, $sql_extra = '')
+ public static function getListByDate(int $owner_uid, array $event_params, string $sql_extra = ''): array
{
$return = [];
@@ -570,7 +569,7 @@ class Event
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function prepareListForTemplate(array $event_result)
+ public static function prepareListForTemplate(array $event_result): array
{
$event_list = [];
@@ -651,12 +650,12 @@ class Event
* @param array $events Query result for events.
* @param string $format The output format (ical/csv).
*
- * @param $timezone
+ * @param string $timezone Timezone (missing parameter!)
* @return string Content according to selected export format.
*
* @todo Implement timezone support
*/
- private static function formatListForExport(array $events, $format)
+ private static function formatListForExport(array $events, string $format): string
{
$o = '';
@@ -757,7 +756,7 @@ class Event
* @return array Query results.
* @throws \Exception
*/
- private static function getListByUserId($uid = 0)
+ private static function getListByUserId(int $uid = 0): array
{
$return = [];
@@ -797,7 +796,7 @@ class Event
* @throws \Exception
* @todo Respect authenticated users with events_by_uid().
*/
- public static function exportListByUserId($uid, $format = 'ical')
+ public static function exportListByUserId(int $uid, string $format = 'ical'): array
{
$process = false;
@@ -845,7 +844,8 @@ class Event
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function getItemHTML(array $item) {
+ public static function getItemHTML(array $item): string
+ {
$same_date = false;
$finish = false;
@@ -933,10 +933,11 @@ class Event
* @return array The array with the location data.
* 'name' => The name of the location,
* 'address' => The address of the location,
- * 'coordinates' => Latitudeâ and longitudeâ (e.g. '48.864716,2.349014').
+ * 'coordinates' => Latitude and longitude (e.g. '48.864716,2.349014').
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- private static function locationToArray($s = '') {
+ private static function locationToArray(string $s = ''): array
+ {
if ($s == '') {
return [];
}
@@ -981,7 +982,7 @@ class Event
* @return bool
* @throws \Exception
*/
- public static function createBirthday($contact, $birthday)
+ public static function createBirthday(array $contact, string $birthday): bool
{
// Check for duplicates
$condition = [
@@ -1011,8 +1012,7 @@ class Event
'type' => 'birthday',
];
- self::store($values);
-
- return true;
+ // Check if self::store() was success
+ return (self::store($values) > 0);
}
}