[AUTOGENERATED] Update auto generated code

This commit is contained in:
Hugo Sales 2021-12-26 15:12:06 +00:00 committed by Diogo Peralta Cordeiro
parent 68076d73dd
commit c79b1e4c94
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0
61 changed files with 426 additions and 434 deletions

View File

@ -59,7 +59,7 @@ class Attachment extends Entity
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $id;
private int $lives = 1;
private int $lives;
private ?string $filehash;
private ?string $mimetype;
private ?string $filename;
@ -79,19 +79,20 @@ class Attachment extends Entity
return $this->id;
}
public function setLives(int $lives): self
{
$this->lives = $lives;
return $this;
}
public function getLives(): int
{
return $this->lives;
}
public function setLives(int $lives): void
{
$this->lives = $lives;
}
public function setFilehash(?string $filehash): self
{
$this->filehash = $filehash;
$this->filehash = mb_substr($filehash, 0, 64);
return $this;
}
@ -102,7 +103,7 @@ class Attachment extends Entity
public function setMimetype(?string $mimetype): self
{
$this->mimetype = $mimetype;
$this->mimetype = mb_substr($mimetype, 0, 255);
return $this;
}
@ -113,7 +114,7 @@ class Attachment extends Entity
public function setFilename(?string $filename): self
{
$this->filename = $filename;
$this->filename = mb_substr($filename, 0, 191);
return $this;
}
@ -317,7 +318,6 @@ class Attachment extends Entity
Event::handle('AttachmentGetBestTitle', [$this, $note, &$title]);
return $title;
}
});
if ($title != null) {
return $title;

View File

@ -66,12 +66,11 @@ class AttachmentThumbnail extends Entity
'medium' => self::SIZE_MEDIUM,
'big' => self::SIZE_BIG,
];
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $attachment_id;
private ?string $mimetype;
private int $size = self::SIZE_SMALL;
private int $size = 0;
private string $filename;
private int $width;
private int $height;
@ -90,7 +89,7 @@ class AttachmentThumbnail extends Entity
public function setMimetype(?string $mimetype): self
{
$this->mimetype = $mimetype;
$this->mimetype = mb_substr($mimetype, 0, 129);
return $this;
}
@ -99,20 +98,20 @@ class AttachmentThumbnail extends Entity
return $this->mimetype;
}
public function getSize(): int
{
return $this->size;
}
public function setSize(int $size): self
{
$this->size = $size;
return $this;
}
public function getSize(): int
{
return $this->size;
}
public function setFilename(string $filename): self
{
$this->filename = $filename;
$this->filename = mb_substr($filename, 0, 191);
return $this;
}
@ -121,6 +120,28 @@ class AttachmentThumbnail extends Entity
return $this->filename;
}
public function setWidth(int $width): self
{
$this->width = $width;
return $this;
}
public function getWidth(): int
{
return $this->width;
}
public function setHeight(int $height): self
{
$this->height = $height;
return $this;
}
public function getHeight(): int
{
return $this->height;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
@ -132,28 +153,6 @@ class AttachmentThumbnail extends Entity
return $this->modified;
}
public function getWidth(): int
{
return $this->width;
}
public function setWidth(int $width): self
{
$this->width = $width;
return $this;
}
public function getHeight(): int
{
return $this->height;
}
public function setHeight(int $height): self
{
$this->height = $height;
return $this;
}
// @codeCoverageIgnoreEnd
// }}} Autocode

View File

@ -39,21 +39,10 @@ class AttachmentToLink extends Entity
{
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $attachment_id;
private int $link_id;
private int $attachment_id;
private DateTimeInterface $modified;
public function setAttachmentId(int $attachment_id): self
{
$this->attachment_id = $attachment_id;
return $this;
}
public function getAttachmentId(): int
{
return $this->attachment_id;
}
public function setLinkId(int $link_id): self
{
$this->link_id = $link_id;
@ -65,6 +54,17 @@ class AttachmentToLink extends Entity
return $this->link_id;
}
public function setAttachmentId(int $attachment_id): self
{
$this->attachment_id = $attachment_id;
return $this;
}
public function getAttachmentId(): int
{
return $this->attachment_id;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;

View File

@ -77,16 +77,17 @@ class Avatar extends Entity
return $this->attachment_id;
}
public function setTitle(?string $title): self
{
$this->title = mb_substr($title, 0, 191);
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): void
{
$this->title = $title;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;

View File

@ -88,7 +88,7 @@ class ForeignLink
public function setCredentials(?string $credentials): self
{
$this->credentials = $credentials;
$this->credentials = mb_substr($credentials, 0, 191);
return $this;
}

View File

@ -60,7 +60,7 @@ class ForeignService
public function setName(string $name): self
{
$this->name = $name;
$this->name = mb_substr($name, 0, 32);
return $this;
}
@ -71,7 +71,7 @@ class ForeignService
public function setDescription(?string $description): self
{
$this->description = $description;
$this->description = mb_substr($description, 0, 191);
return $this;
}

View File

@ -72,7 +72,7 @@ class ForeignUser
public function setUri(string $uri): self
{
$this->uri = $uri;
$this->uri = mb_substr($uri, 0, 191);
return $this;
}
@ -83,7 +83,7 @@ class ForeignUser
public function setNickname(?string $nickname): self
{
$this->nickname = $nickname;
$this->nickname = mb_substr($nickname, 0, 191);
return $this;
}

View File

@ -46,7 +46,6 @@ class Conversation extends Entity
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $id;
private string $uri;
private int $initial_note_id;
public function setId(int $id): self

View File

@ -38,7 +38,6 @@ use App\Core\Log;
use App\Core\VisibilityScope;
use App\Entity\Actor;
use App\Util\Common;
use function array_key_exists;
abstract class FeedController extends Controller
{
@ -51,7 +50,7 @@ abstract class FeedController extends Controller
{
$actor = Common::actor();
if (array_key_exists('notes', $result)) {
if (\array_key_exists('notes', $result)) {
$notes = $result['notes'];
self::enforceScope($notes, $actor);
Event::handle('FilterNoteList', [$actor, &$notes, $result['request']]);
@ -64,20 +63,20 @@ abstract class FeedController extends Controller
private static function enforceScope(array &$notes, ?Actor $actor): void
{
$filtered_notes = [];
foreach($notes as $note) {
switch($note->getScope()) {
foreach ($notes as $note) {
switch ($note->getScope()) {
case VisibilityScope::LOCAL: // The controller handles it if private
case VisibilityScope::PUBLIC:
$filtered_notes[] = $note;
break;
case VisibilityScope::ADDRESSEE:
// If the actor is logged in and
if (!is_null($actor) &&
(
if (!\is_null($actor)
&& (
// Is either the author Or
$note->getActorId() == $actor->getId() ||
$note->getActorId() == $actor->getId()
// one of the targets
in_array($actor->getId(), $note->getNotificationTargetIds())
|| \in_array($actor->getId(), $note->getNotificationTargetIds())
)) {
$filtered_notes[] = $note;
}
@ -85,7 +84,7 @@ abstract class FeedController extends Controller
case VisibilityScope::GROUP:
// Only for the group to see
break;
case VisibilityScope::COLLECTION: // no break
case VisibilityScope::COLLECTION:
case VisibilityScope::MESSAGE:
// Only for the collection to see (they will only find it in their notifications)
break;

View File

@ -47,27 +47,27 @@ use DateTimeInterface;
class FreeNetworkActorProtocol extends Entity
{
// {{{ Autocode
// @codeCoverageIgnoreStart;
// @codeCoverageIgnoreStart
private int $actor_id;
private ?string $protocol;
private ?string $addr;
private string $addr;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function getActorId(): int
{
return $this->actor_id;
}
public function setActorId(int $actor_id): self
{
$this->actor_id = $actor_id;
return $this;
}
public function getActorId(): int
{
return $this->actor_id;
}
public function setProtocol(?string $protocol): self
{
$this->protocol = $protocol;
$this->protocol = mb_substr($protocol, 0, 32);
return $this;
}
@ -87,14 +87,20 @@ class FreeNetworkActorProtocol extends Entity
return $this->addr;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getCreated(): DateTimeInterface
{
return $this->created;
}
public function setCreated(DateTimeInterface $created): self
public function setModified(DateTimeInterface $modified): self
{
$this->created = $created;
$this->modified = $modified;
return $this;
}
@ -103,11 +109,6 @@ class FreeNetworkActorProtocol extends Entity
return $this->modified;
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
// @codeCoverageIgnoreEnd
// }}} Autocode

View File

@ -71,16 +71,17 @@ class ActorLanguage extends Entity
return $this->language_id;
}
public function getOrdering(): int
{
return $this->ordering;
}
public function setOrdering(int $ordering): self
{
$this->ordering = $ordering;
return $this;
}
public function getOrdering(): int
{
return $this->ordering;
}
// @codeCoverageIgnoreEnd
// }}} Autocode

View File

@ -48,9 +48,9 @@ class Language extends Entity
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $id;
private string $locale;
private string $long_display;
private string $short_display;
private ?string $locale;
private ?string $long_display;
private ?string $short_display;
private DateTimeInterface $created;
public function setId(int $id): self
@ -64,35 +64,35 @@ class Language extends Entity
return $this->id;
}
public function setLocale(string $locale): self
public function setLocale(?string $locale): self
{
$this->locale = $locale;
$this->locale = mb_substr($locale, 0, 64);
return $this;
}
public function getLocale(): string
public function getLocale(): ?string
{
return $this->locale;
}
public function setLongDisplay(string $long_display): self
public function setLongDisplay(?string $long_display): self
{
$this->long_display = $long_display;
$this->long_display = mb_substr($long_display, 0, 64);
return $this;
}
public function getLongDisplay(): string
public function getLongDisplay(): ?string
{
return $this->long_display;
}
public function setShortDisplay(string $short_display): self
public function setShortDisplay(?string $short_display): self
{
$this->short_display = $short_display;
$this->short_display = mb_substr($short_display, 0, 12);
return $this;
}
public function getShortDisplay(): string
public function getShortDisplay(): ?string
{
return $this->short_display;
}
@ -107,6 +107,7 @@ class Language extends Entity
{
return $this->created;
}
// @codeCoverageIgnoreEnd
// }}} Autocode

View File

@ -51,7 +51,7 @@ class Language extends Component
}
$notes = F\select(
$notes,
fn (Note $n) => is_null($n->getLanguageId()) || \in_array($n->getLanguageId(), ActorLanguage::getActorRelatedLanguagesIds($actor)),
fn (Note $n) => \is_null($n->getLanguageId()) || \in_array($n->getLanguageId(), ActorLanguage::getActorRelatedLanguagesIds($actor)),
);
return Event::next;

View File

@ -65,20 +65,20 @@ class Link extends Entity
return $this->id;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrlHash(?string $url_hash): self
{
$this->url_hash = $url_hash;
$this->url_hash = mb_substr($url_hash, 0, 64);
return $this;
}
@ -89,7 +89,7 @@ class Link extends Entity
public function setMimetype(?string $mimetype): self
{
$this->mimetype = $mimetype;
$this->mimetype = mb_substr($mimetype, 0, 50);
return $this;
}
@ -98,18 +98,6 @@ class Link extends Entity
return $this->mimetype;
}
public function getMimetypeMajor(): ?string
{
$mime = $this->getMimetype();
return \is_null($mime) ? $mime : GSFile::mimetypeMajor($mime);
}
public function getMimetypeMinor(): ?string
{
$mime = $this->getMimetype();
return \is_null($mime) ? $mime : GSFile::mimetypeMinor($mime);
}
public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
@ -172,6 +160,18 @@ class Link extends Entity
}
}
public function getMimetypeMajor(): ?string
{
$mime = $this->getMimetype();
return \is_null($mime) ? $mime : GSFile::mimetypeMajor($mime);
}
public function getMimetypeMinor(): ?string
{
$mime = $this->getMimetype();
return \is_null($mime) ? $mime : GSFile::mimetypeMinor($mime);
}
public static function schemaDef(): array
{
return [

View File

@ -76,6 +76,7 @@ class NoteToLink extends Entity
{
return $this->modified;
}
// @codeCoverageIgnoreEnd
// }}} Autocode

View File

@ -75,7 +75,7 @@ class Notification extends Entity
public function setReason(?string $reason): self
{
$this->reason = $reason;
$this->reason = mb_substr($reason, 0, 191);
return $this;
}

View File

@ -66,7 +66,7 @@ class UserNotificationPrefs extends Entity
public function setTransport(string $transport): self
{
$this->transport = $transport;
$this->transport = mb_substr($transport, 0, 191);
return $this;
}

View File

@ -24,21 +24,20 @@ declare(strict_types = 1);
namespace Component\Posting;
use App\Core\DB\DB;
use App\Core\Entity;
use App\Core\Event;
use App\Core\Form;
use App\Core\GSFile;
use App\Core\VisibilityScope;
use App\Util\Exception\BugFoundException;
use function App\Core\I18n\_m;
use App\Core\Modules\Component;
use App\Core\Router\Router;
use App\Core\Security;
use App\Core\VisibilityScope;
use App\Entity\Activity;
use App\Entity\Actor;
use App\Entity\GroupInbox;
use App\Entity\Note;
use App\Util\Common;
use App\Util\Exception\BugFoundException;
use App\Util\Exception\ClientException;
use App\Util\Exception\DuplicateFoundException;
use App\Util\Exception\RedirectException;
@ -58,8 +57,6 @@ use Symfony\Component\HttpFoundation\File\Exception\FormSizeFileException;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Constraints\Length;
use function count;
use function is_null;
class Posting extends Component
{
@ -73,7 +70,7 @@ class Posting extends Component
*/
public function onAppendRightPostingBlock(Request $request, array &$res): bool
{
if (is_null($user = Common::user())) {
if (\is_null($user = Common::user())) {
return Event::next;
}
@ -105,15 +102,15 @@ class Posting extends Component
// TODO: if in group page, add GROUP visibility to the choices.
$form_params[] = ['visibility', ChoiceType::class, ['label' => _m('Visibility:'), 'multiple' => false, 'expanded' => false, 'data' => 'public', 'choices' => [
_m('Public') => VisibilityScope::PUBLIC,
_m('Local') => VisibilityScope::LOCAL,
_m('Addressee') => VisibilityScope::ADDRESSEE
_m('Public') => VisibilityScope::PUBLIC,
_m('Local') => VisibilityScope::LOCAL,
_m('Addressee') => VisibilityScope::ADDRESSEE,
]]];
$form_params[] = ['content', TextareaType::class, ['label' => _m('Content:'), 'data' => $initial_content, 'attr' => ['placeholder' => _m($placeholder)], 'constraints' => [new Length(['max' => Common::config('site', 'text_limit')])]]];
$form_params[] = ['attachments', FileType::class, ['label' => _m('Attachments:'), 'multiple' => true, 'required' => false, 'invalid_message' => _m('Attachment not valid.')]];
$form_params[] = FormFields::language($actor, $context_actor, label: _m('Note language'), help: _m('The selected language will be federated and added as a lang attribute, preferred language can be set up in settings'));
if (count($available_content_types) > 1) {
if (\count($available_content_types) > 1) {
$form_params[] = ['content_type', ChoiceType::class,
[
'label' => _m('Text format:'), 'multiple' => false, 'expanded' => false,
@ -174,32 +171,25 @@ class Posting extends Component
* $actor_id, possibly as a reply to note $reply_to and with flag
* $is_local. Sanitizes $content and $attachments
*
* @param Actor $actor
* @param string|null $content
* @param string $content_type
* @param string|null $language
* @param int|null $scope
* @param string|null $target
* @param array $attachments Array of UploadedFile to be stored as GSFiles associated to this note
* @param array $processed_attachments Array of [Attachment, Attachment's name] to be associated to this $actor and Note
* @param array $attachments Array of UploadedFile to be stored as GSFiles associated to this note
* @param array $processed_attachments Array of [Attachment, Attachment's name] to be associated to this $actor and Note
* @param array $process_note_content_extra_args Extra arguments for the event ProcessNoteContent
*
* @return Note
* @throws BugFoundException
* @throws ClientException
* @throws DuplicateFoundException
* @throws ServerException
* @throws BugFoundException
*/
public static function storeLocalNote(
Actor $actor,
Actor $actor,
?string $content,
string $content_type,
string $content_type,
?string $language = null,
?int $scope = null,
?int $scope = null,
?string $target = null,
array $attachments = [],
array $processed_attachments = [],
array $process_note_content_extra_args = [],
array $attachments = [],
array $processed_attachments = [],
array $process_note_content_extra_args = [],
): Note {
$scope ??= VisibilityScope::PUBLIC; // TODO: If site is private, default to LOCAL
$rendered = null;
@ -213,9 +203,9 @@ class Posting extends Component
'content' => $content,
'content_type' => $content_type,
'rendered' => $rendered,
'language_id' => !is_null($language) ? Language::getByLocale($language)->getId() : null,
'language_id' => !\is_null($language) ? Language::getByLocale($language)->getId() : null,
'is_local' => true,
'scope' => $scope,
'scope' => $scope,
]);
/** @var UploadedFile[] $attachments */
@ -261,7 +251,7 @@ class Posting extends Component
]);
DB::persist($activity);
if (!is_null($target)) {
if (!\is_null($target)) {
switch ($target[0]) {
case '!':
$mentions[] = [
@ -277,7 +267,7 @@ class Posting extends Component
$mentioned = [];
foreach (F\unique(F\flat_map($mentions, fn (array $m) => $m['mentioned'] ?? []), fn (Actor $a) => $a->getId()) as $m) {
if (!is_null($m)) {
if (!\is_null($m)) {
$mentioned[] = $m->getId();
if ($m->isGroup()) {

View File

@ -63,17 +63,17 @@ class ActivitypubActivity extends Entity
return $this->activity_id;
}
public function getActivityUri(): string
{
return $this->activity_uri;
}
public function setActivityUri(string $activity_uri): self
{
$this->activity_uri = $activity_uri;
return $this;
}
public function getActivityUri(): string
{
return $this->activity_uri;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;

View File

@ -57,36 +57,20 @@ class ActivitypubActor extends Entity
private string $uri;
private int $actor_id;
private string $inbox_uri;
private ?string $inbox_shared_uri = null;
private string $url;
private ?string $inbox_shared_uri;
private ?string $url;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function getUri(): string
{
return $this->uri;
}
public function setUri(string $uri): self
{
$this->uri = $uri;
return $this;
}
public function getUrl(): string
public function getUri(): string
{
return $this->url;
}
public function setUrl(string $url): self
{
$this->url = $url;
return $this;
}
public function getActorId(): int
{
return $this->actor_id;
return $this->uri;
}
public function setActorId(int $actor_id): self
@ -95,9 +79,9 @@ class ActivitypubActor extends Entity
return $this;
}
public function getInboxUri(): string
public function getActorId(): int
{
return $this->inbox_uri;
return $this->actor_id;
}
public function setInboxUri(string $inbox_uri): self
@ -106,20 +90,31 @@ class ActivitypubActor extends Entity
return $this;
}
public function getInboxSharedUri(): ?string
public function getInboxUri(): string
{
return $this->inbox_shared_uri;
return $this->inbox_uri;
}
public function setInboxSharedUri(?string $inbox_shared_uri = null): self
public function setInboxSharedUri(?string $inbox_shared_uri): self
{
$this->inbox_shared_uri = $inbox_shared_uri;
return $this;
}
public function getCreated(): DateTimeInterface
public function getInboxSharedUri(): ?string
{
return $this->created;
return $this->inbox_shared_uri;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setCreated(DateTimeInterface $created): self
@ -128,9 +123,9 @@ class ActivitypubActor extends Entity
return $this;
}
public function getModified(): DateTimeInterface
public function getCreated(): DateTimeInterface
{
return $this->modified;
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
@ -138,6 +133,12 @@ class ActivitypubActor extends Entity
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// @codeCoverageIgnoreEnd
// }}} Autocode

View File

@ -47,30 +47,25 @@ class ActivitypubObject extends Entity
// {{{ Autocode
// @codeCoverageIgnoreStart
private string $object_uri;
private int $object_id;
private string $object_type;
private int $object_id;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function getObjectUri(): string
{
return $this->object_uri;
}
public function setObjectUri(string $object_uri): self
{
$this->object_uri = $object_uri;
return $this;
}
public function getObjectId(): int
public function getObjectUri(): string
{
return $this->object_id;
return $this->object_uri;
}
public function setObjectId(int $object_id): self
public function setObjectType(string $object_type): self
{
$this->object_id = $object_id;
$this->object_type = mb_substr($object_type, 0, 32);
return $this;
}
@ -79,12 +74,17 @@ class ActivitypubObject extends Entity
return $this->object_type;
}
public function setObjectType(string $object_type): self
public function setObjectId(int $object_id): self
{
$this->object_type = $object_type;
$this->object_id = $object_id;
return $this;
}
public function getObjectId(): int
{
return $this->object_id;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;

View File

@ -50,36 +50,31 @@ class ActivitypubRsa extends Entity
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $actor_id;
private ?string $private_key = null;
private ?string $private_key;
private string $public_key;
private DateTimeInterface $created;
private DateTimeInterface $modified;
public function getActorId(): int
{
return $this->actor_id;
}
public function setActorId(int $actor_id): self
{
$this->actor_id = $actor_id;
return $this;
}
public function getPrivateKey(): string
public function getActorId(): int
{
return $this->private_key;
return $this->actor_id;
}
public function setPrivateKey(string $private_key): self
public function setPrivateKey(?string $private_key): self
{
$this->private_key = $private_key;
return $this;
}
public function getPublicKey(): string
public function getPrivateKey(): ?string
{
return $this->public_key;
return $this->private_key;
}
public function setPublicKey(string $public_key): self
@ -88,9 +83,9 @@ class ActivitypubRsa extends Entity
return $this;
}
public function getCreated(): DateTimeInterface
public function getPublicKey(): string
{
return $this->created;
return $this->public_key;
}
public function setCreated(DateTimeInterface $created): self
@ -99,9 +94,9 @@ class ActivitypubRsa extends Entity
return $this;
}
public function getModified(): DateTimeInterface
public function getCreated(): DateTimeInterface
{
return $this->modified;
return $this->created;
}
public function setModified(DateTimeInterface $modified): self
@ -109,6 +104,12 @@ class ActivitypubRsa extends Entity
$this->modified = $modified;
return $this;
}
public function getModified(): DateTimeInterface
{
return $this->modified;
}
// @codeCoverageIgnoreEnd
// }}} Autocode

View File

@ -167,7 +167,7 @@ class Activity extends Model
];
$attr['object'] = ($attr['type'] === 'Create') ? self::jsonToType(Model::toJson($object->getObject())) : ActivityPub::getUriByObject($object->getObject());
if (!is_string($attr['object'])) {
if (!\is_string($attr['object'])) {
$attr['to'] = array_unique(array_merge($attr['to'], $attr['object']->get('to')));
$attr['cc'] = array_unique(array_merge($attr['cc'], $attr['object']->get('cc')));
}

View File

@ -28,7 +28,7 @@ class Collection extends Entity
public function setName(?string $name): self
{
$this->name = $name;
$this->name = mb_substr($name, 0, 255);
return $this;
}

View File

@ -52,10 +52,10 @@ class AttachmentEmbed extends Entity
// @codeCoverageIgnoreStart
private int $link_id;
private int $attachment_id;
private ?string $title;
private ?string $description;
private ?string $provider_name;
private ?string $provider_url;
private ?string $title;
private ?string $description;
private ?string $author_name;
private ?string $author_url;
private ?string $thumbnail_url;
@ -72,16 +72,17 @@ class AttachmentEmbed extends Entity
return $this->link_id;
}
public function setAttachmentId(int $attachment_id): self
{
$this->attachment_id = $attachment_id;
return $this;
}
public function getAttachmentId(): int
{
return $this->attachment_id;
}
public function setAttachmentId(int $attachment_id): void
{
$this->attachment_id = $attachment_id;
}
public function setProviderName(?string $provider_name): self
{
$this->provider_name = $provider_name;
@ -104,17 +105,6 @@ class AttachmentEmbed extends Entity
return $this->provider_url;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setTitle(?string $title): self
{
$this->title = $title;
@ -126,6 +116,17 @@ class AttachmentEmbed extends Entity
return $this->title;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setAuthorName(?string $author_name): self
{
$this->author_name = $author_name;

View File

@ -23,7 +23,6 @@ namespace Plugin\Favourite\Entity;
use App\Core\Entity;
use App\Entity\Note;
use App\Util\Formatting;
use DateTimeInterface;
class Favourite extends Entity

View File

@ -197,6 +197,9 @@ class Oomox extends Entity
return $this->modified;
}
// @codeCoverageIgnoreEnd
// }}} Autocode
public function resetTheme(bool $is_light)
{
if ($is_light) {
@ -214,8 +217,6 @@ class Oomox extends Entity
}
}
// @codeCoverageIgnoreEnd
// }}} Autocode
public static function schemaDef(): array
{
return [

View File

@ -63,7 +63,7 @@ class Poll extends Entity
public function setUri(?string $uri): self
{
$this->uri = $uri;
$this->uri = mb_substr($uri, 0, 191);
return $this;
}

View File

@ -62,7 +62,7 @@ class PollResponse extends Entity
public function setUri(?string $uri): self
{
$this->uri = $uri;
$this->uri = mb_substr($uri, 0, 191);
return $this;
}
@ -143,7 +143,7 @@ class PollResponse extends Entity
'id' => ['type' => 'serial', 'not null' => true],
//'uri' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'UUID to the response notice'),
'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'UUID to the response notice'],
'poll_id' => ['type' => 'int', 'length' => 36, 'not null' => true, 'description' => 'UUID of poll being responded to'],
'poll_id' => ['type' => 'int', 'not null' => true, 'description' => 'UUID of poll being responded to'],
'actor_id' => ['type' => 'int'],
'selection' => ['type' => 'int'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],

View File

@ -41,8 +41,8 @@ class ProfileColor extends Entity
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $actor_id;
private ?string $color;
private ?string $background;
private ?string $color;
private DateTimeInterface $created;
private DateTimeInterface $modified;
@ -57,18 +57,7 @@ class ProfileColor extends Entity
return $this->actor_id;
}
public function setColor(string $color): self
{
$this->color = $color;
return $this;
}
public function getColor(): ?string
{
return $this->color;
}
public function setBackground(string $background): self
public function setBackground(?string $background): self
{
$this->background = $background;
return $this;
@ -79,6 +68,17 @@ class ProfileColor extends Entity
return $this->background;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
public function getColor(): ?string
{
return $this->color;
}