]> git.mxchange.org Git - friendica.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 10 May 2018 11:19:50 +0000 (13:19 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 14 May 2018 20:50:04 +0000 (22:50 +0200)
- used x() to make sure the array key is there, else an E_NOTICE is triggered
- added type-hints where it is safe

Signed-off-by: Roland Häder <roland@mxchange.org>
include/api.php
include/conversation.php

index 6f2566b97d92b849b312eaa9b6cd43324ce74561..f8c384990dd737cf9775467347efb07bbe20f40c 100644 (file)
@@ -935,7 +935,7 @@ function api_reformat_xml(&$item, &$key)
  *
  * @return string The XML data
  */
-function api_create_xml($data, $root_element)
+function api_create_xml(array $data, $root_element)
 {
        $childname = key($data);
        $data2 = array_pop($data);
@@ -960,7 +960,7 @@ function api_create_xml($data, $root_element)
                $i = 1;
 
                foreach ($data2 as $item) {
-                       $data4[$i++.":".$childname] = $item;
+                       $data4[$i++ . ":" . $childname] = $item;
                }
 
                $data2 = $data4;
index 8ae82964426de1b2c1d81c6e0b2d5182b8ee0250..de3b2aaf450cb8068fc5be8a73a52950181dc52e 100644 (file)
@@ -1609,16 +1609,16 @@ function sort_thr_commented(array $a, array $b)
 }
 
 function render_location_dummy(array $item) {
-       if ($item['location'] != "") {
+       if (x($item, 'location') && !empty($item['location'])) {
                return $item['location'];
        }
 
-       if ($item['coord'] != "") {
+       if (x($item, 'coord') && !empty($item['coord'])) {
                return $item['coord'];
        }
 }
 
-function get_responses(array $conv_responses, array $response_verbs, $ob, $item) {
+function get_responses(array $conv_responses, array $response_verbs, $ob, array $item) {
        $ret = [];
        foreach ($response_verbs as $v) {
                $ret[$v] = [];