Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* * This file is part of Flarum. * * For detailed copyright and license informa..
Decoded Output download
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Flags\Command;
use Flarum\Flags\Event\Deleting;
use Flarum\Post\Post;
use Flarum\Post\PostRepository;
use Illuminate\Events\Dispatcher;
class DeleteFlagsHandler
{
public function __construct(
protected PostRepository $posts,
protected Dispatcher $events
) {
}
public function handle(DeleteFlags $command): Post
{
$actor = $command->actor;
$post = $this->posts->findOrFail($command->postId, $actor);
$actor->assertCan('viewFlags', $post->discussion);
foreach ($post->flags as $flag) {
$this->events->dispatch(new Deleting($flag, $actor, $command->data));
}
$post->flags()->delete();
return $post;
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Flags\Command;
use Flarum\Flags\Event\Deleting;
use Flarum\Post\Post;
use Flarum\Post\PostRepository;
use Illuminate\Events\Dispatcher;
class DeleteFlagsHandler
{
public function __construct(
protected PostRepository $posts,
protected Dispatcher $events
) {
}
public function handle(DeleteFlags $command): Post
{
$actor = $command->actor;
$post = $this->posts->findOrFail($command->postId, $actor);
$actor->assertCan('viewFlags', $post->discussion);
foreach ($post->flags as $flag) {
$this->events->dispatch(new Deleting($flag, $actor, $command->data));
}
$post->flags()->delete();
return $post;
}
}
Function Calls
None |
Stats
MD5 | 13f1f895ff880c41a9bab6a2b3e88951 |
Eval Count | 0 |
Decode Time | 99 ms |