protected function tokenReplace($input, $replacements)
    {
        if (is_string($input)) {
            return strtr($input, $replacements);
        }
        if (is_scalar($input) || empty($input)) {
            return $input;
        }
        foreach ($input as &$i) {
            $i = $this->tokenReplace($i, $replacements);
        }
        return $input;
    }
protected function tokenReplace($input, $replacements)
    {
        if (is_string($input)) {
            return strtr($input, $replacements);
        }
        if (is_scalar($input) || empty($input)) {
            return $input;
        }
        foreach ($input as &$i) {
            $i = $this->tokenReplace($i, $replacements);
        }
        return $input;
    }
protected function tokenReplace ( $ input , $ replacements ) { if ( is_string ( $ input ) ) { return strtr ( $ input , $ replacements ) ; } if ( is_scalar ( $ input ) || empty ( $ input ) ) { return $ input ; } foreach ( $ input as & $ i ) { $ i = $ this -> tokenReplace ( $ i , $ replacements ) ; } return $ input ; }
Helper functions to replace tokens in an array.

@param string|array $input
The array or string containing the tokens to replace.
@param array $replacements
The token replacements.

@return string|array
The input with the tokens replaced with their values.
Helper functions to replace tokens in an array .