<commit_before><?php

/**
 * @package		com_adh
 * @subpackage	helper
 * @brief		User class.  Handles all application interaction with a user
 * @copyright	Copyright (C) 2010 - 2014 <NAME> <<EMAIL>>
 * @license		Affero GNU General Public License version 3 or later; see LICENSE.txt
 * 
 * @TODO		finish overriding for com_adh component instead of AdhUser class
 */

/** 
 *  Copyright (C) 2012-2014 <NAME> <<EMAIL>>
 *  com_adh is a joomla! 2.5 component [http://www.volontairesnature.org]
 *  
 *  This file is part of com_adh.
 * 
 *     com_adh is free software: you can redistribute it and/or modify
 *     it under the terms of the Affero GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     com_adh is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     Affero GNU General Public License for more details.
 * 
 *     You should have received a copy of the Affero GNU General Public License
 *     along with com_adh.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

/**
 * @package     Joomla.Platform
 * @subpackage  User
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

//JLoader::register('AdhUserHelper', dirname(__FILE__) . '/user-adh-helper.php');
JLoader::register('AdhCotiz', dirname(__FILE__) . '/cotiz.php');

/**
 * User class.  Handles all application interaction with a user
 *
 * @package     com_adh
 * @subpackage  User
 * @since       0.0.22
 */
class AdhUser extends JObject
{
	/**
	 * Joomla user object (JUser)
	 *
	 * @object	JUser
	 * @since	0.0.20
	 */
	protected $juser = null;

	/**
	 * Unique id
	 *
	 * @var    integer
	 * @since  11.1
	 */
	public $id = null;

	/**
	 * profession
	 * 
	 * @object
	 * @since	0.0.22	
	 */
	public $profession;
	
	/**
	 * origine
	 * 
	 * @object
	 * @since	0.0.22	
	 */
	public $origine;
	
	/**
	 * cotiz
	 * 
	 * @array of @object
	 * @since	0.0.30
	 */
	public $cotiz;
	
	/**
	 * @var    array  AdhUser instances container.
	 * @since  11.3
	 */
	protected static $instances = array();

	/**
	 * Constructor activating the default information of the language
	 *
	 * @param   integer  $identifier  The primary key of the user to load (optional).
	 *
	 * @since   11.1
	 */
	public function __construct($identifier = 0)
	{
		// Load the user if it exists
		if (!empty($identifier))
		{
			$this->load($identifier);
			$this->profession = $this->getProfession();
			$this->origine = $this->getOrigine();
			$this->cotiz = $this->getCotiz();

		}
		else
		{
			//initialise
			$this->id = 0;
			$this->profession = new stdClass();
			$this->profession_id = 0;
			$this->origine = new stdClass();
			$this->origine_id = 0;
			$this->cotiz = array();
		}
	}

	/**
	 * Returns the global AdhUser object, only creating it if it
	 * doesn't already exist.
	 *
	 * @param   integer  $identifier  The user to load - Can be an integer or string - If string, it is converted to ID automatically.
	 *
	 * @return  AdhUser  The User object.
	 *
	 * @since   11.1
	 */
	public static function getInstance($identifier = 0)
	{
		// Find the user id
		if (!is_numeric($identifier))
		{
			if (!$id = AdhUserHelper::getUserId($identifier))
			{
				JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('JLIB_USER_ERROR_ID_NOT_EXISTS', $identifier));
				$retval = false;
				return $retval;
			}
		}
		else
		{
			$id = $identifier;
		}

		if (empty(self::$instances[$id]))
		{
			$user = new AdhUser($id);
			self::$instances[$id] = $user;
		}

		return self::$instances[$id];
	}

	/**
	 * Method to get the user table object
	 *
	 * This function uses a static variable to store the table name of the user table to
	 * instantiate. You can call this function statically to set the table name if
	 * needed.
	 *
	 * @param   string  $type    The user table name to be used
	 * @param   string  $prefix  The user table prefix to be used
	 *
	 * @return  object  The user table object
	 *
	 * @since   11.1
	 */
	public static function getTable($type = null, $prefix = 'adhTable')
	{
		JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . "tables");
		static $tabletype;

		// Set the default tabletype;
		if (!isset($tabletype))
		{
			$tabletype['name'] = 'adherent';	// refer to a table *.php file => joomla/search/path/adherent.php
			$tabletype['prefix'] = 'adhTable';	// refer to a table *.php file => search for adhTableAdherent class
		}<commit_msg>do not use deprecated DS<commit_after><?php

/**
 * @package		com_adh
 * @subpackage	helper
 * @brief		User class.  Handles all application interaction with a user
 * @copyright	Copyright (C) 2010 - 2014 <NAME> <<EMAIL>>
 * @license		Affero GNU General Public License version 3 or later; see LICENSE.txt
 * 
 * @TODO		finish overriding for com_adh component instead of AdhUser class
 */

/** 
 *  Copyright (C) 2012-2014 <NAME> <<EMAIL>>
 *  com_adh is a joomla! 2.5 component [http://www.volontairesnature.org]
 *  
 *  This file is part of com_adh.
 * 
 *     com_adh is free software: you can redistribute it and/or modify
 *     it under the terms of the Affero GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     com_adh is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     Affero GNU General Public License for more details.
 * 
 *     You should have received a copy of the Affero GNU General Public License
 *     along with com_adh.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

/**
 * @package     Joomla.Platform
 * @subpackage  User
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

//JLoader::register('AdhUserHelper', dirname(__FILE__) . '/user-adh-helper.php');
JLoader::register('AdhCotiz', dirname(__FILE__) . '/cotiz.php');

/**
 * User class.  Handles all application interaction with a user
 *
 * @package     com_adh
 * @subpackage  User
 * @since       0.0.22
 */
class AdhUser extends JObject
{
	/**
	 * Joomla user object (JUser)
	 *
	 * @object	JUser
	 * @since	0.0.20
	 */
	protected $juser = null;

	/**
	 * Unique id
	 *
	 * @var    integer
	 * @since  11.1
	 */
	public $id = null;

	/**
	 * profession
	 * 
	 * @object
	 * @since	0.0.22	
	 */
	public $profession;
	
	/**
	 * origine
	 * 
	 * @object
	 * @since	0.0.22	
	 */
	public $origine;
	
	/**
	 * cotiz
	 * 
	 * @array of @object
	 * @since	0.0.30
	 */
	public $cotiz;
	
	/**
	 * @var    array  AdhUser instances container.
	 * @since  11.3
	 */
	protected static $instances = array();

	/**
	 * Constructor activating the default information of the language
	 *
	 * @param   integer  $identifier  The primary key of the user to load (optional).
	 *
	 * @since   11.1
	 */
	public function __construct($identifier = 0)
	{
		// Load the user if it exists
		if (!empty($identifier))
		{
			$this->load($identifier);
			$this->profession = $this->getProfession();
			$this->origine = $this->getOrigine();
			$this->cotiz = $this->getCotiz();

		}
		else
		{
			//initialise
			$this->id = 0;
			$this->profession = new stdClass();
			$this->profession_id = 0;
			$this->origine = new stdClass();
			$this->origine_id = 0;
			$this->cotiz = array();
		}
	}

	/**
	 * Returns the global AdhUser object, only creating it if it
	 * doesn't already exist.
	 *
	 * @param   integer  $identifier  The user to load - Can be an integer or string - If string, it is converted to ID automatically.
	 *
	 * @return  AdhUser  The User object.
	 *
	 * @since   11.1
	 */
	public static function getInstance($identifier = 0)
	{
		// Find the user id
		if (!is_numeric($identifier))
		{
			if (!$id = AdhUserHelper::getUserId($identifier))
			{
				JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('JLIB_USER_ERROR_ID_NOT_EXISTS', $identifier));
				$retval = false;
				return $retval;
			}
		}
		else
		{
			$id = $identifier;
		}

		if (empty(self::$instances[$id]))
		{
			$user = new AdhUser($id);
			self::$instances[$id] = $user;
		}

		return self::$instances[$id];
	}

	/**
	 * Method to get the user table object
	 *
	 * This function uses a static variable to store the table name of the user table to
	 * instantiate. You can call this function statically to set the table name if
	 * needed.
	 *
	 * @param   string  $type    The user table name to be used
	 * @param   string  $prefix  The user table prefix to be used
	 *
	 * @return  object  The user table object
	 *
	 * @since   11.1
	 */
	public static function getTable($type = null, $prefix = 'adhTable')
	{
		JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . "/tables");
		static $tabletype;

		// Set the default tabletype;
		if (!isset($tabletype))
		{
			$tabletype['name'] = 'adherent';	// refer to a table *.php file => joomla/search/path/adherent.php
			$tabletype['prefix'] = 'adhTable';	// refer to a table *.php file => search for adhTableAdherent class
		}
{'fraction_non_alphanumeric': 0.12448570524316911, 'fraction_numerical': 0.014558497731828253, 'mean_word_length': 2.8741315897016757, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '1749900', 'n_tokens_mistral': 3438, 'n_tokens_neox': 3021, 'n_words': 1007}