<commit_before><?php
namespace dash\app\user;


trait add
{

	/**
	 * add new user
	 *
	 * @param      array          $_args  The arguments
	 *
	 * @return     array|boolean  ( description_of_the_return_value )
	 */
	public static function add($_args, $_option = [])
	{
		\dash\app::variable($_args);

		$log_meta =
		[
			'data' => null,
			'meta' =>
			[
				'input' => \dash\app::request(),
			]
		];

		$default_option =
		[
			'save_log'       => true,
			'contact'        => true,
			'debug'          => true,
			'other_field'    => null,
			'other_field_id' => null,
		];

		if(!is_array($_option))
		{
			$_option = [];
		}

		$_option = array_merge($default_option, $_option);


		if(!\dash\user::id())
		{
			if($_option['save_log']) \dash\app::log('api:user:user_id:notfound', null, $log_meta);
			if($_option['debug']) \dash\notif::error(T_("User not found"), 'user');
			return false;
		}

		// check args
		$args = self::check($_option);

		if($args === false || !\dash\engine\process::status())
		{
			return false;
		}

		$return         = [];

		if(!$args['status'])
		{<commit_msg>add force user<commit_after><?php
namespace dash\app\user;


trait add
{

	public static function add_f($_args, $_option = [])
	{
		return self::add($_args, ['force_add' => true]);
	}

	/**
	 * add new user
	 *
	 * @param      array          $_args  The arguments
	 *
	 * @return     array|boolean  ( description_of_the_return_value )
	 */
	public static function add($_args, $_option = [])
	{
		\dash\app::variable($_args);

		$log_meta =
		[
			'data' => null,
			'meta' =>
			[
				'input' => \dash\app::request(),
			]
		];

		$default_option =
		[
			'save_log'       => true,
			'contact'        => true,
			'debug'          => true,
			'other_field'    => null,
			'other_field_id' => null,
			'force_add'      => false,
		];

		if(!is_array($_option))
		{
			$_option = [];
		}

		$_option = array_merge($default_option, $_option);


		if(!$_option['force_add'])
		{
			if(!\dash\user::id())
			{
				if($_option['save_log']) \dash\app::log('api:user:user_id:notfound', null, $log_meta);
				if($_option['debug']) \dash\notif::error(T_("User not found"), 'user');
				return false;
			}
		}

		// check args
		$args = self::check($_option);

		if($args === false || !\dash\engine\process::status())
		{
			return false;
		}

		$return         = [];

		if(!$args['status'])
		{
{'fraction_non_alphanumeric': 0.1989089383130508, 'fraction_numerical': 0.0, 'mean_word_length': 2.662058371735791, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '5680894', 'n_tokens_mistral': 1011, 'n_tokens_neox': 863, 'n_words': 148}