<commit_before><?php
/**
 * BaconAuthentication
 *
 * @link      http://github.com/Bacon/BaconAuthentication For the canonical source repository
 * @copyright 2013 <NAME> 'DASPRiD'
 * @license   http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
 */

namespace BaconAuthentication\Result;

use BaconAuthentication\Exception;

/**
 * Generic result implementation.
 */
class Result implements ResultInterface
{
    const STATE_SUCCESS   = 'success';
    const STATE_FAILURE   = 'failure';
    const STATE_CHALLENGE = 'challenge';

    protected static $allowedStates = array('success', 'failure', 'challenge');

    /**
     * @var string
     */
    protected $state;

    /**
     * @var mixed|null
     */
    protected $payload;

    /**
     * @param string     $state
     * @param mixed|null $payload
     */
    public function __construct($state, $payload = null)
    {
        if (!in_array($state, self::$allowedStates)) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s is not a valid state',
                $state
            ));
        }

        $this->state   = $state;
        $this->payload = $payload;
    }

    /**
     * isSuccess(): defined by ResultInterface.
     *
     * @see    ResultInterface::isSuccess()
     * @return bool
     */
    public function isSuccess()
    {
        return $this->state === self::STATE_SUCCESS;
    }

    /**
     * isFailure(): defined by ResultInterface.
     *
     * @see    ResultInterface::isFailure()
     * @return bool
     */
    public function isFailure()
    {
        return $this->state === self::STATE_FAILURE;
    }

    /**
     * isChallenge(): defined by ResultInterface.
     *
     * @see    ResultInterface::isChallenge()
     * @return bool
     */
    public function isChallenge()
    {
        return $this->state === self::STATE_CHALLENGE;
    }

    /**
     * getPayload(): defined by ResultInterface.
     *
     * @see    ResultInterface::getPayload()
     * @return mixed
     */
    public function getPayload()
    {
        return $this->payload;
    }
}
<commit_msg>Add a bit more documentation<commit_after><?php
/**
 * BaconAuthentication
 *
 * @link      http://github.com/Bacon/BaconAuthentication For the canonical source repository
 * @copyright 2013 <NAME> 'DASPRiD'
 * @license   http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
 */

namespace BaconAuthentication\Result;

use BaconAuthentication\Exception;

/**
 * Generic result implementation.
 */
class Result implements ResultInterface
{
    /**
     * @see ResultInterface::isSuccess()
     */
    const STATE_SUCCESS = 'success';

    /**
     * @see ResultInterface::isFailure()
     */
    const STATE_FAILURE = 'failure';

    /**
     * @see ResultInterface::isChallenge()
     */
    const STATE_CHALLENGE = 'challenge';

    /**
     * @var array
     */
    protected static $allowedStates = array('success', 'failure', 'challenge');

    /**
     * @var string
     */
    protected $state;

    /**
     * @var mixed|null
     */
    protected $payload;

    /**
     * @param string     $state
     * @param mixed|null $payload
     */
    public function __construct($state, $payload = null)
    {
        if (!in_array($state, self::$allowedStates)) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s is not a valid state',
                $state
            ));
        }

        $this->state   = $state;
        $this->payload = $payload;
    }

    /**
     * isSuccess(): defined by ResultInterface.
     *
     * @see    ResultInterface::isSuccess()
     * @return bool
     */
    public function isSuccess()
    {
        return $this->state === self::STATE_SUCCESS;
    }

    /**
     * isFailure(): defined by ResultInterface.
     *
     * @see    ResultInterface::isFailure()
     * @return bool
     */
    public function isFailure()
    {
        return $this->state === self::STATE_FAILURE;
    }

    /**
     * isChallenge(): defined by ResultInterface.
     *
     * @see    ResultInterface::isChallenge()
     * @return bool
     */
    public function isChallenge()
    {
        return $this->state === self::STATE_CHALLENGE;
    }

    /**
     * getPayload(): defined by ResultInterface.
     *
     * @see    ResultInterface::getPayload()
     * @return mixed
     */
    public function getPayload()
    {
        return $this->payload;
    }
}

{'fraction_non_alphanumeric': 0.1306104129263914, 'fraction_numerical': 0.002244165170556553, 'mean_word_length': 2.1498233215547704, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '6634470', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1244, 'n_words': 282}