1
1
Fork 0

some code-beautification

This commit is contained in:
Philipp Holzer 2022-09-25 21:16:56 +02:00
parent ad62265d08
commit 006dbcf4ce
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432

View file

@ -24,6 +24,7 @@ namespace Friendica\Module\Api\Mastodon;
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Factory\Api\Mastodon\Error; use Friendica\Factory\Api\Mastodon\Error;
use Friendica\Factory\Api\Mastodon\Subscription as SubscriptionFactory;
use Friendica\Model\Subscription; use Friendica\Model\Subscription;
use Friendica\Module\Api\ApiResponse; use Friendica\Module\Api\ApiResponse;
use Friendica\Module\BaseApi; use Friendica\Module\BaseApi;
@ -36,12 +37,12 @@ use Psr\Log\LoggerInterface;
*/ */
class PushSubscription extends BaseApi class PushSubscription extends BaseApi
{ {
/** @var \Friendica\Factory\Api\Mastodon\Subscription */ /** @var SubscriptionFactory */
protected $subscriptionFac; protected $subscriptionFac;
/** @var Error */ /** @var Error */
protected $errorFac; protected $errorFac;
public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, \Friendica\Factory\Api\Mastodon\Subscription $subscriptionFac, Error $errorFac, array $server, array $parameters = []) public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, SubscriptionFactory $subscriptionFac, Error $errorFac, array $server, array $parameters = [])
{ {
parent::__construct($app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); parent::__construct($app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
@ -111,8 +112,10 @@ class PushSubscription extends BaseApi
$ret = Subscription::update($application['id'], $uid, $fields); $ret = Subscription::update($application['id'], $uid, $fields);
$this->logger->info('Subscription updated', ['result' => $ret, 'application-id' => $application['id'], $this->logger->info('Subscription updated', [
'uid' => $uid, 'fields' => $fields]); 'result' => $ret, 'application-id' => $application['id'],
'uid' => $uid, 'fields' => $fields
]);
$subscriptionObj = $this->subscriptionFac->createForApplicationIdAndUserId($application['id'], $uid); $subscriptionObj = $this->subscriptionFac->createForApplicationIdAndUserId($application['id'], $uid);
$this->response->exitWithJson($subscriptionObj->toArray()); $this->response->exitWithJson($subscriptionObj->toArray());
@ -126,8 +129,10 @@ class PushSubscription extends BaseApi
$ret = Subscription::delete($application['id'], $uid); $ret = Subscription::delete($application['id'], $uid);
$this->logger->info('Subscription deleted', ['result' => $ret, 'application-id' => $application['id'], $this->logger->info('Subscription deleted', [
'uid' => $uid]); 'result' => $ret, 'application-id' => $application['id'],
'uid' => $uid
]);
$this->response->exitWithJson([]); $this->response->exitWithJson([]);
} }