<commit_before><?php
namespace Colibri\Util;
use Colibri\Pattern\Helper;

/**
 * Description of Arr
 *
 * @author <NAME> aka alek13 <<EMAIL>>
 */
class Arr extends Helper
{
	/**
	 * 
	 * @param array $array
	 * @param array $with
	 * @return array
	 */
	public static function overwrite(array $array, array $with)
	{
		return array_replace_recursive($array, $with);
	}
	/**
	 * Get an item from an array using "dot" notation.
	 *
	 * @param  array   $array
	 * @param  string  $key
	 * @param  mixed   $default
	 * @return mixed
	 */
	public static function get(array $array, $key = null, $default = null)
	{
		if (is_null($key)) return $array;
		if (isset($array[$key])) return $array[$key];

		foreach (explode('.', $key) as $segment) {
			if (!is_array($array) || !array_key_exists($segment, $array)) {
				return $default;
			}
			$array = $array[$segment];
		}

		return $array;
	}

}<commit_msg>add Arr::remove()<commit_after><?php
namespace Colibri\Util;
use Colibri\Pattern\Helper;

/**
 * Description of Arr
 *
 * @author <NAME> aka alek13 <<EMAIL>>
 */
class Arr extends Helper
{
	/**
	 * 
	 * @param array $array
	 * @param array $with
	 * @return array
	 */
	public static function overwrite(array $array, array $with)
	{
		return array_replace_recursive($array, $with);
	}
	/**
	 * Get an item from an array using "dot" notation.
	 *
	 * @param  array   $array
	 * @param  string  $dottedKey
	 * @param  mixed   $default
	 * @return mixed
	 */
	public static function get(array $array, $dottedKey = null, $default = null)
	{
		if (is_null($dottedKey)) return $array;
		if (isset($array[$dottedKey])) return $array[$dottedKey];

		foreach (explode('.', $dottedKey) as $segment) {
			if (!is_array($array) || !array_key_exists($segment, $array)) {
				return $default;
			}
			$array = $array[$segment];
		}

		return $array;
	}

	/**
	 * @param array  $array
	 * @param string $dottedKey
	 * @param mixed  $value
	 *
	 * @return mixed
	 */
	public static function &set(&$array, $dottedKey, $value)
	{
		if (is_null($dottedKey)) return $array = $value;

		$k = explode('.', $dottedKey, 2);

		$array[$k[0]] = isset($k[1])
			? Arr::set($array[$k[0]], $k[1], $value)
			: $value;

		return $array;
	}

	/**
	 * @param array  $array
	 * @param string $dottedKey
	 *
	 * @return mixed|null
	 */
	public static function remove(array &$array, $dottedKey)
	{
		if (isset($array[$dottedKey])) {
			$value = $array[$dottedKey];
			unset($array[$dottedKey]);
			return $value;
		}

		$k = explode('.', $dottedKey, 2);
		return isset($k[1])
			? Arr::remove($array[$k[0]], $k[1])
			: null;
	}
}
{'fraction_non_alphanumeric': 0.17642526964560862, 'fraction_numerical': 0.005007704160246533, 'mean_word_length': 3.4545454545454546, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '147806', 'n_tokens_mistral': 1026, 'n_tokens_neox': 909, 'n_words': 239}