<commit_before><?php

namespace Slackbot;

class WebhookListener extends BaseListener
{
    public function listen()
    {
        $request = $this->extractRequest();

        if (empty($request)) {
            return;
        }

        $this->setRequest($request);
    }

    public function extractRequest()
    {
        if (empty($_POST)) {
            return;
        }

        return json_decode($_POST, true);
    }

    /**
     * @throws \Exception
     *
     * @return array
     */
    public function verifyOrigin()
    {
        $token = $this->getRequest('token');

        if (empty($token)) {
            return [<commit_msg>Avoid accessing post directly<commit_after><?php

namespace Slackbot;

class WebhookListener extends BaseListener
{
    public function listen()
    {
        $request = $this->extractRequest();

        if (empty($request)) {
            return;
        }

        $this->setRequest($request);
    }

    public function extractRequest()
    {
        $postRequest = filter_input_array(INPUT_POST);
        if (empty($postRequest)) {
            return;
        }

        return json_decode($postRequest, true);
    }

    /**
     * @throws \Exception
     *
     * @return array
     */
    public function verifyOrigin()
    {
        $token = $this->getRequest('token');

        if (empty($token)) {
            return [
{'fraction_non_alphanumeric': 0.12326768781911014, 'fraction_numerical': 0.0, 'mean_word_length': 1.8523908523908523, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '5264813', 'n_tokens_mistral': 384, 'n_tokens_neox': 371, 'n_words': 79}