<commit_before><?php
namespace Crud\Action;

use Crud\Event\Subject;
use Crud\Traits\FindMethodTrait;
use Crud\Traits\RedirectTrait;

/**
 * Handles 'Delete' Crud actions
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 */
class DeleteAction extends BaseAction
{

    use FindMethodTrait;
    use RedirectTrait;

    /**
     * Default settings for 'add' actions
     *
     * `enabled` Is this crud action enabled or disabled
     *
     * `findMethod` The default `Model::find()` method for reading data
     *
     * @var array
     */
    protected $_defaultConfig = [
        'enabled' => true,
        'scope' => 'entity',
        'findMethod' => 'all',
        'deleteMethod' => 'delete',
        'messages' => [
            'success' => [
                'text' => 'Successfully deleted {name}'
            ],
            'error' => [
                'text' => 'Could not delete {name}'
            ]
        ],
        'api' => [
            'success' => [
                'code' => 200
            ],
            'error' => [
                'code' => 400
            ]
        ]
    ];

    /**
     * HTTP POST handler
     *
     * @param string $id Record id
     * @return \Cake\Network\Response
     */
    protected function _post($id = null)
    {
        $subject = $this->_subject();
        $subject->set(['id' => $id]);

        $entity = $this->_findRecord($id, $subject);

        $event = $this->_trigger('beforeDelete', $subject);
        if ($event->isStopped()) {
            return $this->_stopped($subject);
        }

        $method = $this->config('deleteMethod');
        if ($this->_table()->$method($entity)) {
             $this->_success($subject);<commit_msg>Remove extra whitespace<commit_after><?php
namespace Crud\Action;

use Crud\Event\Subject;
use Crud\Traits\FindMethodTrait;
use Crud\Traits\RedirectTrait;

/**
 * Handles 'Delete' Crud actions
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 */
class DeleteAction extends BaseAction
{

    use FindMethodTrait;
    use RedirectTrait;

    /**
     * Default settings for 'add' actions
     *
     * `enabled` Is this crud action enabled or disabled
     *
     * `findMethod` The default `Model::find()` method for reading data
     *
     * @var array
     */
    protected $_defaultConfig = [
        'enabled' => true,
        'scope' => 'entity',
        'findMethod' => 'all',
        'deleteMethod' => 'delete',
        'messages' => [
            'success' => [
                'text' => 'Successfully deleted {name}'
            ],
            'error' => [
                'text' => 'Could not delete {name}'
            ]
        ],
        'api' => [
            'success' => [
                'code' => 200
            ],
            'error' => [
                'code' => 400
            ]
        ]
    ];

    /**
     * HTTP POST handler
     *
     * @param string $id Record id
     * @return \Cake\Network\Response
     */
    protected function _post($id = null)
    {
        $subject = $this->_subject();
        $subject->set(['id' => $id]);

        $entity = $this->_findRecord($id, $subject);

        $event = $this->_trigger('beforeDelete', $subject);
        if ($event->isStopped()) {
            return $this->_stopped($subject);
        }

        $method = $this->config('deleteMethod');
        if ($this->_table()->$method($entity)) {
            $this->_success($subject);
{'fraction_non_alphanumeric': 0.14839988671764373, 'fraction_numerical': 0.0033984706881903144, 'mean_word_length': 1.7943037974683544, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '1047779', 'n_tokens_mistral': 1026, 'n_tokens_neox': 999, 'n_words': 243}