]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Diaspora/Receive.php
Merge pull request #10166 from mexon/mat/refactor-user-arguments
[friendica.git] / src / Module / Diaspora / Receive.php
index 72b060a8489b0580779c1d69c899e8529e091673..dd3cb30027c173c5bb5ff8640a8cde4c3c3ac507 100644 (file)
@@ -1,11 +1,28 @@
 <?php
+/**
+ * @copyright Copyright (C) 2010-2021, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Module\Diaspora;
 
-use Friendica\App;
 use Friendica\BaseModule;
-use Friendica\Core\Config\Configuration;
-use Friendica\Core\L10n\L10n;
+use Friendica\DI;
 use Friendica\Model\User;
 use Friendica\Network\HTTPException;
 use Friendica\Protocol\Diaspora;
@@ -23,24 +40,18 @@ class Receive extends BaseModule
 
        public static function init(array $parameters = [])
        {
-               /** @var LoggerInterface $logger */
-               self::$logger = self::getClass(LoggerInterface::class);
+               self::$logger = DI::logger();
        }
 
        public static function post(array $parameters = [])
        {
-               /** @var Configuration $config */
-               $config = self::getClass(Configuration::class);
-
-               $enabled = $config->get('system', 'diaspora_enabled', false);
+               $enabled = DI::config()->get('system', 'diaspora_enabled', false);
                if (!$enabled) {
                        self::$logger->info('Diaspora disabled.');
-                       $l10n = self::getClass(L10n::class);
-                       throw new HTTPException\ForbiddenException($l10n->t('Access denied.'));
+                       throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
                }
 
-               /** @var App\Arguments $args */
-               $args = self::getClass(App\Arguments::class);
+               $args = DI::args();
 
                $type = $args->get(1);
 
@@ -137,7 +148,7 @@ class Receive extends BaseModule
                }
 
                self::$logger->info('Diaspora: Post decoded.');
-               self::$logger->debug('Diaspora: Decoded message.', ['msg' => print_r($msg, true)]);
+               self::$logger->debug('Diaspora: Decoded message.', ['msg' => $msg]);
 
                if (!is_array($msg)) {
                        throw new HTTPException\InternalServerErrorException('Message is not an array.');