Converts the given input to snake_case

@param  string $input
@param  string $glue
@param  string $separator
@return string
551733
protected static function snakeCase($input, $glue = '_', $separator = '-')
    {
        $input = preg_split('/(?<=[a-z])(?=[A-Z])/x', $input);
        $input = join($input, $glue);
        $input = str_replace($separator, $glue, $input);

        return strtolower($input);
    }
1507
public function implode($value, $glue = null)
	{
		if (is_null($glue)) return implode($this->lists($value));

		return implode($glue, $this->lists($value));
	}
383875
public static function splitCamelCase(string $string, string $glue = ' '): string
    {
        $expression = '/(?#! splitCamelCase Rev:20140412)
                        # Split camelCase "words". Two global alternatives. Either g1of2:
                          (?<=[a-z])      # Position is after a lowercase,
                          (?=[A-Z])       # and before an uppercase letter.
                        | (?<=[A-Z])      # Or g2of2; Position is after uppercase,
                          (?=[A-Z][a-z])  # and before upper-then-lower case.
                        /x';
        $split = preg_split($expression, $string);
        $output = [];
        $count = count($split);
        for ($i = 0; $i < $count; ++$i) { // @todo: rework me with foreach() cycle
            $word = strtolower($split[$i]);
            if ($i === 0) {
                $word = ucfirst($word);
            }
            $output[] = $word;
        }

        return implode($glue, $output);
    }
111870
public static function jail($input, $jail, $separator = self::SEPARATOR_BOTH){
        if(self::isAbsolute($input))
            return false;

        if(!self::isAbsolute($jail))
            throw new \Exception("Jail path needs to be absolute");

        $path = self::real($jail, $separator)
              . ($separator==self::SEPARATOR_BOTH? self::SEPARATOR_LINUX : $separator)
              . self::real($input, $separator);

        return self::in($path, $jail, $separator);
    }
1087013
public function snakeCase($value, $delimiter = '_')
    {
        if (!ctype_lower($value)) {
            $value = strtolower(preg_replace('/(.)(?=[A-Z])/', '$1'.$delimiter, $value));
            $value = preg_replace('/\s+/', '', $value);
        }

        return $value;
    }
122124
public static function snake($str, $delimiter = '_')
    {
        $str = preg_replace('/\s+/u', $delimiter, $str);

        $str = static::lower(preg_replace_callback('/([A-Z])/u', function ($math) use ($delimiter) {
            return $delimiter.static::lower($math[1]);
        }, $str));

        return trim(preg_replace('/'.$delimiter.'{2,}/', $delimiter, $str), $delimiter);
    }
1059624
private function fromCamelCase($input) {
	       
	        $a = preg_split(
		        '/(^[^A-Z]+|[A-Z][^A-Z]+)/',
		        $input,
		        -1, /* no limit for replacement count */
		        PREG_SPLIT_NO_EMPTY /*don't return empty elements*/
		            | PREG_SPLIT_DELIM_CAPTURE /*don't strip anything from output array*/
		    );
	        return strtolower(join($a, "-"));
	}
1260953
public static function real($input, $separator = self::SEPARATOR_BOTH){
        $parsed = self::parse($input, $separator);
        if(!self::validate($parsed["path"]))
            throw new \Exception("Path is invalid");

        $elements_in =  self::explode($parsed["path"], $separator);
        $elements_out = array();
        $absolute = self::isAbsolute($input);

        if(self::isAbsolute($input))
            array_push($elements_out, null);

        foreach($elements_in as $idx => $element){
            switch($element){
                case "":
                case ".":
                    break;
                case "..":
                    if(count($elements_out) > 0 && end($elements_out) != "..")
                        array_pop($elements_out);
                    elseif(!$absolute)
                        array_push($elements_out, "..");
                    else
                        throw new \Exception("Can not move to parent of root folder in an absolute path");
                    break;
                default:
                    array_push($elements_out, $element);
            }
        }

        return $parsed["device"].implode($separator==self::SEPARATOR_BOTH? self::SEPARATOR_LINUX : $separator, $elements_out);
    }
415174
public function separator(string $sep): CollectionFlattener
    {
        if (mb_strlen($sep) != 1 || $sep === '*') {
            throw new Exception(__CLASS__.': Separator must be 1 character and cannot be an asterisk (*)');
        }
        $this->separator = $sep;
        return $this;
    }
18784
public function snakeCase($value, $delimiter = '_')
	{
		$replace = '$1'.$delimiter.'$2';

		return ctype_lower($value) ? $value : strtolower(preg_replace('/(.)([A-Z])/', $replace, $value));
	}
1043632
public static function join($glue = null, array $inputArray = null)
	{

		//check for the existance of the implementation class
		self::setImplmentationClass();

		//create the aprameter in a try...catch block for better error handling
		try{

			//set the value of the glue methodArg
			$glue = ( $glue !== null) ? $glue : self::$ArrayHelperClassInstance->getMethodArgs('glue');

			//set the value of the inputArray
			$inputArray = ( ! is_null($inputArray)) ? $inputArray : self::$ArrayHelperClassInstance->getOutputElement();

			//chekc if the value of the glue is null and throw exception
			if($glue === null) throw new ArrayHelperException("NULL  \$glue value has been passed for joining \$inputArray into String to ArrayHelper::join() method. A string value is expectd!",1);

			//check if null was passed for the input array
			if($inputArray === null) throw new ArrayHelperException("NULL \$inputArray value has been passed for splitting into a string to the ArrayHelper::join() method. A valid array value is expected!", 1);
			
			//call the implementation method to join this string
			self::$ArrayHelperClassInstance->join($glue, $inputArray);

			//return the static instance
			return new static;

		}

		//catch the thrown error here
		catch(ArrayHelperException $ArrayHelperExceptionInstance){

			//diplay the error message
			$ArrayHelperExceptionInstance->errorShow();

		}

	}
204683
public static function __string($value, $glue = ', ')
    {
        if (is_object($value)) {
            if (method_exists($value, '__toString')) {
                return $value->__toString();
            }
            if ($value instanceof ArrayAccess) {
                return implode($glue, $value);
            }
            return get_class($value);
        } elseif (is_array($value)) {
            return implode($glue, $value);
        } elseif (is_bool($value)) {
            return (true===$value ? 'true' : 'false');
        } elseif (is_callable($value)) {
            return self::__closurable($value);
        }
        return (string) $value;
    }
1324020
final public static function flatten(array $input, string $delimiter = '.') : array
    {
        $args = func_get_args();
        $prefix = count($args) === 3 ? array_pop($args) : '';
        $result = [];
        foreach ($input as $key => $value) {
            $newKey = $prefix . (empty($prefix) ? '' : $delimiter) . $key;
            if (is_array($value)) {
                $result = array_merge($result, self::flatten($value, $delimiter, $newKey));
                continue;
            }

            $result[$newKey] = $value;
        }

        return $result;
    }
272955
public static function make($string, $separator = '-', $emptyValue = null)
    {
        $string = preg_replace('/
                    [\x09\x0A\x0D\x20-\x7E]            # ASCII
                  | [\xC2-\xDF][\x80-\xBF]             # non-overlong 2-byte
                  |  \xE0[\xA0-\xBF][\x80-\xBF]        # excluding overlongs
                  | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
                  |  \xED[\x80-\x9F][\x80-\xBF]        # excluding surrogates
                  |  \xF0[\x90-\xBF][\x80-\xBF]{2}     # planes 1-3
                  | [\xF1-\xF3][\x80-\xBF]{3}          # planes 4-15
                  |  \xF4[\x80-\x8F][\x80-\xBF]{2}     # plane 16
               /', '', $string);
        $string = static::translateByArray($string);
        $string = preg_replace('#[^\\pL\d]+#u', $separator, $string);
        $string = trim($string, $separator);
        $string = (defined('MB_CASE_LOWER')) ? mb_strtolower($string) : strtolower($string);
        $string = preg_replace('#[^-\w]+#', '', $string);
        if ($string === '') {
            return $emptyValue ?: 'n' . $separator . 'a';
        }

        return $string;
    }
1161645
public final function prepareIdentifier(string $input, $inputParam): string
    {
        if (empty($inputParam)) {
            if (strpos($input, '%n') !== false) {
                throw new AgentException('Found %n operator but no replacement parameter given!');
            } elseif (strpos($input, '??') !== false) {
                throw new AgentException('Found ?? operator but no replacement parameter given!');
            }
        } else {
            $input = $this->prepare($input, (array) $inputParam);

            // eg: ('@a.id=?', 1), ('@a.id=@b.id')
            // eg: ('??=?', ['a.id',1]), ('??=??', ['a.id','b.id'])
            // eg: ('a.id=?, a.b=?', [1,2]), ('a.id=??, a.b=?', ['b.id',2])
            if (strpos($input, '=')) {
                $input = implode(', ', array_map(function ($input) {
                    $input = trim($input);
                    if ($input != '') {
                        $input = array_map('trim', explode('=', $input));
                        $input = $this->escapeIdentifier($input[0]) .' = '. (
                            ($input[1] && $input[1][0] == '@' )
                                ? $this->escapeIdentifier($input[1]) : $input[1]
                        );
                        return $input;
                    }
                }, explode(',', $input)));
            }

            return $input;
        }

        // eg: (a.id = 1), (a.id = @b.id)
        if (strpos($input, '=')) {
            $input = implode(', ', array_map(function ($input) {
                $input = trim($input);
                if ($input != '') {
                    $input = array_map('trim', explode('=', $input));
                    $input = $this->escapeIdentifier($input[0]) .' = '. (
                        ($input[1] && $input[1][0] == '@' )
                            ? $this->escapeIdentifier($input[1]) : $this->escape($input[1])
                    );
                    return $input;
                }
            }, explode(',', $input)));
        } else {
            // eg: a.id
            $input = $this->escapeIdentifier($input);
        }

        return $input;
    }
190558
public static function camelize(string $input, string $separator = '_', bool $capitalizeFirstCharacter = false): string {
    $output = $input;

    if (ctype_upper($output)) {
      $output = mb_strtolower($output);
    }

    if (strpos($output, $separator) || strpos($output, ' ')) {
      $output = mb_strtolower($input);
      $output = str_replace(' ', '', ucwords(str_replace($separator, ' ', $output)));
    }

    if ($output[0] && !$capitalizeFirstCharacter) {
      $output[0] = mb_strtolower($output[0]);
    }

    return $output;
  }
408081
public static function snake($value, $delimiter = '_')
        {
            $replace = '$1' . $delimiter . '$2';
            return ctype_lower($value) ? $value : static::lower(preg_replace('/(.)([A-Z])/', $replace, $value));
        }