<commit_before><?php

namespace Backend\Modules\Location\Actions;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Backend\Core\Engine\Base\ActionDelete as BackendBaseActionDelete;
use Backend\Core\Engine\Model as BackendModel;
use Backend\Modules\Location\Engine\Model as BackendLocationModel;
use Backend\Modules\Location\Form\LocationDeleteType;

/**
 * This action will delete an item
 */
class Delete extends BackendBaseActionDelete
{
    public function execute(): void
    {
        $deleteForm = $this->createForm(LocationDeleteType::class);
        $deleteForm->handleRequest($this->getRequest());
        if (!$deleteForm->isSubmitted() || !$deleteForm->isValid()) {
            $this->redirect(BackendModel::createURLForAction('Index') . '&error=something-went-wrong');
        }
        $deleteFormData = $deleteForm->getData();

        // get parameters
        $this->id = $deleteFormData['id'];

        // does the item exist
        if ($this->id === 0 || !BackendLocationModel::exists($this->id)) {
            $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
        }

        parent::execute();

        // get all data for the item we want to edit
        $this->record = (array) BackendLocationModel::get($this->id);

        // delete item
        BackendLocationModel::delete($this->id);

        // user was deleted, so redirect
        $this->redirect(
            BackendModel::createURLForAction('Index') . '&report=deleted&var=' .
            rawurlencode($this->record['title'])
        );
    }
}<commit_msg>Fix code styling in location delete<commit_after><?php

namespace Backend\Modules\Location\Actions;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Backend\Core\Engine\Base\ActionDelete as BackendBaseActionDelete;
use Backend\Core\Engine\Model as BackendModel;
use Backend\Modules\Location\Engine\Model as BackendLocationModel;
use Backend\Modules\Location\Form\LocationDeleteType;

/**
 * This action will delete an item
 */
class Delete extends BackendBaseActionDelete
{
    public function execute(): void
    {
        $deleteForm = $this->createForm(LocationDeleteType::class);
        $deleteForm->handleRequest($this->getRequest());
        if (!$deleteForm->isSubmitted() || !$deleteForm->isValid()) {
            $this->redirect(BackendModel::createURLForAction('Index', null, null, ['error' => 'something-went-wrong']));

            return;
        }
        $deleteFormData = $deleteForm->getData();

        $this->id = (int) $deleteFormData['id'];

        // does the item exist
        if ($this->id === 0 || !BackendLocationModel::exists($this->id)) {
            $this->redirect(BackendModel::createURLForAction('Index', null, null, ['error' => 'non-existing']));

            return;
        }

        parent::execute();

        $this->record = (array) BackendLocationModel::get($this->id);

        BackendLocationModel::delete($this->id);

        $this->redirect(BackendModel::createURLForAction(
            'Index',
            null,
            null,
            ['report' => 'deleted', 'var' => $this->record['title']]
        ));
    }
}
{'fraction_non_alphanumeric': 0.14092380111797587, 'fraction_numerical': 0.0005884083553986466, 'mean_word_length': 3.0572792362768495, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1782152', 'n_tokens_mistral': 939, 'n_tokens_neox': 935, 'n_words': 213}