]> git.mxchange.org Git - friendica.git/commitdiff
Fix code style
authorArt4 <art4@wlabs.de>
Tue, 4 Feb 2025 12:59:21 +0000 (12:59 +0000)
committerArt4 <art4@wlabs.de>
Tue, 4 Feb 2025 12:59:21 +0000 (12:59 +0000)
src/Content/Widget.php
src/Core/Storage/Repository/StorageManager.php
tests/ApiTestCase.php

index 31dc43857f581bb2d8b4c3b81082a360fa468bac..b86b3e9b1c8f596cc75b578d245ac49367a48ddb 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Content;
 
-use Friendica\Core\Addon;
 use Friendica\Core\Cache\Enum\Duration;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
@@ -33,13 +32,13 @@ class Widget
         */
        public static function follow(string $value = ''): string
        {
-               return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/follow.tpl'), array(
+               return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/follow.tpl'), [
                        '$connect' => DI::l10n()->t('Add New Contact'),
-                       '$desc' => DI::l10n()->t('Enter address or web location'),
-                       '$hint' => DI::l10n()->t('Example: bob@example.com, http://example.com/barbara'),
-                       '$value' => $value,
-                       '$follow' => DI::l10n()->t('Connect')
-               ));
+                       '$desc'    => DI::l10n()->t('Enter address or web location'),
+                       '$hint'    => DI::l10n()->t('Example: bob@example.com, http://example.com/barbara'),
+                       '$value'   => $value,
+                       '$follow'  => DI::l10n()->t('Connect')
+               ]);
        }
 
        /**
@@ -60,21 +59,21 @@ class Widget
                        }
                }
 
-               $nv = [];
-               $nv['findpeople'] = DI::l10n()->t('Find People');
-               $nv['desc'] = DI::l10n()->t('Enter name or interest');
-               $nv['label'] = DI::l10n()->t('Connect/Follow');
-               $nv['hint'] = DI::l10n()->t('Examples: Robert Morgenstein, Fishing');
-               $nv['findthem'] = DI::l10n()->t('Find');
-               $nv['suggest'] = DI::l10n()->t('Friend Suggestions');
-               $nv['similar'] = DI::l10n()->t('Similar Interests');
-               $nv['random'] = DI::l10n()->t('Random Profile');
-               $nv['inv'] = DI::l10n()->t('Invite Friends');
-               $nv['directory'] = DI::l10n()->t('Global Directory');
-               $nv['global_dir'] = OpenWebAuth::getZrlUrl($global_dir, true);
+               $nv                    = [];
+               $nv['findpeople']      = DI::l10n()->t('Find People');
+               $nv['desc']            = DI::l10n()->t('Enter name or interest');
+               $nv['label']           = DI::l10n()->t('Connect/Follow');
+               $nv['hint']            = DI::l10n()->t('Examples: Robert Morgenstein, Fishing');
+               $nv['findthem']        = DI::l10n()->t('Find');
+               $nv['suggest']         = DI::l10n()->t('Friend Suggestions');
+               $nv['similar']         = DI::l10n()->t('Similar Interests');
+               $nv['random']          = DI::l10n()->t('Random Profile');
+               $nv['inv']             = DI::l10n()->t('Invite Friends');
+               $nv['directory']       = DI::l10n()->t('Global Directory');
+               $nv['global_dir']      = OpenWebAuth::getZrlUrl($global_dir, true);
                $nv['local_directory'] = DI::l10n()->t('Local Directory');
 
-               $aside = [];
+               $aside        = [];
                $aside['$nv'] = $nv;
 
                return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/peoplefind.tpl'), $aside);
@@ -178,7 +177,7 @@ class Widget
        private static function filter(string $type, string $title, string $desc, string $all, string $baseUrl, array $options, string $selected = null): string
        {
                $queryString = parse_url($baseUrl, PHP_URL_QUERY);
-               $queryArray = [];
+               $queryArray  = [];
 
                if ($queryString) {
                        parse_str($queryString, $queryArray);
@@ -286,8 +285,8 @@ class Widget
                        return '';
                }
 
-               $networks = self::unavailableNetworks();
-               $query = "`uid` = ? AND NOT `deleted` AND `network` != '' AND NOT `network` IN (" . substr(str_repeat("?, ", count($networks)), 0, -2) . ")";
+               $networks  = self::unavailableNetworks();
+               $query     = "`uid` = ? AND NOT `deleted` AND `network` != '' AND NOT `network` IN (" . substr(str_repeat("?, ", count($networks)), 0, -2) . ")";
                $condition = array_merge([$query], array_merge([DI::userSession()->getLocalUserId()], $networks));
 
                $r = DBA::select('contact', ['network'], $condition, ['group_by' => ['network'], 'order' => ['network']]);
@@ -477,7 +476,7 @@ class Widget
                $ret = [];
 
                $cachekey = 'Widget::postedByYear' . $uid . '-' . (int)$wall;
-               $dthen = DI::cache()->get($cachekey);
+               $dthen    = DI::cache()->get($cachekey);
                if (empty($dthen)) {
                        $dthen = Item::firstPostDate($uid, $wall);
                        DI::cache()->set($cachekey, $dthen, Duration::HOUR);
@@ -490,30 +489,30 @@ class Widget
                if ($dthen) {
                        // Set the start and end date to the beginning of the month
                        $cutoffday = $dthen;
-                       $thisday = substr($dnow, 4);
-                       $nextday = date('Y-m-d', strtotime($dnow . ' + 1 day'));
-                       $nextday = substr($nextday, 4);
-                       $dnow = substr($dnow, 0, 8) . '01';
-                       $dthen = substr($dthen, 0, 8) . '01';
+                       $thisday   = substr($dnow, 4);
+                       $nextday   = date('Y-m-d', strtotime($dnow . ' + 1 day'));
+                       $nextday   = substr($nextday, 4);
+                       $dnow      = substr($dnow, 0, 8) . '01';
+                       $dthen     = substr($dthen, 0, 8) . '01';
 
                        /*
                         * Starting with the current month, get the first and last days of every
                         * month down to and including the month of the first post
                         */
                        while (substr($dnow, 0, 7) >= substr($dthen, 0, 7)) {
-                               $dyear = intval(substr($dnow, 0, 4));
-                               $dstart = substr($dnow, 0, 8) . '01';
-                               $dend = substr($dnow, 0, 8) . Temporal::getDaysInMonth(intval($dnow), intval(substr($dnow, 5)));
+                               $dyear       = intval(substr($dnow, 0, 4));
+                               $dstart      = substr($dnow, 0, 8) . '01';
+                               $dend        = substr($dnow, 0, 8) . Temporal::getDaysInMonth(intval($dnow), intval(substr($dnow, 5)));
                                $start_month = DateTimeFormat::utc($dstart, 'Y-m-d');
-                               $end_month = DateTimeFormat::utc($dend, 'Y-m-d');
-                               $str = DI::l10n()->getDay(DateTimeFormat::utc($dnow, 'F'));
+                               $end_month   = DateTimeFormat::utc($dend, 'Y-m-d');
+                               $str         = DI::l10n()->getDay(DateTimeFormat::utc($dnow, 'F'));
 
                                if (empty($ret[$dyear])) {
                                        $ret[$dyear] = [];
                                }
 
                                $ret[$dyear][] = [$str, $end_month, $start_month];
-                               $dnow = DateTimeFormat::utc($dnow . ' -1 month', 'Y-m-d');
+                               $dnow          = DateTimeFormat::utc($dnow . ' -1 month', 'Y-m-d');
                        }
                }
 
@@ -522,21 +521,21 @@ class Widget
                }
 
                $cutoff_year = intval(DateTimeFormat::localNow('Y')) - $visible_years;
-               $cutoff = array_key_exists($cutoff_year, $ret);
+               $cutoff      = array_key_exists($cutoff_year, $ret);
 
                $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/posted_date.tpl'), [
-                       '$title' => DI::l10n()->t('Archives'),
-                       '$size' => $visible_years,
+                       '$title'       => DI::l10n()->t('Archives'),
+                       '$size'        => $visible_years,
                        '$cutoff_year' => $cutoff_year,
-                       '$cutoff' => $cutoff,
-                       '$url' => $url,
-                       '$dates' => $ret,
-                       '$showless' => DI::l10n()->t('show less'),
-                       '$showmore' => DI::l10n()->t('show more'),
-                       '$onthisdate' => DI::l10n()->t('On this date'),
-                       '$thisday' => $thisday,
-                       '$nextday' => $nextday,
-                       '$cutoffday' => $cutoffday
+                       '$cutoff'      => $cutoff,
+                       '$url'         => $url,
+                       '$dates'       => $ret,
+                       '$showless'    => DI::l10n()->t('show less'),
+                       '$showmore'    => DI::l10n()->t('show more'),
+                       '$onthisdate'  => DI::l10n()->t('On this date'),
+                       '$thisday'     => $thisday,
+                       '$nextday'     => $nextday,
+                       '$cutoffday'   => $cutoffday
                ]);
 
                return $o;
index 9d76d1923ec53b05372f11f8805a8707337c3a7a..bbd9e13f1406217645363c803425027559716d1f 100644 (file)
@@ -138,7 +138,7 @@ class StorageManager
                        // Try the filesystem backend
                        case Type\Filesystem::getName():
                                return new Type\FilesystemConfig($this->config, $this->l10n);
-                       // try the database backend
+                               // try the database backend
                        case Type\Database::getName():
                                return false;
                        default:
@@ -185,11 +185,11 @@ class StorageManager
                                        $storageConfig                 = new Type\FilesystemConfig($this->config, $this->l10n);
                                        $this->backendInstances[$name] = new Type\Filesystem($storageConfig->getStoragePath());
                                        break;
-                               // try the database backend
+                                       // try the database backend
                                case Type\Database::getName():
                                        $this->backendInstances[$name] = new Type\Database($this->dba);
                                        break;
-                               // at least, try if there's an addon for the backend
+                                       // at least, try if there's an addon for the backend
                                case Type\SystemResource::getName():
                                        $this->backendInstances[$name] = new Type\SystemResource();
                                        break;
@@ -228,11 +228,13 @@ class StorageManager
         */
        public function isValidBackend(string $name = null, array $validBackends = null): bool
        {
-               $validBackends = $validBackends ?? array_merge($this->validBackends,
-                               [
-                                       Type\SystemResource::getName(),
-                                       Type\ExternalResource::getName(),
-                               ]);
+               $validBackends = $validBackends ?? array_merge(
+                       $this->validBackends,
+                       [
+                               Type\SystemResource::getName(),
+                               Type\ExternalResource::getName(),
+                       ]
+               );
                return in_array($name, $validBackends);
        }
 
index 85a16c97d66a74ab76c9617f107949b0bc77f4d4..6124bf9f32f6b6bcf89230f780ea037d5c4180e3 100644 (file)
@@ -8,7 +8,6 @@
 namespace Friendica\Test;
 
 use Friendica\Capabilities\ICanCreateResponses;
-use Friendica\Core\Addon;
 use Friendica\Core\Addon\AddonHelper;
 use Friendica\Core\Config\Capability\IManageConfigValues;
 use Friendica\Core\Hook;
@@ -125,7 +124,7 @@ abstract class ApiTestCase extends FixtureTestCase
                file_put_contents(
                        $tmpFile,
                        base64_decode(
-                       // Empty 1x1 px PNG image
+                               // Empty 1x1 px PNG image
                                'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=='
                        )
                );