* @param array $languages
* @return string language JSON
*/
- private static function processLanguages(array $languages)
+ private static function processLanguages(array $languages): string
{
$codes = array_keys($languages);
$lang = [];
/**
* Replaces emojis in the body
*
- * @param array $emojis
+ * @param int $uri_id
* @param string $body
+ * @param array $emojis
*
* @return string with replaced emojis
*/
- private static function replaceEmojis(int $uri_id, $body, array $emojis)
+ private static function replaceEmojis(int $uri_id, string $body, array $emojis)
{
$body = strtr($body,
array_combine(
* @param array $activity
* @param array $item
*/
- private static function storeAttachments($activity, $item)
+ private static function storeAttachments(array $activity, array $item)
{
if (empty($activity['attachments'])) {
return;
* @param array $activity
* @param array $item
*/
- private static function storeQuestion($activity, $item)
+ private static function storeQuestion(array $activity, array $item)
{
if (empty($activity['question'])) {
return;
* @param array $activity Activity array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function updateItem($activity)
+ public static function updateItem(array $activity)
{
$item = Post::selectFirst(['uri', 'uri-id', 'thr-parent', 'gravity', 'post-type'], ['uri' => $activity['id']]);
if (!DBA::isResult($item)) {
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function createItem($activity)
+ public static function createItem(array $activity): array
{
$item = [];
$item['verb'] = Activity::POST;
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function deleteItem($activity)
+ public static function deleteItem(array $activity)
{
$owner = Contact::getIdForURL($activity['actor']);
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function addTag($activity)
+ public static function addTag(array $activity)
{
if (empty($activity['object_content']) || empty($activity['object_id'])) {
return;
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function createActivity($activity, $verb)
+ public static function createActivity(array $activity, string $verb)
{
$item = self::createItem($activity);
if (empty($item)) {
* @return int event id
* @throws \Exception
*/
- public static function createEvent($activity, $item)
+ public static function createEvent(array $activity, array $item): int
{
$event['summary'] = HTML::toBBCode($activity['name'] ?: $activity['summary']);
$event['desc'] = HTML::toBBCode($activity['content']);
* @return array|bool Returns the item array or false if there was an unexpected occurrence
* @throws \Exception
*/
- private static function processContent($activity, $item)
+ private static function processContent(array $activity, array $item)
{
if (!empty($activity['mediatype']) && ($activity['mediatype'] == 'text/markdown')) {
$item['title'] = strip_tags($activity['name']);
$content = $activity['content'];
} else {
// By default assume "text/html"
- $item['title'] = HTML::toBBCode($activity['name']);
+ $item['title'] = (empty($activity['name']) ? HTML::toBBCode($activity['name']) : '');
$content = HTML::toBBCode($activity['content']);
}