<commit_before><?php
/**
 * Part of the Joomla Framework Authentication Package
 *
 * @copyright  Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\Authentication;

/**
 * Joomla Framework Authentication Class
 *
 * @since  1.0
 */
class Authentication
{
	/**
	 * Authentication was successful.
	 *
	 * @since  1.0
	 */
	public const SUCCESS = 1;

	/**
	 * Credentials were provided but they were invalid.
	 *
	 * @since  1.0
	 */
	public const INVALID_CREDENTIALS = 2;

	/**
	 * Credentials were provided but the user did not exist in the credential store.
	 *
	 * @since  1.0
	 */
	public const NO_SUCH_USER = 3;

	/**
	 * There were no credentials found.
	 *
	 * @since  1.0
	 */
	public const NO_CREDENTIALS = 4;

	/**
	 * There were partial credentials found but they were not complete.
	 *
	 * @since  1.0
	 */
	public const INCOMPLETE_CREDENTIALS = 5;

	/**
	 * The array of strategies.
	 *
	 * @var    AuthenticationStrategyInterface[]
	 * @since  1.0
	 */
	private $strategies = [];

	/**
	 * The array of results.
	 *
	 * @var    integer[]
	 * @since  1.0
	 */
	private $results = [];

	/**
	 * Register a new strategy
	 *
	 * @param   string                           $strategyName  The name to use for the strategy.
	 * @param   AuthenticationStrategyInterface  $strategy      The authentication strategy object to add.
	 *
	 * @return  void
	 *
	 * @since   1.0
	 */
	public function addStrategy($strategyName, AuthenticationStrategyInterface $strategy)
	{
		$this->strategies[$strategyName] = $strategy;
	}

	/**
	 * Perform authentication
	 *
	 * @param   AuthenticationStrategyInterface[]  $strategies  Array of strategies to try - empty to try all strategies.
	 *
	 * @return  string|boolean  A string containing a username if authentication is successful, false otherwise.
	 *
	 * @since   1.0
	 * @throws  \RuntimeException
	 */
	public function authenticate(array $strategies = [])<commit_msg>Uses the strategy names, not objects<commit_after><?php
/**
 * Part of the Joomla Framework Authentication Package
 *
 * @copyright  Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\Authentication;

/**
 * Joomla Framework Authentication Class
 *
 * @since  1.0
 */
class Authentication
{
	/**
	 * Authentication was successful.
	 *
	 * @since  1.0
	 */
	public const SUCCESS = 1;

	/**
	 * Credentials were provided but they were invalid.
	 *
	 * @since  1.0
	 */
	public const INVALID_CREDENTIALS = 2;

	/**
	 * Credentials were provided but the user did not exist in the credential store.
	 *
	 * @since  1.0
	 */
	public const NO_SUCH_USER = 3;

	/**
	 * There were no credentials found.
	 *
	 * @since  1.0
	 */
	public const NO_CREDENTIALS = 4;

	/**
	 * There were partial credentials found but they were not complete.
	 *
	 * @since  1.0
	 */
	public const INCOMPLETE_CREDENTIALS = 5;

	/**
	 * The array of strategies.
	 *
	 * @var    AuthenticationStrategyInterface[]
	 * @since  1.0
	 */
	private $strategies = [];

	/**
	 * The array of results.
	 *
	 * @var    integer[]
	 * @since  1.0
	 */
	private $results = [];

	/**
	 * Register a new strategy
	 *
	 * @param   string                           $strategyName  The name to use for the strategy.
	 * @param   AuthenticationStrategyInterface  $strategy      The authentication strategy object to add.
	 *
	 * @return  void
	 *
	 * @since   1.0
	 */
	public function addStrategy($strategyName, AuthenticationStrategyInterface $strategy)
	{
		$this->strategies[$strategyName] = $strategy;
	}

	/**
	 * Perform authentication
	 *
	 * @param   string[]  $strategies  Array of strategies to try - empty to try all strategies.
	 *
	 * @return  string|boolean  A string containing a username if authentication is successful, false otherwise.
	 *
	 * @since   1.0
	 * @throws  \RuntimeException
	 */
	public function authenticate(array $strategies = [])
{'fraction_non_alphanumeric': 0.10462826193993106, 'fraction_numerical': 0.01674052191038897, 'mean_word_length': 2.762037037037037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5358790', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1185, 'n_words': 403}