]> git.mxchange.org Git - friendica.git/commitdiff
Apply suggestions from code review
authorMichael Vogel <icarus@dabo.de>
Sun, 16 Jan 2022 20:47:12 +0000 (21:47 +0100)
committerGitHub <noreply@github.com>
Sun, 16 Jan 2022 20:47:12 +0000 (21:47 +0100)
Co-authored-by: Philipp <admin+Github@philipp.info>
src/Factory/Api/Friendica/Group.php
src/Module/Api/Friendica/Group/Show.php
src/Module/Api/Friendica/Photo/Create.php

index 945971c2854de2064886fa24369cdf8ff10f37ca..b740e4fe92a4659d0e285056fccfc5df8373d929 100644 (file)
@@ -22,7 +22,7 @@
 namespace Friendica\Factory\Api\Friendica;
 
 use Friendica\BaseFactory;
-use Friendica\Database\DBA;
+use Friendica\Database\Database;
 use Friendica\Network\HTTPException;
 use Psr\Log\LoggerInterface;
 use Friendica\Factory\Api\Twitter\User as TwitterUser;
@@ -31,12 +31,15 @@ class Group extends BaseFactory
 {
        /** @var twitterUser entity */
        private $twitterUser;
+       /** @var Database */
+       private $database;
 
-       public function __construct(LoggerInterface $logger, TwitterUser $twitteruser)
+       public function __construct(LoggerInterface $logger, TwitterUser $twitteruser, Database $dba)
        {
                parent::__construct($logger);
 
                $this->twitterUser = $twitteruser;
+               $this->dba = $dba;
        }
 
        /**
@@ -46,7 +49,7 @@ class Group extends BaseFactory
         */
        public function createFromId(int $id): array
        {
-               $group = DBA::selectFirst('group', [], ['id' => $id, 'deleted' => false]);
+               $group = $this->dba->selectFirst('group', [], ['id' => $id, 'deleted' => false]);
                if (empty($group)) {
                        return [];
                }
index d150827694b5a33b10c8607b1ded3c7e79f4ad0f..8a479930d5756bb097dc39efc2581e484aa34496 100644 (file)
@@ -22,7 +22,6 @@
 namespace Friendica\Module\Api\Friendica\Group;
 
 use Friendica\Database\DBA;
-use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Module\BaseApi;
 use Friendica\Network\HTTPException;
index b0dc5d7a1442038837d22be3346f391f8d1d64fe..c207820b0ffe36acadc3a17ce61157a8a832a6b2 100644 (file)
@@ -90,7 +90,6 @@ class Create extends BaseApi
                if (!empty($photo)) {
                        $data = ['photo' => $this->friendicaPhoto->createFromId($photo['resource_id'], null, $uid, $type)];
                        $this->response->exit('photo_create', $data, $this->parameters['extension'] ?? null);
-                       return;
                } else {
                        throw new HTTPException\InternalServerErrorException('unknown error - uploading photo failed, see Friendica log for more information');
                }