]> git.mxchange.org Git - friendica.git/commitdiff
Simplifying extension access
authorMichael <heluecht@pirati.ca>
Sun, 16 Jan 2022 19:38:59 +0000 (19:38 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 16 Jan 2022 19:38:59 +0000 (19:38 +0000)
src/Module/Api/Friendica/Activity.php
src/Module/Api/Friendica/Notification.php
src/Module/Api/Friendica/Profile/Show.php
src/Module/Api/GNUSocial/Help/Test.php
src/Module/Api/Twitter/Account/RateLimitStatus.php

index 70aeee613fc2b1164299638b397282501aaf16e7..3915c2089e3a26952ca1faf58ee38f1a4f7b86db 100644 (file)
@@ -52,7 +52,7 @@ class Activity extends BaseApi
                $res = Item::performActivity($request['id'], $this->parameters['verb'], $uid);
 
                if ($res) {
-                       if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
+                       if ($this->parameters['extension'] ?? '' == 'xml') {
                                $ok = 'true';
                        } else {
                                $ok = 'ok';
index 1f5ac9b488b8d99b23757e0acffe63fc4ebef505..d16e0e2b0d2ba0d7666486d9ec85463e7c2b6666 100644 (file)
@@ -43,7 +43,7 @@ class Notification extends BaseApi
                        $notifications[] = new ApiNotification($Notify);
                }
 
-               if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
+               if ($this->parameters['extension'] ?? '' == 'xml') {
                        $xmlnotes = [];
                        foreach ($notifications as $notification) {
                                $xmlnotes[] = ['@attributes' => $notification->toArray()];
index 60f4f024b0f2697c5c7545b8feb3f774f41efcc3..2507b7e275e62c64177bbb494d29ca8fc33175c4 100644 (file)
@@ -48,7 +48,7 @@ class Show extends BaseApi
                $profile = self::formatProfile($profile, $profileFields);
 
                $profiles = [];
-               if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
+               if ($this->parameters['extension'] ?? '' == 'xml') {
                        $profiles['0:profile'] = $profile;
                } else {
                        $profiles[] = $profile;
index 4cfeda6abaf2697056eeb45e0024e77493deb95c..44a31ba880b48a910cbc7dac116b00f8687c7728 100644 (file)
@@ -31,7 +31,7 @@ class Test extends BaseApi
 {
        protected function rawContent(array $request = [])
        {
-               if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
+               if ($this->parameters['extension'] ?? '' == 'xml') {
                        $ok = 'true';
                } else {
                        $ok = 'ok';
index 7a48f4f0e0712fd2f24e8cbd6f79a24757b78274..60cee6ce347fc4346087cef89b34c7caddb6fd96 100644 (file)
@@ -31,7 +31,7 @@ class RateLimitStatus extends BaseApi
 {
        protected function rawContent(array $request = [])
        {
-               if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
+               if ($this->parameters['extension'] ?? '' == 'xml') {
                        $hash = [
                                'remaining-hits'        => '150',
                                '@attributes'           => ["type" => "integer"],