<commit_before><?php

namespace App\Services;

use Illuminate\Http\Request;

abstract class Authentication
{
    /**
     * Retrieves array of currently configured clients.
     *
     * @return array
     */
    abstract public function getSupportedClientKeys();

    /**
     * Engage in login flow.
     *
     * @param  string   $provider
     * @param  Request  $request
     *
     * @return RedirectResponse|Identity
     * @throws Exception
     */
    abstract public function login($provider, Request $request);

    /**
     * Get value from session by key.
     *
     * @param  string   $key
     * @param  mixed    $value
     *
     * @return boolean
     */
    protected function addToSession($key, $value)
    {
        $success = session([$key => $value]);
        session()->save();

        return $success;
    }

    /**
     * Get value from session by key.
     *
     * @param  string   $key
     * @param  boolean  $remove Optional
     *
     * @return mixed|null
     */
    protected function getFromSession($key, $remove = true)
    {
        if ($remove) {
            $value = session()->pull($key);
        } else {
            $value = session($key);
        }

        session()->save();

        return $value;
    }
}
<commit_msg>Remove empty values when fetching credentials from session<commit_after><?php

namespace App\Services;

use Illuminate\Http\Request;

abstract class Authentication
{
    /**
     * Retrieves array of currently configured clients.
     *
     * @return array
     */
    abstract public function getSupportedClientKeys();

    /**
     * Engage in login flow.
     *
     * @param  string   $provider
     * @param  Request  $request
     *
     * @return RedirectResponse|Identity
     * @throws Exception
     */
    abstract public function login($provider, Request $request);

    /**
     * Get value from session by key.
     *
     * @param  string   $key
     * @param  mixed    $value
     *
     * @return boolean
     */
    protected function addToSession($key, $value)
    {
        $success = session([$key => $value]);
        session()->save();

        return $success;
    }

    /**
     * Get value from session by key.
     *
     * @param  string   $key
     * @param  boolean  $remove Optional
     *
     * @return mixed|null
     */
    protected function getFromSession($key, $remove = true)
    {
        if ($remove) {
            $value = session()->pull($key);
        } else {
            $value = session($key);
        }

        session()->save();

        if (is_array($value)) {
            $value = array_filter($value);
        }

        return $value;
    }
}

{'fraction_non_alphanumeric': 0.11961004874390702, 'fraction_numerical': 0.0, 'mean_word_length': 1.832271762208068, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '2206605', 'n_tokens_mistral': 755, 'n_tokens_neox': 747, 'n_words': 199}