]> git.mxchange.org Git - friendica.git/commitdiff
Fix PHP 7.0 Coding Standards
authorPhilipp <admin@philipp.info>
Sat, 22 May 2021 21:45:15 +0000 (23:45 +0200)
committerPhilipp <admin@philipp.info>
Sat, 22 May 2021 21:47:35 +0000 (23:47 +0200)
include/api.php
mod/settings.php
mod/unfollow.php
mod/update_notes.php
src/Content/Widget/TagCloud.php
src/Module/Attach.php
src/Network/HTTPRequest.php
src/Object/Api/Mastodon/Status.php

index 0b925aee0f6df4345f46473a4a7a921efe5c8344..8e89895ded26fb68eb8eeb71610536d4cd4732a4 100644 (file)
@@ -1186,12 +1186,12 @@ function api_statuses_update($type)
                                        INNER JOIN `user` ON `user`.`uid` = `photo`.`uid` WHERE `resource-id` IN
                                                (SELECT `resource-id` FROM `photo` WHERE `id` = ?) AND `photo`.`uid` = ?
                                        ORDER BY `photo`.`width` DESC LIMIT 2", $id, api_user()));
-                               
+
                        if (!empty($media)) {
                                $ressources[] = $media[0]['resource-id'];
                                $phototypes = Images::supportedTypes();
                                $ext = $phototypes[$media[0]['type']];
-                       
+
                                $attachment = ['type' => Post\Media::IMAGE, 'mimetype' => $media[0]['type'],
                                        'url' => DI::baseUrl() . '/photo/' . $media[0]['resource-id'] . '-' . $media[0]['scale'] . '.' . $ext,
                                        'size' => $media[0]['datasize'],
@@ -1199,7 +1199,7 @@ function api_statuses_update($type)
                                        'description' => $media[0]['desc'] ?? '',
                                        'width' => $media[0]['width'],
                                        'height' => $media[0]['height']];
-                       
+
                                if (count($media) > 1) {
                                        $attachment['preview'] = DI::baseUrl() . '/photo/' . $media[1]['resource-id'] . '-' . $media[1]['scale'] . '.' . $ext;
                                        $attachment['preview-width'] = $media[1]['width'];
index 3a3f0b65dccf974004433a96c4a0dff60a1e1555..ec813398489e3fbedeb482cad15a948de763bf27 100644 (file)
@@ -326,7 +326,7 @@ function settings_post(App $a)
        $detailed_notif   = (($_POST['detailed_notif'] == 1) ? 1 : 0);
 
        $notify_ignored   = (($_POST['notify_ignored'] == 1) ? 1 : 0);
-       
+
        $notify = 0;
 
        if (!empty($_POST['notify1'])) {
index 1c6022a4cb4b31dce2420f33d078dd96a004cb65..aca17727b6950627791cd742daad45352f592047 100644 (file)
@@ -158,4 +158,4 @@ function unfollow_process(string $url)
        }
 
        DI::baseUrl()->redirect($return_path);
-}
\ No newline at end of file
+}
index 3b85d34b9a1898147ab8e6fa97a000d919023f82..641f7db8be9017ed01493a96e1bbc12dfcdbde45 100644 (file)
@@ -43,4 +43,4 @@ function update_notes_content(App $a) {
        $text = notes_content($a, $profile_uid);
 
        System::htmlUpdateExit($text);
-}
\ No newline at end of file
+}
index f315b3b5373579f4d53ee55c20b5c117911b0728..4263d8cf4a88ea70f2ea17898e753f19f348decf 100644 (file)
@@ -127,8 +127,8 @@ class TagCloud
        private static function tagCalc(array $arr)
        {
                $tags = [];
-               $min = 1e9;
-               $max = -1e9;
+               $min = 1000000000.0;
+               $max = -1000000000.0;
                $x = 0;
 
                if (!$arr) {
@@ -145,7 +145,7 @@ class TagCloud
                }
 
                usort($tags, 'self::tagsSort');
-               $range = max(.01, $max - $min) * 1.0001;
+               $range = max(0.01, $max - $min) * 1.0001;
 
                for ($x = 0; $x < count($tags); $x ++) {
                        $tags[$x][2] = 1 + floor(9 * ($tags[$x][1] - $min) / $range);
index 7a288fb3b90a877e25fd8ff662f469fb02676a30..2acbf31b425ed7ded08fc89e637519c6fab016a7 100644 (file)
@@ -43,7 +43,7 @@ class Attach extends BaseModule
 
                // @TODO: Replace with parameter from router
                $item_id = intval($a->argv[1]);
-               
+
                // Check for existence
                $item = MAttach::exists(['id' => $item_id]);
                if ($item === false) {
index 74cf9cd0554d01a62beb0a1486b391bb734f4f69..bd31ac1e143702ff597f2f4038c69e73ab104bdf 100644 (file)
@@ -70,7 +70,7 @@ class HTTPRequest implements IHTTPRequest
         *
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public function get(string $url, array $opts = [], int &$redirects = 0)
+       public function get(string $url, array $opts = [], &$redirects = 0)
        {
                $stamp1 = microtime(true);
 
@@ -222,7 +222,7 @@ class HTTPRequest implements IHTTPRequest
         *
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public function post(string $url, $params, array $headers = [], int $timeout = 0, int &$redirects = 0)
+       public function post(string $url, $params, array $headers = [], int $timeout = 0, &$redirects = 0)
        {
                $stamp1 = microtime(true);
 
@@ -447,7 +447,7 @@ class HTTPRequest implements IHTTPRequest
         *
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public function fetch(string $url, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
+       public function fetch(string $url, int $timeout = 0, string $accept_content = '', string $cookiejar = '', &$redirects = 0)
        {
                $ret = $this->fetchFull($url, $timeout, $accept_content, $cookiejar, $redirects);
 
@@ -461,7 +461,7 @@ class HTTPRequest implements IHTTPRequest
         *
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public function fetchFull(string $url, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
+       public function fetchFull(string $url, int $timeout = 0, string $accept_content = '', string $cookiejar = '', &$redirects = 0)
        {
                return $this->get(
                        $url,
index 227395d171bc8a6d29e8f1f36274a4f5745dea1c..eb88ce5f1a5da943eeb97d23367a38212d88d81f 100644 (file)
@@ -114,7 +114,8 @@ class Status extends BaseDataTransferObject
                $this->visibility = $visibility[$item['private']];
 
                $languages = json_decode($item['language'], true);
-               $this->language = is_array($languages) ? array_key_first($languages) : null;
+               reset($languages);
+               $this->language = is_array($languages) ? key($languages) : null;
 
                $this->uri = $item['uri'];
                $this->url = $item['plink'] ?? null;