<commit_before><?php namespace Xavrsl\Ldap;

use Illuminate\Support\Facades\Cache;

class Directory {

	/**
	 * The configuration of the package.
	 *
	 * @var string
	 */
	protected $config;

	/**
	 * Requested Organisation Unit
	 *
	 * @var string
	 */
	protected $organisationUnit;

	/**
	 * Default Organisation Unit
	 *
	 * @var string
	 */
	protected $defaultOrganisationUnit = 'people';

	/**
	 * Attribute to use in filter
	 *
	 * @var string
	 */
	protected $filterAttribute;

	/**
	 * Boolean Operator
	 *
	 * @var string
	 */
	protected $booleanOperator = '|';

	/**
	 * Search results.
	 *
	 * @var array
	 */
	protected $results;

	/**
	 * Requested entries
	 *
	 * @var array
	 */
	protected $requestedEntries;

	/**
	 * Current Attributes
	 *
	 * @var array
	 */
	protected $attributes;

	/**
	 * Create a new Ldap connection instance.
	 *
	 * @param  array  $config
	 */
	public function __construct($config, $connection)
	{
		$this->config = $config;
		$this->connection = $connection;
		$this->filterAttribute = $this->getConfig('filter');
	}

	/**
	 * Close the connection to the LDAP.
	 *
	 * @return void
	 */
	public function __destruct()
	{
		if ($this->connection->getResource())
		{
			ldap_close($this->connection->getResource());
		}
	}

	/************************************************/
	/*************** Public methods *****************/
	/************************************************/

	public function query($method, $parameters)
	{
		if ($this->setOrganisationUnit($method)) {
			if (count($parameters) !== 1) {
				throw new \Exception('OU method expecting only one parameter (can be an array)');
			}

			$this->setRequestedEntries($parameters[0]);
			return $this;
		}
		elseif($method == 'find')
		{
			$this->find($parameters[0]);
			return $this;
		}
		elseif ($method == 'auth') {
			if (count($parameters) !== 2) {
				throw new \Exception('Auth takes Login and Password as parameters');
			}
			return $this->auth($parameters[0], $parameters[1]);
		}
		else {
			throw new \Exception("This function is not implemented (Yet ?).");
		}
	}

	/**
	 * Authenticate a user
	 *
	 * @param string  $login
	 * @param string  $password
	 * @return boolean
	 */
	public function auth($login, $password)
	{<commit_msg>Reset filter in short people method<commit_after><?php namespace Xavrsl\Ldap;

use Illuminate\Support\Facades\Cache;

class Directory {

	/**
	 * The configuration of the package.
	 *
	 * @var string
	 */
	protected $config;

	/**
	 * Requested Organisation Unit
	 *
	 * @var string
	 */
	protected $organisationUnit;

	/**
	 * Default Organisation Unit
	 *
	 * @var string
	 */
	protected $defaultOrganisationUnit = 'people';

	/**
	 * Attribute to use in filter
	 *
	 * @var string
	 */
	protected $filterAttribute;

	/**
	 * Boolean Operator
	 *
	 * @var string
	 */
	protected $booleanOperator = '|';

	/**
	 * Search results.
	 *
	 * @var array
	 */
	protected $results;

	/**
	 * Requested entries
	 *
	 * @var array
	 */
	protected $requestedEntries;

	/**
	 * Current Attributes
	 *
	 * @var array
	 */
	protected $attributes;

	/**
	 * Create a new Ldap connection instance.
	 *
	 * @param  array  $config
	 */
	public function __construct($config, $connection)
	{
		$this->config = $config;
		$this->connection = $connection;
		$this->filterAttribute = $this->getConfig('filter');
	}

	/**
	 * Close the connection to the LDAP.
	 *
	 * @return void
	 */
	public function __destruct()
	{
		if ($this->connection->getResource())
		{
			ldap_close($this->connection->getResource());
		}
	}

	/************************************************/
	/*************** Public methods *****************/
	/************************************************/

	public function query($method, $parameters)
	{
		if ($this->setOrganisationUnit($method)) {
			if (count($parameters) !== 1) {
				throw new \Exception('OU method expecting only one parameter (can be an array)');
			}
			$this->filterAttribute = $this->getConfig('filter');
			$this->setRequestedEntries($parameters[0]);
			return $this;
		}
		elseif($method == 'find')
		{
			$this->find($parameters[0]);
			return $this;
		}
		elseif ($method == 'auth') {
			if (count($parameters) !== 2) {
				throw new \Exception('Auth takes Login and Password as parameters');
			}
			return $this->auth($parameters[0], $parameters[1]);
		}
		else {
			throw new \Exception("This function is not implemented (Yet ?).");
		}
	}

	/**
	 * Authenticate a user
	 *
	 * @param string  $login
	 * @param string  $password
	 * @return boolean
	 */
	public function auth($login, $password)
	{
{'fraction_non_alphanumeric': 0.20213927090154987, 'fraction_numerical': 0.0026195153896529143, 'mean_word_length': 3.262325581395349, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '5369968', 'n_tokens_mistral': 1575, 'n_tokens_neox': 1359, 'n_words': 347}