This function supports extra params for var substition in $string.

@param string $string

@return string
334968
public function translate($string)
    {
        $args = func_get_args();
        $translated = array_shift($args);
        $extraParams = $args;
        if (count($extraParams)>0)
        {
            $translated = vsprintf($translated, $extraParams);
        }

        return $translated;
    }
1337568
public function string($string = NULL)
	{
		if (func_num_args() === 0)
		{
			return $this->_string;
		}
		$this->_string = $string;
		return $this;
	}
351291
protected function replaceVars($string, Config $config)
    {
        while (0 < preg_match_all('/\{\{([^\}]+)\}\}/', $string, $matches)) {
            foreach ($matches[0] as $i => $match) {
                $string = str_replace($match, $config->get($matches[1][$i]), $string);
            }
        }

        return $string;
    }
985033
protected function _replaceParameters($string, array $parameters = array())
    {
        //Adds curly braces around keys to make strtr work in replaceParameters method
        $replace_keys = function ($key) {
            return  '{'.$key.'}';
        };

        $keys       = array_map($replace_keys, array_keys($parameters));
        $parameters = array_combine($keys, $parameters);

        return strtr($string, $parameters);
    }
1102472
protected function searchAndReplaceVariables($string)
    {
        return str_replace(
            ['{$major}', '{$minor}', '{$patch}', '{$repository}', '{$build}'],
            [
                $this->getVersion('major'),
                $this->getVersion('minor'),
                $this->getVersion('patch'),
                $this->git->getGitRepository(),
                $this->getBuild(),
            ],
            $string
        );
    }
800043
public static function ucfirst(string $string): string
    {
        return self::strtoupper(self::substr($string, 0, 1)) . self::substr($string, 1);
    }
641092
protected function normalizeString($string)
    {
        if (false === strpos($string, '_')) {
            return $string;
        }

        return preg_replace_callback('/_([a-zA-Z0-9])/', function ($matches) {
            return strtoupper($matches[1]);
        }, $string);
    }
713208
private function __fromCamel($string)
    {
        $string[0] = strtolower($string[0]);

        return preg_replace_callback('/([A-Z])/', function($c) {
            return "_" . strtolower($c[1]);
        }, $string);
    }
1346728
public static function cliMessage($string)
    {
        $preString = '  | ';
        if (is_array($string)) {
            echo $preString.implode("\n==> ", $string)."\n";
        } else {
            echo $preString.$string."\n";
        }
    }
618379
static function fromString(string $string): self
    {
        $string = str_replace("/", "\\", $string);
        $string = preg_replace("#(\\\\){2,}#", "\\", $string);
        if (substr($string, -1, 1) == "\\") {
            $string = substr($string, 0, -1);
        }
        
        return new self($string);
    }
456194
protected function stringNotEndWith(string $string, string $char){
		return $string[strlen($string)-1]===$char ? substr($string, 0, -1) : $string;
	}
908282
public static function str2bin($string)
    {
        if (is_array($string) || is_object($string)) {
            $caller =  next(debug_backtrace());
            $error['line']  = $caller['line'];
            $error['file']  = strip_tags($caller['file']);
            trigger_error(
                "str2bin() expects parameter 1 to be string, "
                . gettype($string)
                . " given in <b>{$error['file']}</b> on line <b>{$error['line']}</b><br />\n",
                E_USER_ERROR
            );

            return '';
        }

        if (strlen($string) <= 0) {
            return '';
        }

        $string = str_split($string, 1);
        for ($i = 0, $n = count($string); $i < $n; ++$i) {
            $string[$i] = decbin(ord($string[$i]));
            $string[$i] = str_repeat("0", 8 - strlen($string[$i])) . $string[$i];
        }

        return implode("", $string);
    }
1229388
public static function variable(string $string): string
	{
		$result = static::_cache(__FUNCTION__, $string);

		if ($result === false) {
			$camelized = static::camelize(static::underscore($string));
			$replace = \strtolower($camelized[0]);
			$result = $replace . \substr($camelized, 1);
			static::_cache(__FUNCTION__, $string, $result);
		}

		return $result;
	}
767735
protected function escape(string $string): string
	{
		if($this->formatter !== null)
		{
			return $this->formatter->escape($string);
		}

		return $string;
	}
541842
private function processStringPlaceholders($string, array $variables)
    {
        foreach ($variables as $key => $value) {
            if (!is_string($value) && !is_numeric($value) && !is_bool($value)) {
                continue;
            }

            $string = str_replace('{'.$key.'}', $value, (string) $string);
        }

        return $string;
    }
1168220
public function trimValue($string){
			if (is_array($string)) {
				foreach ($string as $k => $v) {
					$string[$k] = $this->trimValue($v);
				}
			} else if (is_string ($string)) {
				return trim($string);
			}
			return $string;
		}
482078
public static function camelizeAction($string)
    {
        $string = str_ireplace("-", "_", $string);
        $string = str_ireplace("_", " ", $string);
        $string = str_ireplace(" ", "", lcfirst(ucwords($string)));

        return $string;
    }