[TOOLS] Run CS-Fixer on all files
This commit is contained in:
parent
2dbc35fcc3
commit
2e0bfc0bcd
@ -71,7 +71,7 @@ class LinkHeader
|
||||
$this->type = null;
|
||||
|
||||
// remove uri-reference from header
|
||||
$str = mb_substr($str, \mb_strlen($uri_reference[0]));
|
||||
$str = mb_substr($str, mb_strlen($uri_reference[0]));
|
||||
|
||||
// parse link-params
|
||||
$params = explode(';', $str);
|
||||
@ -124,6 +124,5 @@ class LinkHeader
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace Plugin\DeleteNote;
|
||||
use ActivityPhp\Type\AbstractObject;
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Modules\NoteHandlerPlugin;
|
||||
use App\Core\Router\RouteLoader;
|
||||
use App\Core\Router\Router;
|
||||
@ -35,9 +36,6 @@ use App\Util\Exception\ClientException;
|
||||
use DateTime;
|
||||
use Plugin\ActivityPub\Entity\ActivitypubActivity;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use function App\Core\I18n\_m;
|
||||
use function is_int;
|
||||
use function is_null;
|
||||
|
||||
/**
|
||||
* Delete note plugin main class.
|
||||
@ -75,10 +73,6 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
* (object)**, by the given **Actor (subject)**. Launches the
|
||||
* NewNotification Event, stating who dared to call Undertaker.
|
||||
*
|
||||
* @param \App\Entity\Actor $actor
|
||||
* @param \App\Entity\Note $note
|
||||
*
|
||||
* @return \App\Entity\Activity
|
||||
* @throws \App\Util\Exception\ClientException
|
||||
* @throws \App\Util\Exception\ServerException
|
||||
*/
|
||||
@ -103,11 +97,6 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
* Checks whether the Note has already been deleted, only passing on the
|
||||
* responsibility to undertaker if the Note wasn't.
|
||||
*
|
||||
* @param \App\Entity\Note|int $note
|
||||
* @param \App\Entity\Actor|int $actor
|
||||
* @param string $source
|
||||
*
|
||||
* @return \App\Entity\Activity|null
|
||||
* @throws \App\Util\Exception\ClientException
|
||||
* @throws \App\Util\Exception\DuplicateFoundException
|
||||
* @throws \App\Util\Exception\NotFoundException
|
||||
@ -115,10 +104,10 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
*/
|
||||
public static function deleteNote(Note|int $note, Actor|int $actor, string $source = 'web'): ?Activity
|
||||
{
|
||||
$actor = is_int($actor) ? Actor::getById($actor) : $actor;
|
||||
$note = is_int($note) ? Note::getById($note) : $note;
|
||||
$actor = \is_int($actor) ? Actor::getById($actor) : $actor;
|
||||
$note = \is_int($note) ? Note::getById($note) : $note;
|
||||
// Try and find if note was already deleted
|
||||
if (is_null(DB::findOneBy(Activity::class, ['verb' => 'delete', 'object_type' => 'note', 'object_id' => $note->getId()], return_null: true))) {
|
||||
if (\is_null(DB::findOneBy(Activity::class, ['verb' => 'delete', 'object_type' => 'note', 'object_id' => $note->getId()], return_null: true))) {
|
||||
// If none found, then undertaker has a job to do
|
||||
return self::undertaker($actor, $note);
|
||||
} else {
|
||||
@ -130,8 +119,6 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
* Adds and connects the _delete_note_action_ route to
|
||||
* Controller\DeleteNote::class
|
||||
*
|
||||
* @param \App\Core\Router\RouteLoader $r
|
||||
*
|
||||
* @return bool Event hook
|
||||
*/
|
||||
public function onAddRoute(RouteLoader $r)
|
||||
@ -147,22 +134,19 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
* Adds an anchor link to the route _delete_note_action_ in the **Note card
|
||||
* template**. More specifically, in the **note_actions block**.
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param \App\Entity\Note $note
|
||||
* @param array $actions
|
||||
*
|
||||
* @return bool Event hook
|
||||
* @throws \App\Util\Exception\DuplicateFoundException
|
||||
* @throws \App\Util\Exception\NotFoundException
|
||||
* @throws \App\Util\Exception\ServerException
|
||||
*
|
||||
* @return bool Event hook
|
||||
*/
|
||||
public function onAddExtraNoteActions(Request $request, Note $note, array &$actions)
|
||||
{
|
||||
if (is_null($actor = Common::actor())) {
|
||||
if (\is_null($actor = Common::actor())) {
|
||||
return Event::next;
|
||||
}
|
||||
// Only add action if note wasn't already deleted!
|
||||
if (is_null(DB::findOneBy(Activity::class, ['verb' => 'delete', 'object_type' => 'note', 'object_id' => $note->getId()], return_null: true))
|
||||
if (\is_null(DB::findOneBy(Activity::class, ['verb' => 'delete', 'object_type' => 'note', 'object_id' => $note->getId()], return_null: true))
|
||||
// And has permissions
|
||||
&& $actor->canAdmin($note->getActor())) {
|
||||
$delete_action_url = Router::url('delete_note_action', ['note_id' => $note->getId()]);
|
||||
@ -190,7 +174,7 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
*
|
||||
* @return bool Returns `Event::stop` if handled, `Event::next` otherwise
|
||||
*/
|
||||
private function activitypub_handler(Actor $actor, \ActivityPhp\Type\AbstractObject $type_activity, mixed $type_object, ?\Plugin\ActivityPub\Entity\ActivitypubActivity &$ap_act): bool
|
||||
private function activitypub_handler(Actor $actor, AbstractObject $type_activity, mixed $type_object, ?ActivitypubActivity &$ap_act): bool
|
||||
{
|
||||
if ($type_activity->get('type') !== 'Delete'
|
||||
|| !($type_object instanceof Note)) {
|
||||
@ -221,7 +205,7 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
*
|
||||
* @return bool Returns `Event::stop` if handled, `Event::next` otherwise
|
||||
*/
|
||||
public function onNewActivityPubActivity(Actor $actor, \ActivityPhp\Type\AbstractObject $type_activity, \ActivityPhp\Type\AbstractObject $type_object, ?\Plugin\ActivityPub\Entity\ActivitypubActivity &$ap_act): bool
|
||||
public function onNewActivityPubActivity(Actor $actor, AbstractObject $type_activity, AbstractObject $type_object, ?ActivitypubActivity &$ap_act): bool
|
||||
{
|
||||
return $this->activitypub_handler($actor, $type_activity, $type_object, $ap_act);
|
||||
}
|
||||
@ -236,7 +220,7 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
*
|
||||
* @return bool Returns `Event::stop` if handled, `Event::next` otherwise
|
||||
*/
|
||||
public function onNewActivityPubActivityWithObject(Actor $actor, \ActivityPhp\Type\AbstractObject $type_activity, mixed $type_object, ?\Plugin\ActivityPub\Entity\ActivitypubActivity &$ap_act): bool
|
||||
public function onNewActivityPubActivityWithObject(Actor $actor, AbstractObject $type_activity, mixed $type_object, ?ActivitypubActivity &$ap_act): bool
|
||||
{
|
||||
return $this->activitypub_handler($actor, $type_activity, $type_object, $ap_act);
|
||||
}
|
||||
|
@ -76,9 +76,7 @@ class NoteRepeat extends Entity
|
||||
return $this->repeat_of;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Note $note
|
||||
* @return bool Returns true if Note provided is a repeat of another Note
|
||||
*/
|
||||
public static function isNoteRepeat(Note $note): bool
|
||||
|
@ -89,6 +89,6 @@ abstract class Bitmap
|
||||
|
||||
public static function isValue(int $value): bool
|
||||
{
|
||||
return in_array($value, (new ReflectionClass(static::class))->getConstants());
|
||||
return \in_array($value, (new ReflectionClass(static::class))->getConstants());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user