[TOOLS] Run CS-Fixer on whole project
This commit is contained in:
parent
255c44bbf0
commit
45c7888676
|
@ -27,10 +27,7 @@ use App\Core\ActorLocalRoles;
|
|||
use App\Core\Controller;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Router\Router;
|
||||
use App\Core\VisibilityScope;
|
||||
use App\Entity\Actor;
|
||||
use App\Util\Common;
|
||||
|
@ -38,13 +35,15 @@ use App\Util\Exception\ClientException;
|
|||
use App\Util\Exception\RedirectException;
|
||||
use App\Util\Form\FormFields;
|
||||
use Component\Posting\Posting;
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FormSizeFileException;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
|
||||
class Post extends Controller
|
||||
|
@ -74,23 +73,22 @@ class Post extends Controller
|
|||
];
|
||||
Event::handle('PostingAvailableContentTypes', [&$available_content_types]);
|
||||
|
||||
if (!is_int($this->int('in'))) {
|
||||
throw new \InvalidArgumentException('You must specify an In group/org.');
|
||||
if (!\is_int($this->int('in'))) {
|
||||
throw new InvalidArgumentException('You must specify an In group/org.');
|
||||
}
|
||||
$context_actor = Actor::getById($this->int('in'));
|
||||
if (!$context_actor->isGroup()) {
|
||||
throw new \InvalidArgumentException('Only group blog posts are supported for now.');
|
||||
throw new InvalidArgumentException('Only group blog posts are supported for now.');
|
||||
}
|
||||
$in_targets = ["!{$context_actor->getNickname()}" => $context_actor->getId()];
|
||||
$in_targets = ["!{$context_actor->getNickname()}" => $context_actor->getId()];
|
||||
$form_params[] = ['in', ChoiceType::class, ['label' => _m('In:'), 'multiple' => false, 'expanded' => false, 'choices' => $in_targets]];
|
||||
|
||||
|
||||
$visibility_options = [
|
||||
_m('Public') => VisibilityScope::EVERYWHERE->value,
|
||||
_m('Local') => VisibilityScope::LOCAL->value,
|
||||
_m('Addressee') => VisibilityScope::ADDRESSEE->value,
|
||||
];
|
||||
if (!\is_null($context_actor) && $context_actor->isGroup()) {
|
||||
if (!\is_null($context_actor) && $context_actor->isGroup()) { // @phpstan-ignore-line currently an open bug. See https://web.archive.org/web/20220226131651/https://github.com/phpstan/phpstan/issues/6234
|
||||
if ($actor->canModerate($context_actor)) {
|
||||
if ($context_actor->getRoles() & ActorLocalRoles::PRIVATE_GROUP) {
|
||||
$visibility_options = array_merge([_m('Group') => VisibilityScope::GROUP->value], $visibility_options);
|
||||
|
@ -147,7 +145,7 @@ class Post extends Controller
|
|||
content_type: $content_type,
|
||||
locale: $data['language'],
|
||||
scope: VisibilityScope::from($data['visibility']),
|
||||
targets: [(int)$data['in']],
|
||||
targets: [(int) $data['in']],
|
||||
reply_to: $data['reply_to_id'],
|
||||
attachments: $data['attachments'],
|
||||
process_note_content_extra_args: $extra_args,
|
||||
|
|
|
@ -49,7 +49,7 @@ class ActorCircle extends Entity
|
|||
// {{{ Autocode
|
||||
// @codeCoverageIgnoreStart
|
||||
private int $id;
|
||||
private ?int $tagger = null; // If null, is the special global self-tag circle
|
||||
private ?int $tagger = null;
|
||||
private string $tag;
|
||||
private ?string $description = null;
|
||||
private ?bool $private = false;
|
||||
|
@ -202,7 +202,7 @@ class ActorCircle extends Entity
|
|||
'description' => 'An actor can have lists of actors, to separate their feed or quickly mention his friend',
|
||||
'fields' => [
|
||||
'id' => ['type' => 'serial', 'not null' => true, 'description' => 'unique identifier'], // An actor can be tagged by many actors
|
||||
'tagger' => ['type' => 'int', 'default' => null, 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'many to one', 'name' => 'actor_list_tagger_fkey', 'description' => 'user making the tag, null if self-tag'],
|
||||
'tagger' => ['type' => 'int', 'default' => null, 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'many to one', 'name' => 'actor_list_tagger_fkey', 'description' => 'user making the tag, null if self-tag. If null, is the special global self-tag circle'],
|
||||
'tag' => ['type' => 'varchar', 'length' => 64, 'foreign key' => true, 'target' => 'ActorTag.tag', 'multiplicity' => 'many to one', 'not null' => true, 'description' => 'actor tag'], // Join with ActorTag // // so, Doctrine doesn't like that the target is not unique, even though the pair is // Many Actor Circles can reference (and probably will) an Actor Tag
|
||||
'description' => ['type' => 'text', 'description' => 'description of the people tag'],
|
||||
'private' => ['type' => 'bool', 'default' => false, 'description' => 'is this tag private'],
|
||||
|
|
|
@ -28,7 +28,6 @@ use App\Core\Cache;
|
|||
use App\Core\Controller;
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Form;
|
||||
use App\Util\Nickname;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Log;
|
||||
use App\Entity as E;
|
||||
|
@ -45,6 +44,7 @@ use App\Util\Exception\NotFoundException;
|
|||
use App\Util\Exception\RedirectException;
|
||||
use App\Util\Exception\ServerException;
|
||||
use App\Util\Form\ActorForms;
|
||||
use App\Util\Nickname;
|
||||
use Component\Group\Entity\GroupMember;
|
||||
use Component\Group\Entity\LocalGroup;
|
||||
use Component\Subscription\Entity\ActorSubscription;
|
||||
|
@ -135,7 +135,7 @@ class Group extends Controller
|
|||
nickname: $data['group_nickname'],
|
||||
check_already_used: true,
|
||||
which: Nickname::CHECK_LOCAL_GROUP,
|
||||
check_is_allowed: true
|
||||
check_is_allowed: true,
|
||||
);
|
||||
|
||||
$roles = ActorLocalRoles::VISITOR; // Can send direct messages to other actors
|
||||
|
@ -146,7 +146,7 @@ class Group extends Controller
|
|||
|
||||
Log::info(
|
||||
_m(
|
||||
'Actor id:{actor_id} nick:{actor_nick} created the '.($roles & ActorLocalRoles::PRIVATE_GROUP ? 'private' : 'public').' group {nickname}',
|
||||
'Actor id:{actor_id} nick:{actor_nick} created the ' . ($roles & ActorLocalRoles::PRIVATE_GROUP ? 'private' : 'public') . ' group {nickname}',
|
||||
['{actor_id}' => $actor->getId(), 'actor_nick' => $actor->getNickname(), 'nickname' => $nickname],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -45,7 +45,7 @@ class GroupMember extends Entity
|
|||
private int $group_id;
|
||||
private int $actor_id;
|
||||
private int $roles;
|
||||
private ?string $uri = null;
|
||||
private ?string $uri = null;
|
||||
private DateTimeInterface $created;
|
||||
private DateTimeInterface $modified;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class LocalGroup extends Entity
|
|||
// @codeCoverageIgnoreStart
|
||||
private int $actor_id;
|
||||
private string $nickname;
|
||||
private string $type;
|
||||
private string $type = 'group';
|
||||
private DateTimeInterface $created;
|
||||
private DateTimeInterface $modified;
|
||||
|
||||
|
@ -81,7 +81,7 @@ class LocalGroup extends Entity
|
|||
|
||||
public function setType(string $type): self
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->type = mb_substr($type, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ namespace Component\Notification;
|
|||
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Util\Exception\ServerException;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Log;
|
||||
use App\Core\Modules\Component;
|
||||
|
@ -32,15 +31,14 @@ use App\Core\Router\Router;
|
|||
use App\Entity\Activity;
|
||||
use App\Entity\Actor;
|
||||
use App\Entity\LocalUser;
|
||||
use App\Util\Exception\ServerException;
|
||||
use Component\FreeNetwork\FreeNetwork;
|
||||
use Component\Notification\Controller\Feed;
|
||||
use Exception;
|
||||
use Throwable;
|
||||
|
||||
class Notification extends Component
|
||||
{
|
||||
/**
|
||||
* @param RouteLoader $m
|
||||
* @return bool
|
||||
*/
|
||||
public function onAddRoute(RouteLoader $m): bool
|
||||
{
|
||||
$m->connect('feed_notifications', '/feed/notifications', [Feed::class, 'notifications']);
|
||||
|
@ -48,10 +46,6 @@ class Notification extends Component
|
|||
}
|
||||
|
||||
/**
|
||||
* @param int $actor_id
|
||||
* @param LocalUser $user
|
||||
* @param int $ordering
|
||||
* @return bool
|
||||
* @throws ServerException
|
||||
*/
|
||||
public function onCreateDefaultFeeds(int $actor_id, LocalUser $user, int &$ordering): bool
|
||||
|
@ -69,11 +63,6 @@ class Notification extends Component
|
|||
/**
|
||||
* Enqueues a notification for an Actor (such as person or group) which means
|
||||
* it shows up in their home feed and such.
|
||||
* @param Actor $sender
|
||||
* @param Activity $activity
|
||||
* @param array $ids_already_known
|
||||
* @param string|null $reason
|
||||
* @return bool
|
||||
*/
|
||||
public function onNewNotification(Actor $sender, Activity $activity, array $ids_already_known = [], ?string $reason = null): bool
|
||||
{
|
||||
|
@ -87,11 +76,6 @@ class Notification extends Component
|
|||
|
||||
/**
|
||||
* Bring given Activity to Targets's attention
|
||||
* @param Actor $sender
|
||||
* @param Activity $activity
|
||||
* @param array $targets
|
||||
* @param string|null $reason
|
||||
* @return bool
|
||||
*/
|
||||
public static function notify(Actor $sender, Activity $activity, array $targets, ?string $reason = null): bool
|
||||
{
|
||||
|
@ -125,11 +109,10 @@ class Notification extends Component
|
|||
'target_id' => $target->getId(),
|
||||
'reason' => $reason,
|
||||
])));
|
||||
} catch (\Exception|\Throwable $e) {
|
||||
} catch (Exception|Throwable $e) {
|
||||
// We do our best not to record duplicated notifications, but it's not insane that can happen
|
||||
Log::error('It was attempted to record an invalid notification!', [$e]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FreeNetwork::notify($sender, $activity, $remote_targets, $reason);
|
||||
|
|
|
@ -25,10 +25,10 @@ namespace Component\Search;
|
|||
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use App\Util\Exception\ClientException;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Modules\Component;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\ClientException;
|
||||
use App\Util\Exception\RedirectException;
|
||||
use App\Util\Formatting;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
|
|
@ -50,13 +50,24 @@ class NoteTag extends Entity
|
|||
{
|
||||
// {{{ Autocode
|
||||
// @codeCoverageIgnoreStart
|
||||
private int $note_id;
|
||||
private string $tag;
|
||||
private string $canonical;
|
||||
private int $note_id;
|
||||
private bool $use_canonical;
|
||||
private ?int $language_id = null;
|
||||
private DateTimeInterface $created;
|
||||
|
||||
public function setNoteId(int $note_id): self
|
||||
{
|
||||
$this->note_id = $note_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNoteId(): int
|
||||
{
|
||||
return $this->note_id;
|
||||
}
|
||||
|
||||
public function setTag(string $tag): self
|
||||
{
|
||||
$this->tag = mb_substr($tag, 0, 64);
|
||||
|
@ -79,17 +90,6 @@ class NoteTag extends Entity
|
|||
return $this->canonical;
|
||||
}
|
||||
|
||||
public function setNoteId(int $note_id): self
|
||||
{
|
||||
$this->note_id = $note_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNoteId(): int
|
||||
{
|
||||
return $this->note_id;
|
||||
}
|
||||
|
||||
public function setUseCanonical(bool $use_canonical): self
|
||||
{
|
||||
$this->use_canonical = $use_canonical;
|
||||
|
|
|
@ -102,7 +102,7 @@ class Inbox extends Controller
|
|||
try {
|
||||
$resource_parts = parse_url($type->get('actor'));
|
||||
if ($resource_parts['host'] !== Common::config('site', 'server')) {
|
||||
$actor = DB::wrapInTransaction(fn () => Explorer::getOneFromUri($type->get('actor')));
|
||||
$actor = DB::wrapInTransaction(fn () => Explorer::getOneFromUri($type->get('actor')));
|
||||
$ap_actor = DB::findOneBy(ActivitypubActor::class, ['actor_id' => $actor->getId()]);
|
||||
} else {
|
||||
throw new Exception('Only remote actors can use this endpoint.');
|
||||
|
|
|
@ -32,15 +32,13 @@ declare(strict_types = 1);
|
|||
|
||||
namespace Plugin\ActivityPub\Controller;
|
||||
|
||||
use App\Core\DB\DB;
|
||||
use App\Entity\Actor;
|
||||
use Component\Notification\Entity\Notification;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Log;
|
||||
use App\Core\Router\Router;
|
||||
use App\Entity\Activity;
|
||||
use App\Entity\Actor;
|
||||
use App\Util\Exception\ClientException;
|
||||
use Exception;
|
||||
use Component\Notification\Entity\Notification;
|
||||
use Plugin\ActivityPub\Util\OrderedCollectionController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
@ -58,7 +56,7 @@ class Outbox extends OrderedCollectionController
|
|||
public function viewOutboxByActorId(Request $request, int $gsactor_id): array
|
||||
{
|
||||
$actor = Actor::getById($gsactor_id);
|
||||
if (is_null($actor)) {
|
||||
if (\is_null($actor)) {
|
||||
throw new ClientException(_m('No such actor.'), 404);
|
||||
} elseif (!$actor->getIsLocal()) {
|
||||
throw new ClientException(_m('We have no authority over a remote actor\'s outbox.'), 400);
|
||||
|
|
|
@ -231,7 +231,7 @@ class Explorer
|
|||
return true;
|
||||
} else {
|
||||
try {
|
||||
$this->discovered_actors[] = DB::wrapInTransaction(fn() => Model\Actor::fromJson(json_encode($res)))->getActor();
|
||||
$this->discovered_actors[] = DB::wrapInTransaction(fn () => Model\Actor::fromJson(json_encode($res)))->getActor();
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
Log::debug(
|
||||
|
|
|
@ -143,7 +143,7 @@ class HTTPSignature
|
|||
{
|
||||
// We need this because the used Request headers fields specified by Signature are in lower case.
|
||||
$headersContent = array_change_key_case($inputHeaders, \CASE_LOWER);
|
||||
$digest = 'SHA-256=' . base64_encode(hash('sha256', $body, true));
|
||||
$digest = 'SHA-256=' . base64_encode(hash('sha256', $body, true));
|
||||
$headersToSign = [];
|
||||
foreach (explode(' ', $signatureData['headers']) as $h) {
|
||||
if ($h == '(request-target)') {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
declare(strict_types = 1);
|
||||
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
|
@ -48,15 +48,15 @@ class ActivityAnnounce extends Activity
|
|||
// The only core Announce we recognise is for (transitive) activities coming from Group actors
|
||||
if ($actor->isGroup()) {
|
||||
if ($type_object instanceof AbstractObject) {
|
||||
$actual_to = array_flip(is_string($type_object->get('to')) ? [$type_object->get('to')] : $type_object->get('to'));
|
||||
$actual_cc = array_flip(is_string($type_object->get('cc')) ? [$type_object->get('cc')] : $type_object->get('cc'));
|
||||
$actual_to = array_flip(\is_string($type_object->get('to')) ? [$type_object->get('to')] : $type_object->get('to'));
|
||||
$actual_cc = array_flip(\is_string($type_object->get('cc')) ? [$type_object->get('cc')] : $type_object->get('cc'));
|
||||
$actual_cc[$type_activity->get('actor')] = true; // Add group to targets
|
||||
foreach (is_string($type_activity->get('to')) ? [$type_activity->get('to')] : $type_activity->get('to') as $to) {
|
||||
foreach (\is_string($type_activity->get('to')) ? [$type_activity->get('to')] : $type_activity->get('to') as $to) {
|
||||
if ($to !== 'https://www.w3.org/ns/activitystreams#Public') {
|
||||
$actual_to[$to] = true;
|
||||
}
|
||||
}
|
||||
foreach (is_string($type_activity->get('cc')) ? [$type_activity->get('cc')] : $type_activity->get('cc') as $cc) {
|
||||
foreach (\is_string($type_activity->get('cc')) ? [$type_activity->get('cc')] : $type_activity->get('cc') as $cc) {
|
||||
if ($cc !== 'https://www.w3.org/ns/activitystreams#Public') {
|
||||
$actual_cc[$cc] = true;
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ namespace Plugin\Favourite\Controller;
|
|||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use App\Entity\Actor;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Log;
|
||||
use App\Core\Router\Router;
|
||||
use App\Entity\Actor;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\ClientException;
|
||||
use App\Util\Exception\InvalidFormException;
|
||||
|
@ -137,7 +137,6 @@ class Favourite extends FeedController
|
|||
if (!\is_null($activity = \Plugin\Favourite\Favourite::unfavourNote(note_id: $id, actor_id: $actor_id))) {
|
||||
DB::flush();
|
||||
Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $activity, [], _m('{nickname} unfavoured note {note_id}.', ['{nickname}' => $actor->getNickname(), '{note_id}' => $activity->getObjectId()])]);
|
||||
|
||||
} else {
|
||||
throw new ClientException(_m('Note already unfavoured!'));
|
||||
}
|
||||
|
|
|
@ -48,20 +48,15 @@ class AccessToken extends Token implements AccessTokenEntityInterface
|
|||
private bool $revoked;
|
||||
private DateTimeInterface $created;
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(string $id): self
|
||||
{
|
||||
$this->id = mb_substr($id, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getExpiry(): DateTimeInterface
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->expiry;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setExpiry(DateTimeInterface $expiry): self
|
||||
|
@ -70,9 +65,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getUserId(): ?int
|
||||
public function getExpiry(): DateTimeInterface
|
||||
{
|
||||
return $this->user_id;
|
||||
return $this->expiry;
|
||||
}
|
||||
|
||||
public function setUserId(?int $user_id): self
|
||||
|
@ -81,9 +76,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getClientId(): string
|
||||
public function getUserId(): ?int
|
||||
{
|
||||
return $this->client_id;
|
||||
return $this->user_id;
|
||||
}
|
||||
|
||||
public function setClientId(string $client_id): self
|
||||
|
@ -92,9 +87,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getTokenScopes(): string
|
||||
public function getClientId(): string
|
||||
{
|
||||
return $this->token_scopes;
|
||||
return $this->client_id;
|
||||
}
|
||||
|
||||
public function setTokenScopes(string $token_scopes): self
|
||||
|
@ -103,9 +98,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getRevoked(): bool
|
||||
public function getTokenScopes(): string
|
||||
{
|
||||
return $this->revoked;
|
||||
return $this->token_scopes;
|
||||
}
|
||||
|
||||
public function setRevoked(bool $revoked): self
|
||||
|
@ -114,9 +109,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
public function getRevoked(): bool
|
||||
{
|
||||
return $this->created;
|
||||
return $this->revoked;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
|
@ -125,6 +120,11 @@ class AccessToken extends Token implements AccessTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
|
|
|
@ -48,20 +48,15 @@ class AuthCode extends Token implements AuthCodeEntityInterface
|
|||
private bool $revoked;
|
||||
private DateTimeInterface $created;
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(string $id): self
|
||||
{
|
||||
$this->id = mb_substr($id, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getExpiry(): DateTimeInterface
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->expiry;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setExpiry(DateTimeInterface $expiry): self
|
||||
|
@ -70,9 +65,9 @@ class AuthCode extends Token implements AuthCodeEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getUserId(): ?int
|
||||
public function getExpiry(): DateTimeInterface
|
||||
{
|
||||
return $this->user_id;
|
||||
return $this->expiry;
|
||||
}
|
||||
|
||||
public function setUserId(?int $user_id): self
|
||||
|
@ -81,9 +76,20 @@ class AuthCode extends Token implements AuthCodeEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getTokenScopes(): string
|
||||
public function getUserId(): ?int
|
||||
{
|
||||
return $this->token_scopes;
|
||||
return $this->user_id;
|
||||
}
|
||||
|
||||
public function setClientId(string $client_id): self
|
||||
{
|
||||
$this->client_id = mb_substr($client_id, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getClientId(): string
|
||||
{
|
||||
return $this->client_id;
|
||||
}
|
||||
|
||||
public function setTokenScopes(string $token_scopes): self
|
||||
|
@ -92,9 +98,9 @@ class AuthCode extends Token implements AuthCodeEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getRevoked(): bool
|
||||
public function getTokenScopes(): string
|
||||
{
|
||||
return $this->revoked;
|
||||
return $this->token_scopes;
|
||||
}
|
||||
|
||||
public function setRevoked(bool $revoked): self
|
||||
|
@ -103,9 +109,9 @@ class AuthCode extends Token implements AuthCodeEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
public function getRevoked(): bool
|
||||
{
|
||||
return $this->created;
|
||||
return $this->revoked;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
|
@ -114,20 +120,14 @@ class AuthCode extends Token implements AuthCodeEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
public function getClientId(): string
|
||||
{
|
||||
return $this->client_id;
|
||||
}
|
||||
|
||||
public function setClientId(string $client_id): self
|
||||
{
|
||||
$this->client_id = mb_substr($client_id, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRedirectUri(): ?string
|
||||
{
|
||||
/** @var Client $client */
|
||||
|
|
|
@ -52,20 +52,15 @@ class Client extends Entity implements ClientEntityInterface
|
|||
private DateTimeInterface $created;
|
||||
private DateTimeInterface $modified;
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(string $id): self
|
||||
{
|
||||
$this->id = mb_substr($id, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSecret(): string
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->secret;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setSecret(string $secret): self
|
||||
|
@ -74,9 +69,9 @@ class Client extends Entity implements ClientEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getActive(): bool
|
||||
public function getSecret(): string
|
||||
{
|
||||
return $this->active;
|
||||
return $this->secret;
|
||||
}
|
||||
|
||||
public function setActive(bool $active): self
|
||||
|
@ -85,9 +80,9 @@ class Client extends Entity implements ClientEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getPlainPcke(): bool
|
||||
public function getActive(): bool
|
||||
{
|
||||
return $this->plain_pcke;
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setPlainPcke(bool $plain_pcke): self
|
||||
|
@ -96,9 +91,9 @@ class Client extends Entity implements ClientEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getIsConfidential(): bool
|
||||
public function getPlainPcke(): bool
|
||||
{
|
||||
return $this->is_confidential;
|
||||
return $this->plain_pcke;
|
||||
}
|
||||
|
||||
public function setIsConfidential(bool $is_confidential): self
|
||||
|
@ -107,9 +102,9 @@ class Client extends Entity implements ClientEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getRedirectUris(): string
|
||||
public function getIsConfidential(): bool
|
||||
{
|
||||
return $this->redirect_uris;
|
||||
return $this->is_confidential;
|
||||
}
|
||||
|
||||
public function setRedirectUris(string $redirect_uris): self
|
||||
|
@ -118,9 +113,9 @@ class Client extends Entity implements ClientEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getGrants(): string
|
||||
public function getRedirectUris(): string
|
||||
{
|
||||
return $this->grants;
|
||||
return $this->redirect_uris;
|
||||
}
|
||||
|
||||
public function setGrants(string $grants): self
|
||||
|
@ -129,9 +124,9 @@ class Client extends Entity implements ClientEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getScopes(): string
|
||||
public function getGrants(): string
|
||||
{
|
||||
return $this->scopes;
|
||||
return $this->grants;
|
||||
}
|
||||
|
||||
public function setScopes(string $scopes): self
|
||||
|
@ -140,6 +135,11 @@ class Client extends Entity implements ClientEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getScopes(): string
|
||||
{
|
||||
return $this->scopes;
|
||||
}
|
||||
|
||||
public function setClientName(string $client_name): self
|
||||
{
|
||||
$this->client_name = mb_substr($client_name, 0, 191);
|
||||
|
@ -151,20 +151,15 @@ class Client extends Entity implements ClientEntityInterface
|
|||
return $this->client_name;
|
||||
}
|
||||
|
||||
public function getWebsite(): ?string
|
||||
{
|
||||
return $this->website;
|
||||
}
|
||||
|
||||
public function setWebsite(?string $website): self
|
||||
{
|
||||
$this->website = $website;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
public function getWebsite(): ?string
|
||||
{
|
||||
return $this->created;
|
||||
return $this->website;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
|
@ -173,9 +168,9 @@ class Client extends Entity implements ClientEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getModified(): DateTimeInterface
|
||||
public function getCreated(): DateTimeInterface
|
||||
{
|
||||
return $this->modified;
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
public function setModified(DateTimeInterface $modified): self
|
||||
|
@ -183,6 +178,12 @@ class Client extends Entity implements ClientEntityInterface
|
|||
$this->modified = $modified;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getModified(): DateTimeInterface
|
||||
{
|
||||
return $this->modified;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
|
|
|
@ -48,20 +48,15 @@ class RefreshToken extends Entity implements RefreshTokenEntityInterface
|
|||
private bool $revoked;
|
||||
private DateTimeInterface $created;
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(string $id): self
|
||||
{
|
||||
$this->id = mb_substr($id, 0, 64);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getExpiry(): DateTimeInterface
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->expiry;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setExpiry(DateTimeInterface $expiry): self
|
||||
|
@ -70,9 +65,9 @@ class RefreshToken extends Entity implements RefreshTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getAccessTokenId(): ?string
|
||||
public function getExpiry(): DateTimeInterface
|
||||
{
|
||||
return $this->access_token_id;
|
||||
return $this->expiry;
|
||||
}
|
||||
|
||||
public function setAccessTokenId(?string $access_token_id): self
|
||||
|
@ -81,9 +76,9 @@ class RefreshToken extends Entity implements RefreshTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getRevoked(): bool
|
||||
public function getAccessTokenId(): ?string
|
||||
{
|
||||
return $this->revoked;
|
||||
return $this->access_token_id;
|
||||
}
|
||||
|
||||
public function setRevoked(bool $revoked): self
|
||||
|
@ -92,9 +87,9 @@ class RefreshToken extends Entity implements RefreshTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
public function getRevoked(): bool
|
||||
{
|
||||
return $this->created;
|
||||
return $this->revoked;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
|
@ -103,6 +98,11 @@ class RefreshToken extends Entity implements RefreshTokenEntityInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ use App\Core\Controller;
|
|||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use App\Entity\Actor;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Log;
|
||||
use App\Core\Router\Router;
|
||||
use App\Entity\Actor;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\ClientException;
|
||||
|
@ -77,7 +77,6 @@ class Repeat extends Controller
|
|||
DB::flush();
|
||||
Event::handle('NewNotification', [$actor = Actor::getById($actor_id), $repeat_activity, [], _m('{nickname} repeated note {note_id}.', ['{nickname}' => $actor->getNickname(), '{note_id}' => $repeat_activity->getObjectId()])]);
|
||||
|
||||
|
||||
// Redirect user to where they came from
|
||||
// Prevent open redirect
|
||||
if (!\is_null($from = $this->string('from'))) {
|
||||
|
|
|
@ -65,7 +65,7 @@ class NoteRepeat extends Entity
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getActorId(): ?int
|
||||
public function getActorId(): int
|
||||
{
|
||||
return $this->actor_id;
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ class NoteRepeat extends Entity
|
|||
{
|
||||
return $this->repeat_of;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
// }}} Autocode
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class ActorProfile extends Controller
|
|||
{
|
||||
public function actorViewId(Request $request, int $id): array
|
||||
{
|
||||
$actor = Actor::getById($id);
|
||||
$actor = Actor::getById($id);
|
||||
$route_id = match ($actor->getType()) {
|
||||
Actor::PERSON => 'person_actor_view_id',
|
||||
Actor::GROUP => 'group_actor_view_id',
|
||||
|
|
|
@ -137,18 +137,14 @@ abstract class Form
|
|||
|
||||
/**
|
||||
* Handle the full life cycle of a form. Creates it with @param array $form_definition
|
||||
* @param Request $request
|
||||
* @param object|null $target
|
||||
*
|
||||
* @param array $extra_args If specified, is used as $target->set($data[$key], $extra_args[$key])
|
||||
* @param callable|null $after_step
|
||||
* @param array $create_args
|
||||
* @param SymfForm|null $testing_only_form
|
||||
* @return mixed
|
||||
*
|
||||
* @throws RedirectException
|
||||
* @throws ServerException
|
||||
*
|
||||
* @see
|
||||
* self::create and inserts the submitted values into the database
|
||||
*
|
||||
*/
|
||||
public static function handle(array $form_definition, Request $request, ?object $target, array $extra_args = [], ?callable $before_step = null, ?callable $after_step = null, array $create_args = [], ?SymfForm $testing_only_form = null): mixed
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ class Note extends Entity
|
|||
|
||||
public function setContentType(string $content_type): self
|
||||
{
|
||||
$this->content_type = mb_substr($content_type, 0, 129);
|
||||
$this->content_type = \mb_substr($content_type, 0, 129);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ class Note extends Entity
|
|||
|
||||
public function setSource(?string $source): self
|
||||
{
|
||||
$this->source = \is_null($source) ? null : mb_substr($source, 0, 32);
|
||||
$this->source = \is_null($source) ? null : \mb_substr($source, 0, 32);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ class Note extends Entity
|
|||
|
||||
public function setTitle(?string $title): self
|
||||
{
|
||||
$this->title = \is_null($title) ? null : mb_substr($title, 0, 129);
|
||||
$this->title = \is_null($title) ? null : \mb_substr($title, 0, 129);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -233,24 +233,24 @@ class Note extends Entity
|
|||
return $this->title;
|
||||
}
|
||||
|
||||
public function setCreated(DateTimeInterface $created): self
|
||||
public function setCreated(\DateTimeInterface $created): self
|
||||
{
|
||||
$this->created = $created;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreated(): DateTimeInterface
|
||||
public function getCreated(): \DateTimeInterface
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
public function setModified(DateTimeInterface $modified): self
|
||||
public function setModified(\DateTimeInterface $modified): self
|
||||
{
|
||||
$this->modified = $modified;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getModified(): DateTimeInterface
|
||||
public function getModified(): \DateTimeInterface
|
||||
{
|
||||
return $this->modified;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class ActorForms
|
|||
|
||||
// Validate full name
|
||||
if ($target->getFullname() !== $data['full_name']) {
|
||||
if (!is_null($data['full_name'])) {
|
||||
if (!\is_null($data['full_name'])) {
|
||||
if (mb_strlen($data['full_name']) > 64) {
|
||||
throw new ClientException(_m('Full name cannot be more than 64 character long.'));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user